fix bug
This commit is contained in:
parent
5f5942089a
commit
83f92fc38c
2 changed files with 159 additions and 135 deletions
|
|
@ -588,7 +588,7 @@ export class DevelopmentController extends Controller {
|
||||||
});
|
});
|
||||||
development.lastUpdateUserId = request.user.sub;
|
development.lastUpdateUserId = request.user.sub;
|
||||||
development.lastUpdateFullName = request.user.name;
|
development.lastUpdateFullName = request.user.name;
|
||||||
await this.developmentRepository.save(development);
|
|
||||||
await this.developmentProjectTypeRepository.remove(development.developmentProjectTypes);
|
await this.developmentProjectTypeRepository.remove(development.developmentProjectTypes);
|
||||||
await this.developmentProjectTechniquePlannedRepository.remove(
|
await this.developmentProjectTechniquePlannedRepository.remove(
|
||||||
development.developmentProjectTechniquePlanneds,
|
development.developmentProjectTechniquePlanneds,
|
||||||
|
|
@ -645,88 +645,98 @@ export class DevelopmentController extends Controller {
|
||||||
) {
|
) {
|
||||||
switch (requestBody.strategyChildPlannedNode) {
|
switch (requestBody.strategyChildPlannedNode) {
|
||||||
case 1: {
|
case 1: {
|
||||||
const checkId = await this.strategyChild1Repository.findOne({
|
if (requestBody.strategyChildPlannedId) {
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
const checkId = await this.strategyChild1Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 1",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 1",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.id;
|
||||||
|
development.strategyChild2PlannedId = _null;
|
||||||
|
development.strategyChild3PlannedId = _null;
|
||||||
|
development.strategyChild4PlannedId = _null;
|
||||||
|
development.strategyChild5PlannedId = _null;
|
||||||
}
|
}
|
||||||
development.strategyChild1PlannedId = checkId.id;
|
|
||||||
development.strategyChild2ActualId = _null;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
const checkId = await this.strategyChild2Repository.findOne({
|
if (requestBody.strategyChildPlannedId) {
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
const checkId = await this.strategyChild2Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2PlannedId = checkId.id;
|
||||||
|
development.strategyChild3PlannedId = _null;
|
||||||
|
development.strategyChild4PlannedId = _null;
|
||||||
|
development.strategyChild5PlannedId = _null;
|
||||||
}
|
}
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.id;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
const checkId = await this.strategyChild3Repository.findOne({
|
if (requestBody.strategyChildPlannedId) {
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
const checkId = await this.strategyChild3Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3PlannedId = checkId.id;
|
||||||
|
development.strategyChild4PlannedId = _null;
|
||||||
|
development.strategyChild5PlannedId = _null;
|
||||||
}
|
}
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3PlannedId = checkId.id;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
const checkId = await this.strategyChild4Repository.findOne({
|
if (requestBody.strategyChildPlannedId) {
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
const checkId = await this.strategyChild4Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 3",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 3",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
||||||
|
development.strategyChild4PlannedId = checkId.id;
|
||||||
|
development.strategyChild5PlannedId = _null;
|
||||||
}
|
}
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4PlannedId = checkId.id;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5: {
|
case 5: {
|
||||||
const checkId = await this.strategyChild5Repository.findOne({
|
if (requestBody.strategyChildPlannedId) {
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
const checkId = await this.strategyChild5Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
||||||
|
development.strategyChild4PlannedId = checkId.strategyChild4Id;
|
||||||
|
development.strategyChild5PlannedId = checkId.id;
|
||||||
}
|
}
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4PlannedId = checkId.strategyChild4Id;
|
|
||||||
development.strategyChild5PlannedId = checkId.id;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -740,88 +750,98 @@ export class DevelopmentController extends Controller {
|
||||||
) {
|
) {
|
||||||
switch (requestBody.strategyChildActualNode) {
|
switch (requestBody.strategyChildActualNode) {
|
||||||
case 1: {
|
case 1: {
|
||||||
const checkId = await this.strategyChild1Repository.findOne({
|
if (requestBody.strategyChildActualId) {
|
||||||
where: { id: requestBody.strategyChildActualId },
|
const checkId = await this.strategyChild1Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildActualId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 1",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 1",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.id;
|
||||||
|
development.strategyChild2ActualId = _null;
|
||||||
|
development.strategyChild3ActualId = _null;
|
||||||
|
development.strategyChild4ActualId = _null;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
}
|
}
|
||||||
development.strategyChild1ActualId = checkId.id;
|
|
||||||
development.strategyChild2ActualId = _null;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
const checkId = await this.strategyChild2Repository.findOne({
|
if (requestBody.strategyChildActualId) {
|
||||||
where: { id: requestBody.strategyChildActualId },
|
const checkId = await this.strategyChild2Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildActualId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 2",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 2",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2ActualId = checkId.id;
|
||||||
|
development.strategyChild3ActualId = _null;
|
||||||
|
development.strategyChild4ActualId = _null;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
}
|
}
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.id;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
const checkId = await this.strategyChild3Repository.findOne({
|
if (requestBody.strategyChildActualId) {
|
||||||
where: { id: requestBody.strategyChildActualId },
|
const checkId = await this.strategyChild3Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildActualId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 3",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 3",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3ActualId = checkId.id;
|
||||||
|
development.strategyChild4ActualId = _null;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
}
|
}
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3ActualId = checkId.id;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
const checkId = await this.strategyChild4Repository.findOne({
|
if (requestBody.strategyChildActualId) {
|
||||||
where: { id: requestBody.strategyChildActualId },
|
const checkId = await this.strategyChild4Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildActualId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 4",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 4",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
||||||
|
development.strategyChild4ActualId = checkId.id;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
}
|
}
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4ActualId = checkId.id;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5: {
|
case 5: {
|
||||||
const checkId = await this.strategyChild5Repository.findOne({
|
if (requestBody.strategyChildActualId) {
|
||||||
where: { id: requestBody.strategyChildActualId },
|
const checkId = await this.strategyChild5Repository.findOne({
|
||||||
});
|
where: { id: requestBody.strategyChildActualId },
|
||||||
if (!checkId) {
|
});
|
||||||
throw new HttpError(
|
if (!checkId) {
|
||||||
HttpStatusCode.NOT_FOUND,
|
throw new HttpError(
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 5",
|
HttpStatusCode.NOT_FOUND,
|
||||||
);
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 5",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
||||||
|
development.strategyChild4ActualId = checkId.strategyChild4Id;
|
||||||
|
development.strategyChild5ActualId = checkId.id;
|
||||||
}
|
}
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4ActualId = checkId.strategyChild4Id;
|
|
||||||
development.strategyChild5ActualId = checkId.id;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -829,6 +849,7 @@ export class DevelopmentController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริง");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริง");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await this.developmentRepository.save(development);
|
||||||
return new HttpSuccess(development.id);
|
return new HttpSuccess(development.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1253,6 +1274,7 @@ export class DevelopmentController extends Controller {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
|
id: x.id,
|
||||||
groupTarget: x.groupTarget,
|
groupTarget: x.groupTarget,
|
||||||
groupTargetSub: x.groupTargetSub,
|
groupTargetSub: x.groupTargetSub,
|
||||||
position: x.position,
|
position: x.position,
|
||||||
|
|
@ -1273,10 +1295,12 @@ export class DevelopmentController extends Controller {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
|
id: x.id,
|
||||||
groupTarget: x.groupTarget,
|
groupTarget: x.groupTarget,
|
||||||
groupTargetSub: x.groupTargetSub,
|
groupTargetSub: x.groupTargetSub,
|
||||||
type: x.type,
|
type: x.type,
|
||||||
position: x.plannedGoalPositions.map((y) => ({
|
position: x.plannedGoalPositions.map((y) => ({
|
||||||
|
id: y.id,
|
||||||
position: y.position,
|
position: y.position,
|
||||||
posTypeId: y.posTypePlannedId,
|
posTypeId: y.posTypePlannedId,
|
||||||
posType: y.posTypePlanned == null ? null : y.posTypePlanned.posTypeName,
|
posType: y.posTypePlanned == null ? null : y.posTypePlanned.posTypeName,
|
||||||
|
|
|
||||||
|
|
@ -610,13 +610,13 @@ export class UpdateDevelopment3 {
|
||||||
@Column()
|
@Column()
|
||||||
developmentProjectTechniqueActuals?: string[];
|
developmentProjectTechniqueActuals?: string[];
|
||||||
@Column()
|
@Column()
|
||||||
strategyChildPlannedId?: string;
|
strategyChildPlannedId?: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
strategyChildPlannedNode?: number;
|
strategyChildPlannedNode?: number | null;
|
||||||
@Column()
|
@Column()
|
||||||
strategyChildActualId?: string;
|
strategyChildActualId?: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
strategyChildActualNode?: number;
|
strategyChildActualNode?: number | null;
|
||||||
}
|
}
|
||||||
export class UpdateDevelopment4 {
|
export class UpdateDevelopment4 {
|
||||||
// @Column()
|
// @Column()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue