fix null details
This commit is contained in:
parent
cfe3033faa
commit
e2168292ea
2 changed files with 7 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ import { Salarys, CreateSalary, UpdateSalary } from "../entities/Salarys";
|
|||
import { PosType } from "../entities/PosType";
|
||||
import { PosLevel } from "../entities/PosLevel";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { In, IsNull, Not } from "typeorm";
|
||||
import { DeepPartial, In, IsNull, Not } from "typeorm";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
|
|
@ -178,11 +178,14 @@ export class Salary extends Controller {
|
|||
if (!chk_posLevelId) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ระดับของตำแหน่ง ไม่ถูกต้อง");
|
||||
}
|
||||
|
||||
const mergeData: DeepPartial<Salarys> = {
|
||||
...requestBody,
|
||||
details: requestBody.details === null ? undefined : requestBody.details,
|
||||
};
|
||||
chk_Salary.lastUpdateUserId = request.user.sub;
|
||||
chk_Salary.lastUpdateFullName = request.user.name;
|
||||
chk_Salary.lastUpdatedAt = new Date();
|
||||
this.salaryRepository.merge(chk_Salary, requestBody);
|
||||
this.salaryRepository.merge(chk_Salary, mergeData);
|
||||
await this.salaryRepository.save(chk_Salary);
|
||||
return new HttpSuccess(id);
|
||||
// } catch (error: any) {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ export class UpdateSalary {
|
|||
endDate?: Date;
|
||||
|
||||
@Column()
|
||||
details?: string;
|
||||
details?: string | null;
|
||||
|
||||
@Column()
|
||||
isSpecial: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue