Refacor electron app and add migrations
This commit is contained in:
11
electron/cqrs/queries/handlers/getUser.ts
Normal file
11
electron/cqrs/queries/handlers/getUser.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import { UserEntity } from '../../../entities';
|
||||
import { GetUserQuery } from '../../types';
|
||||
import { rowToUser } from '../../mappers';
|
||||
|
||||
export async function handleGetUser(query: GetUserQuery, dataSource: DataSource) {
|
||||
const repo = dataSource.getRepository(UserEntity);
|
||||
const row = await repo.findOne({ where: { id: query.payload.userId } });
|
||||
|
||||
return row ? rowToUser(row) : null;
|
||||
}
|
||||
Reference in New Issue
Block a user