comment family

This commit is contained in:
Kittapath 2024-05-14 17:32:36 +07:00
parent 09b543763b
commit 73ae98ce0e
2 changed files with 9 additions and 11 deletions

View file

@ -16,8 +16,6 @@ import { AppDataSource } from "../database/data-source";
import {
CreateChildren,
CreateProfileFamily,
ProfileChildren,
ProfileChildrenHistory,
ProfileFamilyHistory,
UpdateProfileFamily,
} from "../entities/ProfileFamily";
@ -26,6 +24,8 @@ import HttpStatus from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { RequestWithUser } from "../middlewares/user";
import { Profile } from "../entities/Profile";
import { ProfileChildren } from "../entities/ProfileChildren";
import { ProfileChildrenHistory } from "../entities/ProfileChildrenHistory";
@Route("api/v1/org/profile/family")
@Tags("ProfileFamilyHistory")
@ -228,7 +228,7 @@ export class ProfileFamilyHistoryController extends Controller {
...v,
children: await this.childrenHistoryRepo.find({
order: { createdAt: "ASC" },
where: { profileFamilyHistoryId: v.id },
// where: { profileFamilyHistoryId: v.id },
}),
})),
);
@ -340,7 +340,7 @@ export class ProfileFamilyHistoryController extends Controller {
return await this.childrenHistoryRepo.save(
this.childrenHistoryRepo.create({
...v,
profileFamilyHistoryId: familyRecord.id,
// profileFamilyHistoryId: familyRecord.id,
profileChildrenId: v.id,
id: undefined,
}),

View file

@ -15,10 +15,7 @@ import {
import { AppDataSource } from "../database/data-source";
import {
CreateChildren,
CreateProfileFamily,
CreateProfileFamilyEmployee,
ProfileChildren,
ProfileChildrenHistory,
ProfileFamilyHistory,
UpdateProfileFamily,
} from "../entities/ProfileFamily";
@ -26,8 +23,9 @@ import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { RequestWithUser } from "../middlewares/user";
import { Profile } from "../entities/Profile";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { ProfileChildren } from "../entities/ProfileChildren";
import { ProfileChildrenHistory } from "../entities/ProfileChildrenHistory";
@Route("api/v1/org/profile-employee/family")
@Tags("ProfileFamilyHistoryEmployee")
@ -230,7 +228,7 @@ export class ProfileFamilyHistoryEmployeeController extends Controller {
...v,
children: await this.childrenHistoryRepo.find({
order: { createdAt: "ASC" },
where: { profileFamilyHistoryId: v.id },
// where: { profileFamilyHistoryId: v.id },
}),
})),
);
@ -342,7 +340,7 @@ export class ProfileFamilyHistoryEmployeeController extends Controller {
return await this.childrenHistoryRepo.save(
this.childrenHistoryRepo.create({
...v,
profileFamilyHistoryId: familyRecord.id,
// profileFamilyHistoryId: familyRecord.id,
profileChildrenId: v.id,
id: undefined,
}),
@ -361,7 +359,7 @@ export class ProfileFamilyHistoryEmployeeController extends Controller {
if (result.affected == undefined || result.affected <= 0) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess();
}
}