add crete/get cards

This commit is contained in:
2023-06-18 12:16:03 +02:00
parent 0794238f0d
commit ca976cfe5d
19 changed files with 358 additions and 7 deletions

View File

@@ -0,0 +1,15 @@
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs'
import { CardsRepository } from '../infrastructure/cards.repository'
export class GetDeckByIdCommand {
constructor(public readonly id: string) {}
}
@CommandHandler(GetDeckByIdCommand)
export class GetDeckByIdHandler implements ICommandHandler<GetDeckByIdCommand> {
constructor(private readonly deckRepository: CardsRepository) {}
async execute(command: GetDeckByIdCommand) {
return await this.deckRepository.findDeckById(command.id)
}
}