แก้ create เป็น update เมนูทะเบียนประวัติ
This commit is contained in:
parent
fde5f8d90a
commit
f281ea0bc2
61 changed files with 193 additions and 147 deletions
|
|
@ -163,12 +163,12 @@ export class ProfileAssessmentsController extends Controller {
|
|||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
||||
|
||||
const profile = await this.profileRepo.findOneBy({ id: body.profileId });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileAssessment();
|
||||
const meta = {
|
||||
|
|
@ -194,11 +194,10 @@ export class ProfileAssessmentsController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Path() assessmentId: string,
|
||||
) {
|
||||
|
||||
const record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", record.profileId);
|
||||
|
||||
|
||||
const history = new ProfileAssessmentHistory();
|
||||
|
||||
Object.assign(record, body);
|
||||
|
|
@ -227,7 +226,11 @@ export class ProfileAssessmentsController extends Controller {
|
|||
) {
|
||||
const _record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
req,
|
||||
"SYS_REGISTRY_OFFICER",
|
||||
_record.profileId,
|
||||
);
|
||||
}
|
||||
await this.profileAssessmentsHistoryRepository.delete({
|
||||
profileAssessmentId: assessmentId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue