mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-17 12:33:22 +00:00
17 lines
571 B
TypeScript
17 lines
571 B
TypeScript
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs'
|
|
import { DecksRepository } from '../infrastructure/decks.repository'
|
|
import { GetAllDecksDto } from '../dto'
|
|
|
|
export class GetAllDecksCommand {
|
|
constructor(public readonly params: GetAllDecksDto) {}
|
|
}
|
|
|
|
@CommandHandler(GetAllDecksCommand)
|
|
export class GetAllDecksHandler implements ICommandHandler<GetAllDecksCommand> {
|
|
constructor(private readonly deckRepository: DecksRepository) {}
|
|
|
|
async execute(command: GetAllDecksCommand) {
|
|
return await this.deckRepository.findAllDecks(command.params)
|
|
}
|
|
}
|