เพิ่ม/แก้ไขตำแหน่ง ปรับให้ส่ง null บางฟิลด์ได้
This commit is contained in:
parent
43a1dfe8d2
commit
9d205caa1f
2 changed files with 19 additions and 11 deletions
|
|
@ -309,19 +309,27 @@ export class PositionController extends Controller {
|
||||||
posDictField: requestBody.posDictField,
|
posDictField: requestBody.posDictField,
|
||||||
posTypeId: requestBody.posTypeId,
|
posTypeId: requestBody.posTypeId,
|
||||||
posLevelId: requestBody.posLevelId,
|
posLevelId: requestBody.posLevelId,
|
||||||
posExecutiveId: String(requestBody.posExecutiveId),
|
posExecutiveId: requestBody.posExecutiveId?requestBody.posExecutiveId:"",
|
||||||
posDictExecutiveField: requestBody.posDictExecutiveField,
|
posDictExecutiveField: requestBody.posDictExecutiveField?requestBody.posDictExecutiveField:"",
|
||||||
posDictArea: requestBody.posDictArea,
|
posDictArea: requestBody.posDictArea?requestBody.posDictArea:"",
|
||||||
isSpecial: requestBody.isSpecial,
|
isSpecial: requestBody.isSpecial,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (rowRepeated) {
|
if (rowRepeated) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ข้อมูล Row นี้มีอยู่ในระบบแล้ว");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ข้อมูล Row นี้มีอยู่ในระบบแล้ว");
|
||||||
}
|
}
|
||||||
|
Object.assign(posDict, requestBody);
|
||||||
posDict.lastUpdateUserId = request.user.sub;
|
posDict.lastUpdateUserId = request.user.sub;
|
||||||
posDict.lastUpdateFullName = request.user.name;
|
posDict.lastUpdateFullName = request.user.name;
|
||||||
this.posDictRepository.merge(posDict, requestBody);
|
posDict.posDictName = requestBody.posDictName,
|
||||||
|
posDict.posDictField = requestBody.posDictField,
|
||||||
|
posDict.posTypeId = requestBody.posTypeId,
|
||||||
|
posDict.posLevelId = requestBody.posLevelId,
|
||||||
|
posDict.posExecutiveId = requestBody.posExecutiveId?requestBody.posExecutiveId:null,
|
||||||
|
posDict.posDictExecutiveField = requestBody.posDictExecutiveField?requestBody.posDictExecutiveField:"",
|
||||||
|
posDict.posDictArea = requestBody.posDictArea?requestBody.posDictArea:"",
|
||||||
|
posDict.isSpecial = requestBody.isSpecial,
|
||||||
|
// this.posDictRepository.merge(posDict, requestBody);
|
||||||
await this.posDictRepository.save(posDict);
|
await this.posDictRepository.save(posDict);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ export class PosDict extends EntityBase {
|
||||||
comment: "ตำแหน่งทางการบริหาร",
|
comment: "ตำแหน่งทางการบริหาร",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
posExecutiveId: string;
|
posExecutiveId?: string|null;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
@ -94,10 +94,10 @@ export class CreatePosDict {
|
||||||
posExecutiveId?: string | null;
|
posExecutiveId?: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posDictExecutiveField: string | null;
|
posDictExecutiveField?: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posDictArea: string | null;
|
posDictArea?: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
isSpecial: boolean;
|
isSpecial: boolean;
|
||||||
|
|
@ -146,13 +146,13 @@ export class UpdatePosDict {
|
||||||
posLevelId: string;
|
posLevelId: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posExecutiveId?: string | undefined;
|
posExecutiveId?: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posDictExecutiveField: string;
|
posDictExecutiveField?: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posDictArea: string;
|
posDictArea?: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
isSpecial: boolean;
|
isSpecial: boolean;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue