fix
This commit is contained in:
parent
04344cd4c5
commit
567af430c1
2 changed files with 16 additions and 9 deletions
|
|
@ -1177,15 +1177,18 @@ export class DevelopmentController extends Controller {
|
||||||
// const before = structuredClone(development);
|
// const before = structuredClone(development);
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
requestBody.developmentAddresss.map(async (x) => {
|
requestBody.developmentAddresss.map(async (x) => {
|
||||||
if (x.provinceId == "")
|
let _null: any = null;
|
||||||
throw new HttpError(HttpStatusCode.BAD_REQUEST, "กรุณาเลือกจังหวัด");
|
|
||||||
const data = Object.assign(new DevelopmentAddress(), x);
|
const data = Object.assign(new DevelopmentAddress(), x);
|
||||||
const chkProvince = await this.provinceRepository.findOne({
|
if (x.provinceId != null) {
|
||||||
where: {
|
const chkProvince = await this.provinceRepository.findOne({
|
||||||
id: x.provinceId,
|
where: {
|
||||||
},
|
id: x.provinceId,
|
||||||
});
|
},
|
||||||
if (chkProvince == null) return;
|
});
|
||||||
|
if (chkProvince == null) {
|
||||||
|
data.provinceId = _null;
|
||||||
|
}
|
||||||
|
}
|
||||||
data.developmentId = development.id;
|
data.developmentId = development.id;
|
||||||
data.createdUserId = request.user.sub;
|
data.createdUserId = request.user.sub;
|
||||||
data.createdFullName = request.user.name;
|
data.createdFullName = request.user.name;
|
||||||
|
|
@ -1247,8 +1250,12 @@ export class DevelopmentController extends Controller {
|
||||||
if (!development) {
|
if (!development) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงการ/หลักสูตรการฝึกอบรมนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงการ/หลักสูตรการฝึกอบรมนี้");
|
||||||
}
|
}
|
||||||
|
console.log(">>>>>>>>>>", requestBody.results);
|
||||||
|
let results:any = requestBody.results && requestBody.results != ""?requestBody.results:null;
|
||||||
const before = structuredClone(development);
|
const before = structuredClone(development);
|
||||||
const data = Object.assign(new DevelopmentEvaluation(), requestBody);
|
const data = Object.assign(new DevelopmentEvaluation(), requestBody);
|
||||||
|
data.results = results;
|
||||||
|
data.createdUserId = request.user.sub;
|
||||||
data.createdUserId = request.user.sub;
|
data.createdUserId = request.user.sub;
|
||||||
data.createdFullName = request.user.name;
|
data.createdFullName = request.user.name;
|
||||||
data.lastUpdateUserId = request.user.sub;
|
data.lastUpdateUserId = request.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ export class CreateDevelopmentEvaluation {
|
||||||
@Column()
|
@Column()
|
||||||
measuRement: string | null;
|
measuRement: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
results: string | null;
|
results?: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
obstacles: string | null;
|
obstacles: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue