เช็คค่าซ้ำ
This commit is contained in:
parent
8756279309
commit
d76af2c88c
1 changed files with 16 additions and 17 deletions
|
|
@ -113,21 +113,18 @@ export class PositionController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
const rowRepeated = await this.posDictRepository.findOne({
|
const rowRepeated = await this.posDictRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
posDictName: Like(`%${posDict.posDictName.trim()}%`),
|
posDictName: posDict.posDictName,
|
||||||
posDictField: Like(`%${posDict.posDictField.trim()}%`),
|
posDictField: posDict.posDictField,
|
||||||
posTypeId: posDict.posTypeId,
|
posTypeId: posDict.posTypeId,
|
||||||
posLevelId: posDict.posLevelId,
|
posLevelId: posDict.posLevelId,
|
||||||
posExecutiveId: String(posDict.posExecutiveId),
|
posExecutiveId: String(posDict.posExecutiveId),
|
||||||
posDictExecutiveField: Like(`%${posDict.posDictExecutiveField.trim()}%`),
|
posDictExecutiveField: posDict.posDictExecutiveField,
|
||||||
posDictArea: Like(`%${posDict.posDictArea.trim()}%`)
|
posDictArea: posDict.posDictArea,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (rowRepeated) {
|
if (rowRepeated) {
|
||||||
throw new HttpError(
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ข้อมูล Row นี้มีอยู่ในระบบแล้ว");
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ข้อมูล Row นี้มีอยู่ในระบบแล้ว",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -853,14 +850,14 @@ export class PositionController extends Controller {
|
||||||
relations: ["posLevel", "posType", "posExecutive"],
|
relations: ["posLevel", "posType", "posExecutive"],
|
||||||
});
|
});
|
||||||
const profile = await this.profileRepository.findOne({
|
const profile = await this.profileRepository.findOne({
|
||||||
where: { id: String(posMaster.next_holderId) }
|
where: { id: String(posMaster.next_holderId) },
|
||||||
})
|
});
|
||||||
const type = await this.posTypeRepository.findOne({
|
const type = await this.posTypeRepository.findOne({
|
||||||
where: { id: String(profile?.posTypeId) }
|
where: { id: String(profile?.posTypeId) },
|
||||||
})
|
});
|
||||||
const level = await this.posLevelRepository.findOne({
|
const level = await this.posLevelRepository.findOne({
|
||||||
where: { id: String(profile?.posLevelId)}
|
where: { id: String(profile?.posLevelId) },
|
||||||
})
|
});
|
||||||
|
|
||||||
let shortName = "";
|
let shortName = "";
|
||||||
|
|
||||||
|
|
@ -928,9 +925,11 @@ export class PositionController extends Controller {
|
||||||
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
|
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
|
||||||
orgShortname: shortName,
|
orgShortname: shortName,
|
||||||
isSit: posMaster.isSit,
|
isSit: posMaster.isSit,
|
||||||
positionNextHolder: profile == null || profile.position == null? null : profile.position,
|
positionNextHolder:
|
||||||
|
profile == null || profile.position == null ? null : profile.position,
|
||||||
postypeNextHolder: type == null || type.posTypeName == null ? null : type.posTypeName,
|
postypeNextHolder: type == null || type.posTypeName == null ? null : type.posTypeName,
|
||||||
poslevelNextHolder: level == null || level.posLevelName == null ? null : level.posLevelName,
|
poslevelNextHolder:
|
||||||
|
level == null || level.posLevelName == null ? null : level.posLevelName,
|
||||||
positions: positions.map((position) => ({
|
positions: positions.map((position) => ({
|
||||||
id: position.id,
|
id: position.id,
|
||||||
positionName: position.positionName,
|
positionName: position.positionName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue