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

View file

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