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AAO,CAAC;IACjB,wBAAe,CAAC,4CAAoB,CAAC;IAI7B,WAAA,eAAM,CAAC,4BAAY,CAAC,CAAA;qCAAgC,4BAAY;GAH5D,aAAa,CA2BzB;AA3BY,sCAAa","file":"score.resolver.js","sourcesContent":["import { HttpException, Inject, UseInterceptors } from \"@nestjs/common\";\nimport { Mutation, Query, Resolver } from \"@nestjs/graphql\";\nimport { Request } from \"express\";\nimport { ExceptionInterceptor } from \"../interceptor/exception.interceptor\";\nimport { Data } from \"../interface/data\";\nimport { ScoreService } from \"../service/score.service\";\n\n@Resolver(\"Score\")\n@UseInterceptors(ExceptionInterceptor)\nexport class ScoreResolver {\n\n constructor(\n @Inject(ScoreService) private readonly scoreService: ScoreService\n ) {\n }\n\n @Query(\"getScore\")\n async getScore(req: Request, body: { userId: number, scoreTypeId: number }): Promise<Data & { score: number }> {\n const { userId, scoreTypeId } = body;\n if (!userId || !scoreTypeId) {\n throw new HttpException(\"缺少参数\", 400);\n }\n const score = await this.scoreService.getScore(userId, scoreTypeId);\n return { code: 200, message: \"获取积分成功\", score };\n }\n\n @Mutation(\"setScore\")\n async setScore(req: Request, body: { userId: number, scoreTypeId: number, add: number }): Promise<Data> {\n const { userId, scoreTypeId, add } = body;\n if (!userId || !scoreTypeId) {\n throw new HttpException(\"缺少参数\", 400);\n }\n await this.scoreService.setScore(userId, scoreTypeId, add);\n return { code: 200, message: \"设置积分成功\" };\n }\n\n}\n"]}
\No newline at end of file