feat: change scoring strategy
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
import { Role } from '@/common/enums/roles.enum';
|
||||
import { Roles } from '@/modules/auth/decorators/roles.decorator';
|
||||
import { CreateQuestionRangeRuleDTO } from '@/modules/questions/dtos/create-question-range-rule.dto';
|
||||
import { CreateQuestionDTO } from '@/modules/questions/dtos/create-question.dto';
|
||||
import { FindQuestionRangeRuleDTO } from '@/modules/questions/dtos/find-question-range-rule.dto';
|
||||
import { FindQuestionsDTO } from '@/modules/questions/dtos/find-questions.dto';
|
||||
import { UpdateQuestionRangeRuleDTO } from '@/modules/questions/dtos/update-question-range-rule.dto';
|
||||
import { UpdateQuestionDTO } from '@/modules/questions/dtos/update-question.dto';
|
||||
import { QuestionRangeRuleService } from '@/modules/questions/providers/question-range-rule.service';
|
||||
import { QuestionsService } from '@/modules/questions/providers/questions.service';
|
||||
import {
|
||||
Body,
|
||||
@@ -26,6 +30,11 @@ export class AdminQuestionsController {
|
||||
* Inject Questions Service Provider
|
||||
*/
|
||||
private readonly questionsService: QuestionsService,
|
||||
|
||||
/**
|
||||
* Inject Questions Range Rules Service
|
||||
*/
|
||||
private readonly questionRangeRulesService: QuestionRangeRuleService,
|
||||
) {}
|
||||
|
||||
@Post()
|
||||
@@ -38,6 +47,44 @@ export class AdminQuestionsController {
|
||||
return await this.questionsService.findAllForAdmin(query);
|
||||
}
|
||||
|
||||
@Post('range-rules')
|
||||
public async createQuestionRangeRule(
|
||||
@Body() createQuestionRangeRuleDto: CreateQuestionRangeRuleDTO,
|
||||
) {
|
||||
return await this.questionRangeRulesService.createOne(
|
||||
createQuestionRangeRuleDto,
|
||||
);
|
||||
}
|
||||
|
||||
@Get('range-rules')
|
||||
public async getAllQuestionRangeRules(
|
||||
@Query() query: FindQuestionRangeRuleDTO,
|
||||
) {
|
||||
return await this.questionRangeRulesService.findAllForAdmin(query);
|
||||
}
|
||||
|
||||
@Get('range-rules/:id')
|
||||
public async getQuestionRangeRuleById(@Param('id', ParseIntPipe) id: number) {
|
||||
return await this.questionRangeRulesService.findOneForAdmin(id);
|
||||
}
|
||||
|
||||
@Patch('range-rules/:id')
|
||||
public async updateQuestionRangeRule(
|
||||
@Param('id', ParseIntPipe) id: number,
|
||||
@Body() updateQuestionRangeRuleDto: UpdateQuestionRangeRuleDTO,
|
||||
) {
|
||||
return await this.questionRangeRulesService.updateOne(
|
||||
id,
|
||||
updateQuestionRangeRuleDto,
|
||||
);
|
||||
}
|
||||
|
||||
@Delete('range-rules/:id')
|
||||
@HttpCode(HttpStatus.NO_CONTENT)
|
||||
public async deleteQuestionRangeRule(@Param('id', ParseIntPipe) id: number) {
|
||||
return await this.questionRangeRulesService.deleteOne(id);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
public async getQuestionById(@Param('id', ParseIntPipe) id: number) {
|
||||
return await this.questionsService.findOneForAdmin(id);
|
||||
|
||||
Reference in New Issue
Block a user