เพิ่ม/แก้ไขตำแหน่ง ปรับให้ส่ง 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,
|
||||
posTypeId: requestBody.posTypeId,
|
||||
posLevelId: requestBody.posLevelId,
|
||||
posExecutiveId: String(requestBody.posExecutiveId),
|
||||
posDictExecutiveField: requestBody.posDictExecutiveField,
|
||||
posDictArea: requestBody.posDictArea,
|
||||
posExecutiveId: requestBody.posExecutiveId?requestBody.posExecutiveId:"",
|
||||
posDictExecutiveField: requestBody.posDictExecutiveField?requestBody.posDictExecutiveField:"",
|
||||
posDictArea: requestBody.posDictArea?requestBody.posDictArea:"",
|
||||
isSpecial: requestBody.isSpecial,
|
||||
},
|
||||
});
|
||||
if (rowRepeated) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ข้อมูล Row นี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
Object.assign(posDict, requestBody);
|
||||
posDict.lastUpdateUserId = request.user.sub;
|
||||
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);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export class PosDict extends EntityBase {
|
|||
comment: "ตำแหน่งทางการบริหาร",
|
||||
default: null,
|
||||
})
|
||||
posExecutiveId: string;
|
||||
posExecutiveId?: string|null;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -94,10 +94,10 @@ export class CreatePosDict {
|
|||
posExecutiveId?: string | null;
|
||||
|
||||
@Column()
|
||||
posDictExecutiveField: string | null;
|
||||
posDictExecutiveField?: string | null;
|
||||
|
||||
@Column()
|
||||
posDictArea: string | null;
|
||||
posDictArea?: string | null;
|
||||
|
||||
@Column()
|
||||
isSpecial: boolean;
|
||||
|
|
@ -146,13 +146,13 @@ export class UpdatePosDict {
|
|||
posLevelId: string;
|
||||
|
||||
@Column()
|
||||
posExecutiveId?: string | undefined;
|
||||
posExecutiveId?: string | null;
|
||||
|
||||
@Column()
|
||||
posDictExecutiveField: string;
|
||||
posDictExecutiveField?: string | null;
|
||||
|
||||
@Column()
|
||||
posDictArea: string;
|
||||
posDictArea?: string | null;
|
||||
|
||||
@Column()
|
||||
isSpecial: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue