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,
};
const data = await {
return new HttpSuccess({
person: responsePerson,
assign_no: assign + 1,
assign_month: 6,
};
return new HttpSuccess({ data: data });
});
}
}

View file

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

View file

@ -36,13 +36,13 @@ export class SurveyController extends Controller {
*
*/
@Get("")
async GetSurvey(@Query() assign_id: string, @Request() request: RequestWithUser) {
const result = await this.surveyRepository.findOne({
async GetSurvey(@Query() assign_id: string) {
const data = await this.surveyRepository.findOne({
where: {
assign_id,
},
});
return new HttpSuccess(result);
return new HttpSuccess(data);
}
/**
@ -58,10 +58,10 @@ export class SurveyController extends Controller {
@Request() request: RequestWithUser,
) {
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 });
setLogDataDiff(request, { before, after: data });
return new HttpSuccess(data);
return new HttpSuccess();
}
}