fixing response object

This commit is contained in:
Warunee Tamkoo 2024-09-05 17:26:52 +07:00
parent ba612f1b2b
commit fd76c6ee09
3 changed files with 11 additions and 13 deletions

View file

@ -278,12 +278,10 @@ export class DataOptionController extends Controller {
...person, ...person,
}; };
const data = await { return new HttpSuccess({
person: responsePerson, person: responsePerson,
assign_no: assign + 1, assign_no: assign + 1,
assign_month: 6, assign_month: 6,
}; });
return new HttpSuccess({ data: data });
} }
} }

View file

@ -179,12 +179,12 @@ export class ReportController extends Controller {
*/ */
@Get("expand") @Get("expand")
async GetDataExpand() { async GetDataExpand() {
const lists = await this.personalRepository.find({ const data = await this.personalRepository.find({
select: ["personal_id"], select: ["personal_id"],
where: { probation_status: 7 }, where: { probation_status: 7 },
}); });
return new HttpSuccess(lists); return new HttpSuccess(data);
} }
/** /**
@ -556,7 +556,7 @@ export class ReportController extends Controller {
* *
*/ */
@Get("evaluate-commander") @Get("evaluate-commander")
async GetDataEvaluateCommander(@Query() id: string) { async GetDataEvaluateCommander(@Query() id: string, @Request() request: RequestWithUser) {
const evaluate = await this.evaluateCommanderRepository.findOne({ const evaluate = await this.evaluateCommanderRepository.findOne({
where: { id }, where: { id },
}); });
@ -810,7 +810,7 @@ export class ReportController extends Controller {
* *
*/ */
@Get("evaluate-chairman") @Get("evaluate-chairman")
async GetDataEvaluateChairman(@Query() id: string) { async GetDataEvaluateChairman(@Query() id: string, @Request() request: RequestWithUser) {
const evaluate = await this.evaluateChairmanRepository.findOne({ const evaluate = await this.evaluateChairmanRepository.findOne({
where: { id }, where: { id },
}); });

View file

@ -36,13 +36,13 @@ export class SurveyController extends Controller {
* *
*/ */
@Get("") @Get("")
async GetSurvey(@Query() assign_id: string, @Request() request: RequestWithUser) { async GetSurvey(@Query() assign_id: string) {
const result = await this.surveyRepository.findOne({ const data = await this.surveyRepository.findOne({
where: { where: {
assign_id, assign_id,
}, },
}); });
return new HttpSuccess(result); return new HttpSuccess(data);
} }
/** /**
@ -58,10 +58,10 @@ export class SurveyController extends Controller {
@Request() request: RequestWithUser, @Request() request: RequestWithUser,
) { ) {
const before = null; const before = null;
const data = await { ...requestBody, personal_id: request.user.sub }; const data = await { ...requestBody, personal_id: request.user.sub, assign_id };
await this.surveyRepository.save(data, { data: request }); await this.surveyRepository.save(data, { data: request });
setLogDataDiff(request, { before, after: data }); setLogDataDiff(request, { before, after: data });
return new HttpSuccess(data); return new HttpSuccess();
} }
} }