Refactor 4 with bugfixes
This commit is contained in:
10
server/src/cqrs/queries/handlers/getAllPublicServers.ts
Normal file
10
server/src/cqrs/queries/handlers/getAllPublicServers.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import { ServerEntity } from '../../../entities';
|
||||
import { rowToServer } from '../../mappers';
|
||||
|
||||
export async function handleGetAllPublicServers(dataSource: DataSource) {
|
||||
const repo = dataSource.getRepository(ServerEntity);
|
||||
const rows = await repo.find({ where: { isPrivate: 0 } });
|
||||
|
||||
return rows.map(rowToServer);
|
||||
}
|
||||
Reference in New Issue
Block a user