import { Injectable } from '@nestjs/common'; import { CreateQuestionDTO } from '../dtos/create-question.dto'; import { FindQuestionsDTO } from '../dtos/find-questions.dto'; import { UpdateQuestionDTO } from '../dtos/update-question.dto'; import { QuestionsCommandProvider } from './questions-command.provider'; import { QuestionsQueryProvider } from './questions-query.provider'; @Injectable() export class QuestionsService { constructor( /** * Inject Questions Command Provider */ private readonly questionsCommandProvider: QuestionsCommandProvider, /** * Inject Questions Query Provider */ private readonly questionsQueryProvider: QuestionsQueryProvider, ) {} public async createOne(createQuestionDto: CreateQuestionDTO) { return await this.questionsCommandProvider.createOne(createQuestionDto); } public async findAllForAdmin(query: FindQuestionsDTO) { return await this.questionsQueryProvider.findAllForAdmin(query); } public async findOneForAdmin(id: number) { return await this.questionsQueryProvider.findOneForAdmin(id); } public async updateOne(id: number, updateQuestionDto: UpdateQuestionDTO) { return await this.questionsCommandProvider.updateOne(id, updateQuestionDto); } public async deleteOne(id: number) { return await this.questionsCommandProvider.deleteOne(id); } }