แก้apiข้อมูลหลัก
This commit is contained in:
parent
73e07dfed6
commit
6b78a365fa
26 changed files with 1816 additions and 988 deletions
153
src/controllers/DistrictController.ts
Normal file
153
src/controllers/DistrictController.ts
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
import {
|
||||
Controller,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { District, CreateDistrict, UpdateDistrict } from "../entities/District";
|
||||
import { Not } from "typeorm";
|
||||
|
||||
@Route("api/v1/org/metadata/district")
|
||||
@Tags("District")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class DistrictController extends Controller {
|
||||
private districtRepository = AppDataSource.getRepository(District);
|
||||
|
||||
/**
|
||||
* API list รายการเขต
|
||||
*
|
||||
* @summary ORG_058 - CRUD เขต (ADMIN) #62
|
||||
*
|
||||
*/
|
||||
@Get()
|
||||
async GetResult() {
|
||||
const _district = await this.districtRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(_district);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดรายการเขต
|
||||
*
|
||||
* @summary ORG_058 - CRUD เขต (ADMIN) #62
|
||||
*
|
||||
* @param {string} id Id เขต
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetById(@Path() id: string) {
|
||||
const _district = await this.districtRepository.findOne({
|
||||
where: { id },
|
||||
select: ["id", "name"],
|
||||
relations: { subDistricts: true },
|
||||
});
|
||||
if (!_district) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเขตนี้");
|
||||
}
|
||||
|
||||
return new HttpSuccess(_district);
|
||||
}
|
||||
|
||||
/**
|
||||
* API สร้างรายการ body เขต
|
||||
*
|
||||
* @summary ORG_058 - CRUD เขต (ADMIN) #62
|
||||
*
|
||||
*/
|
||||
@Post()
|
||||
async Post(
|
||||
@Body()
|
||||
requestBody: CreateDistrict,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const _district = Object.assign(new District(), requestBody);
|
||||
if (!_district) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเขตนี้");
|
||||
}
|
||||
|
||||
const checkName = await this.districtRepository.findOne({
|
||||
where: { name: requestBody.name },
|
||||
});
|
||||
|
||||
if (checkName) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
_district.createdUserId = request.user.sub;
|
||||
_district.createdFullName = request.user.name;
|
||||
_district.lastUpdateUserId = request.user.sub;
|
||||
_district.lastUpdateFullName = request.user.name;
|
||||
await this.districtRepository.save(_district);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขรายการ body เขต
|
||||
*
|
||||
* @summary ORG_058 - CRUD เขต (ADMIN) #62
|
||||
*
|
||||
* @param {string} id Id เขต
|
||||
*/
|
||||
@Put("{id}")
|
||||
async Put(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: UpdateDistrict,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const _district = await this.districtRepository.findOne({ where: { id: id } });
|
||||
if (!_district) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเขตนี้");
|
||||
}
|
||||
const checkName = await this.districtRepository.findOne({
|
||||
where: { id: Not(id), name: requestBody.name },
|
||||
});
|
||||
if (checkName) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
_district.lastUpdateUserId = request.user.sub;
|
||||
_district.lastUpdateFullName = request.user.name;
|
||||
this.districtRepository.merge(_district, requestBody);
|
||||
await this.districtRepository.save(_district);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API ลบรายการเขต
|
||||
*
|
||||
* @summary ORG_058 - CRUD เขต (ADMIN) #62
|
||||
*
|
||||
* @param {string} id Id เขต
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async Delete(@Path() id: string) {
|
||||
const _delDistrict = await this.districtRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!_delDistrict) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเขตนี้");
|
||||
}
|
||||
await this.districtRepository.delete(_delDistrict.id);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ import { Gender } from "../entities/Gender";
|
|||
import { Prefixe } from "../entities/Prefixe";
|
||||
import { Relationship } from "../entities/Relationship";
|
||||
import { Religion } from "../entities/Religion";
|
||||
import { Rank } from "../entities/Rank";
|
||||
|
||||
@Route("api/v1/org/metadata")
|
||||
@Tags("Profile")
|
||||
|
|
@ -49,6 +50,7 @@ export class MainController extends Controller {
|
|||
private prefixeRepo = AppDataSource.getRepository(Prefixe);
|
||||
private relationshipRepo = AppDataSource.getRepository(Relationship);
|
||||
private religionRepo = AppDataSource.getRepository(Religion);
|
||||
private rankRepo = AppDataSource.getRepository(Rank);
|
||||
/**
|
||||
* API ข้อมูลหลัก
|
||||
*
|
||||
|
|
@ -62,7 +64,8 @@ export class MainController extends Controller {
|
|||
const prefixs = await this.prefixeRepo.find();
|
||||
const relationships = await this.relationshipRepo.find();
|
||||
const religions = await this.religionRepo.find();
|
||||
const rank = await this.rankRepo.find();
|
||||
|
||||
return new HttpSuccess({ bloodGroups, genders, prefixs, relationships, religions });
|
||||
return new HttpSuccess({ bloodGroups, genders, prefixs, relationships, religions, rank });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
128
src/controllers/ProfileAddressController.ts
Normal file
128
src/controllers/ProfileAddressController.ts
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
import {
|
||||
Controller,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
Query,
|
||||
Patch,
|
||||
Example,
|
||||
} from "tsoa";
|
||||
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { Profile, ProfileAddressHistory, UpdateProfileAddress } from "../entities/Profile";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { Province } from "../entities/Province";
|
||||
import { District } from "../entities/District";
|
||||
import { SubDistrict } from "../entities/SubDistrict";
|
||||
|
||||
@Route("api/v1/org/profile/address")
|
||||
@Tags("ProfileAddress")
|
||||
@Security("bearerAuth")
|
||||
export class ProfileAddressController extends Controller {
|
||||
private profileRepo = AppDataSource.getRepository(Profile);
|
||||
private profileAddressHistoryRepo = AppDataSource.getRepository(ProfileAddressHistory);
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary ข้อมูลที่อยู่
|
||||
*
|
||||
*/
|
||||
@Get("{profileId}")
|
||||
public async detailProfileAddress(@Path() profileId: string) {
|
||||
const getProfileAddress = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
select: [
|
||||
"id",
|
||||
"registrationAddress",
|
||||
"registrationProvinceId",
|
||||
"registrationDistrictId",
|
||||
"registrationSubDistrictId",
|
||||
"registrationZipCode",
|
||||
"currentAddress",
|
||||
"currentProvinceId",
|
||||
"currentDistrictId",
|
||||
"currentSubDistrictId",
|
||||
"currentZipCode",
|
||||
],
|
||||
});
|
||||
if (!getProfileAddress) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
return new HttpSuccess(getProfileAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary ประวัติแก้ไขที่อยู่
|
||||
*
|
||||
*/
|
||||
@Get("history/{addressId}")
|
||||
public async getProfileAddressHistory(@Path() addressId: string) {
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: {
|
||||
id: addressId,
|
||||
},
|
||||
select: [
|
||||
"registrationAddress",
|
||||
"registrationProvinceId",
|
||||
"registrationDistrictId",
|
||||
"registrationSubDistrictId",
|
||||
"registrationZipCode",
|
||||
"currentAddress",
|
||||
"currentProvinceId",
|
||||
"currentDistrictId",
|
||||
"currentSubDistrictId",
|
||||
"currentZipCode",
|
||||
"createdFullName",
|
||||
"createdAt",
|
||||
],
|
||||
});
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary แก้ไขที่อยู่
|
||||
*
|
||||
*/
|
||||
@Patch("{addressId}")
|
||||
public async editProfileAddress(
|
||||
@Body() requestBody: UpdateProfileAddress,
|
||||
@Request() req: RequestWithUser,
|
||||
@Path() addressId: string,
|
||||
) {
|
||||
const record = await this.profileRepo.findOneBy({ id: addressId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const history = new ProfileAddressHistory();
|
||||
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
Object.assign(record, requestBody);
|
||||
|
||||
history.profileId = addressId;
|
||||
history.lastUpdateFullName = req.user.name;
|
||||
record.lastUpdateFullName = req.user.name;
|
||||
|
||||
await Promise.all([
|
||||
this.profileRepo.save(record),
|
||||
this.profileAddressHistoryRepo.save(history),
|
||||
]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -51,6 +51,7 @@ export class ProfileChangeNameController extends Controller {
|
|||
const lists = await this.changeNameRepository.find({
|
||||
where: { profileId: profileId },
|
||||
select: ["id", "prefix", "firstName", "lastName", "status"],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(lists);
|
||||
}
|
||||
|
|
@ -117,7 +118,7 @@ export class ProfileChangeNameController extends Controller {
|
|||
|
||||
await this.changeNameRepository.save(data);
|
||||
|
||||
return new HttpSuccess();
|
||||
return new HttpSuccess(data.id);
|
||||
}
|
||||
|
||||
@Patch("{changeNameId}")
|
||||
|
|
|
|||
|
|
@ -179,9 +179,6 @@ export class ProfileController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
gender: true,
|
||||
relationship: true,
|
||||
bloodGroup: true,
|
||||
},
|
||||
where: { id },
|
||||
});
|
||||
|
|
@ -197,9 +194,6 @@ export class ProfileController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
gender: true,
|
||||
relationship: true,
|
||||
bloodGroup: true,
|
||||
},
|
||||
where: { profileId: id },
|
||||
});
|
||||
|
|
@ -229,6 +223,7 @@ export class ProfileController extends Controller {
|
|||
lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
|
||||
createdFullName: "string",
|
||||
lastUpdateFullName: "string",
|
||||
rank: null,
|
||||
prefix: null,
|
||||
firstName: "Methapon",
|
||||
lastName: "Metanipat",
|
||||
|
|
@ -244,21 +239,8 @@ export class ProfileController extends Controller {
|
|||
birthDate: null,
|
||||
ethnicity: null,
|
||||
telephoneNumber: null,
|
||||
genderId: "22041841-3149-4b40-ab0e-0d4e98ffd2e1",
|
||||
gender: {
|
||||
id: "22041841-3149-4b40-ab0e-0d4e98ffd2e1",
|
||||
createdAt: "2024-03-24T12:35:45.693Z",
|
||||
createdUserId: "00000000-0000-0000-0000-000000000000",
|
||||
lastUpdatedAt: "2024-03-24T12:35:45.693Z",
|
||||
lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
|
||||
createdFullName: "string",
|
||||
lastUpdateFullName: "string",
|
||||
name: "Male",
|
||||
},
|
||||
relationshipId: null,
|
||||
gender: null,
|
||||
relationship: null,
|
||||
religionId: null,
|
||||
bloodGroupId: null,
|
||||
bloodGroup: null,
|
||||
posLevel: null,
|
||||
posType: null,
|
||||
|
|
@ -289,9 +271,6 @@ export class ProfileController extends Controller {
|
|||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.gender", "gender")
|
||||
.leftJoinAndSelect("profile.relationship", "relationship")
|
||||
.leftJoinAndSelect("profile.bloodGroup", "bloodGroup")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||
|
|
@ -300,6 +279,7 @@ export class ProfileController extends Controller {
|
|||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||
.select([
|
||||
"profile.id",
|
||||
"profile.rank",
|
||||
"profile.prefix",
|
||||
"profile.firstName",
|
||||
"profile.lastName",
|
||||
|
|
@ -455,9 +435,14 @@ export class ProfileController extends Controller {
|
|||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.where("profile.id NOT IN (:...ids)", {
|
||||
ids: orgRevision.posMasters
|
||||
.filter((x) => x.next_holderId != null)
|
||||
.map((x) => x.next_holderId),
|
||||
ids:
|
||||
orgRevision.posMasters
|
||||
.filter((x) => x.next_holderId != null)
|
||||
.map((x) => x.next_holderId).length == 0
|
||||
? ["zxc"]
|
||||
: orgRevision.posMasters
|
||||
.filter((x) => x.next_holderId != null)
|
||||
.map((x) => x.next_holderId),
|
||||
});
|
||||
}),
|
||||
)
|
||||
|
|
@ -468,6 +453,7 @@ export class ProfileController extends Controller {
|
|||
const data = profiles.map((_data) => ({
|
||||
id: _data.id,
|
||||
prefix: _data.prefix,
|
||||
rank: _data.rank,
|
||||
firstName: _data.firstName,
|
||||
lastName: _data.lastName,
|
||||
citizenId: _data.citizenId,
|
||||
|
|
@ -507,6 +493,7 @@ export class ProfileController extends Controller {
|
|||
const _profile = {
|
||||
profileId: profile.id,
|
||||
prefix: profile.prefix,
|
||||
rank: profile.rank,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
citizenId: profile.citizenId,
|
||||
|
|
@ -640,6 +627,7 @@ export class ProfileController extends Controller {
|
|||
return {
|
||||
id: item.id,
|
||||
prefix: item.prefix,
|
||||
rank: item.rank,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
position: item.position,
|
||||
|
|
@ -906,6 +894,7 @@ export class ProfileController extends Controller {
|
|||
return {
|
||||
id: item.id,
|
||||
prefix: item.prefix,
|
||||
rank: item.rank,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
position: item.position,
|
||||
|
|
@ -1137,6 +1126,7 @@ export class ProfileController extends Controller {
|
|||
|
||||
return {
|
||||
prefix: item.current_holder.prefix,
|
||||
rank: item.current_holder.rank,
|
||||
firstName: item.current_holder.firstName,
|
||||
lastName: item.current_holder.lastName,
|
||||
citizenId: item.current_holder.citizenId,
|
||||
|
|
@ -1212,6 +1202,7 @@ export class ProfileController extends Controller {
|
|||
const _profile = {
|
||||
profileId: profile.id,
|
||||
prefix: profile.prefix,
|
||||
rank: profile.rank,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
citizenId: profile.citizenId,
|
||||
|
|
|
|||
|
|
@ -170,9 +170,9 @@ export class ProfileEmployeeController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
gender: true,
|
||||
relationship: true,
|
||||
bloodGroup: true,
|
||||
// gender: true,
|
||||
// relationship: true,
|
||||
// bloodGroup: true,
|
||||
},
|
||||
where: { id },
|
||||
});
|
||||
|
|
@ -199,9 +199,9 @@ export class ProfileEmployeeController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
gender: true,
|
||||
relationship: true,
|
||||
bloodGroup: true,
|
||||
// gender: true,
|
||||
// relationship: true,
|
||||
// bloodGroup: true,
|
||||
},
|
||||
where:
|
||||
searchField && searchKeyword ? [{ [searchField]: Like(`%${searchKeyword}%`) }] : undefined,
|
||||
|
|
@ -218,9 +218,9 @@ export class ProfileEmployeeController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
gender: true,
|
||||
relationship: true,
|
||||
bloodGroup: true,
|
||||
// gender: true,
|
||||
// relationship: true,
|
||||
// bloodGroup: true,
|
||||
},
|
||||
where: { profileEmployeeId: id },
|
||||
});
|
||||
|
|
@ -250,10 +250,10 @@ export class ProfileEmployeeController extends Controller {
|
|||
) {
|
||||
const orgRevision = await this.orgRevisionRepo.findOne({
|
||||
where: {
|
||||
orgRevisionIsDraft: true,
|
||||
orgRevisionIsCurrent: false,
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
relations: ["posMasters"],
|
||||
relations: ["employeePosMasters"],
|
||||
});
|
||||
if (!orgRevision) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
||||
|
|
@ -326,19 +326,24 @@ export class ProfileEmployeeController extends Controller {
|
|||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.where("profileEmployee.id NOT IN (:...ids)", {
|
||||
ids: orgRevision.posMasters
|
||||
.filter((x) => x.next_holderId != null)
|
||||
.map((x) => x.next_holderId),
|
||||
ids:
|
||||
orgRevision.employeePosMasters
|
||||
.filter((x) => x.next_holderId != null)
|
||||
.map((x) => x.next_holderId).length == 0
|
||||
? ["zxc"]
|
||||
: orgRevision.employeePosMasters
|
||||
.filter((x) => x.next_holderId != null)
|
||||
.map((x) => x.next_holderId),
|
||||
});
|
||||
}),
|
||||
)
|
||||
.skip((requestBody.page - 1) * requestBody.pageSize)
|
||||
.take(requestBody.pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
const data = profiles.map((_data) => ({
|
||||
id: _data.id,
|
||||
prefix: _data.prefix,
|
||||
rank: _data.rank,
|
||||
firstName: _data.firstName,
|
||||
lastName: _data.lastName,
|
||||
citizenId: _data.citizenId,
|
||||
|
|
@ -377,6 +382,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
const _profile = {
|
||||
profileId: profile.id,
|
||||
rank: profile.rank,
|
||||
prefix: profile.prefix,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
|
|
@ -510,6 +516,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
findProfile.map(async (item: ProfileEmployee) => {
|
||||
return {
|
||||
id: item.id,
|
||||
rank: item.rank,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
|
|
@ -776,6 +783,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
findProfile.map(async (item: ProfileEmployee) => {
|
||||
return {
|
||||
id: item.id,
|
||||
rank: item.rank,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
|
|
@ -998,6 +1006,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
return {
|
||||
salaryLevel: item.current_holder.salaryLevel,
|
||||
group: item.current_holder.group,
|
||||
rank: item.current_holder.rank,
|
||||
prefix: item.current_holder.prefix,
|
||||
firstName: item.current_holder.firstName,
|
||||
lastName: item.current_holder.lastName,
|
||||
|
|
@ -1073,6 +1082,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
const _profile = {
|
||||
profileId: profile.id,
|
||||
rank: profile.rank,
|
||||
prefix: profile.prefix,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import HttpError from "../interfaces/http-error";
|
|||
import { ProfileInsigniaHistory } from "../entities/ProfileInsigniaHistory";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { Insignia } from "../entities/Insignia";
|
||||
|
||||
@Route("api/v1/org/profile/insignia")
|
||||
@Tags("ProfileInsignia")
|
||||
|
|
@ -32,6 +33,7 @@ export class ProfileInsigniaController extends Controller {
|
|||
private profileRepo = AppDataSource.getRepository(Profile);
|
||||
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||
private insigniaHistoryRepo = AppDataSource.getRepository(ProfileInsigniaHistory);
|
||||
private insigniaMetaRepo = AppDataSource.getRepository(Insignia);
|
||||
|
||||
@Get("{profileId}")
|
||||
@Example({
|
||||
|
|
@ -157,6 +159,13 @@ export class ProfileInsigniaController extends Controller {
|
|||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
|
||||
const insignia = await this.insigniaMetaRepo.findOne({
|
||||
where: { id: body.insigniaId },
|
||||
});
|
||||
if (!insignia) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลเครื่องราชฯ นี้");
|
||||
}
|
||||
|
||||
const data = new ProfileInsignia();
|
||||
|
||||
const meta = {
|
||||
|
|
@ -183,6 +192,13 @@ export class ProfileInsigniaController extends Controller {
|
|||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const insignia = await this.insigniaMetaRepo.findOne({
|
||||
where: { id: body.insigniaId },
|
||||
});
|
||||
if (!insignia) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลเครื่องราชฯ นี้");
|
||||
}
|
||||
|
||||
const history = new ProfileInsigniaHistory();
|
||||
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import HttpError from "../interfaces/http-error";
|
|||
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { LeaveType } from "../entities/LeaveType";
|
||||
|
||||
@Route("api/v1/org/profile/leave")
|
||||
@Tags("ProfileLeave")
|
||||
|
|
@ -33,6 +34,7 @@ export class ProfileLeaveController extends Controller {
|
|||
private profileRepo = AppDataSource.getRepository(Profile);
|
||||
private leaveRepo = AppDataSource.getRepository(ProfileLeave);
|
||||
private leaveHistoryRepo = AppDataSource.getRepository(ProfileLeaveHistory);
|
||||
private leaveTypeRepository = AppDataSource.getRepository(LeaveType);
|
||||
|
||||
@Get("{profileId}")
|
||||
@Example({
|
||||
|
|
@ -48,7 +50,8 @@ export class ProfileLeaveController extends Controller {
|
|||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
leaveTypeId: "8dc5e672-b416-4323-b086-06dde8c4353c",
|
||||
dateLeave: "2024-03-21T06:39:46.000Z",
|
||||
dateLeaveStart: "2024-03-21T06:39:46.000Z",
|
||||
dateLeaveEnd: "2024-03-21T06:39:46.000Z",
|
||||
leaveDays: 0,
|
||||
leaveCount: null,
|
||||
totalLeave: 0,
|
||||
|
|
@ -69,7 +72,7 @@ export class ProfileLeaveController extends Controller {
|
|||
},
|
||||
})
|
||||
public async getLeave(@Path() profileId: string) {
|
||||
const record = await this.leaveRepo.findOne({
|
||||
const record = await this.leaveRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileId },
|
||||
});
|
||||
|
|
@ -91,7 +94,8 @@ export class ProfileLeaveController extends Controller {
|
|||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
leaveTypeId: "8dc5e672-b416-4323-b086-06dde8c4353c",
|
||||
dateLeave: "2024-03-21T06:39:46.000Z",
|
||||
dateLeaveStart: "2024-03-21T06:39:46.000Z",
|
||||
dateLeaveEnd: "2024-03-21T06:39:46.000Z",
|
||||
leaveDays: 0,
|
||||
leaveCount: null,
|
||||
totalLeave: 0,
|
||||
|
|
@ -121,7 +125,8 @@ export class ProfileLeaveController extends Controller {
|
|||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
leaveTypeId: "7dc4e314-b456-4323-b086-06dde8c4353c",
|
||||
dateLeave: "2024-03-21T06:34:49.000Z",
|
||||
dateLeaveStart: "2024-03-21T06:34:49.000Z",
|
||||
dateLeaveEnd: "2024-03-21T06:34:49.000Z",
|
||||
leaveDays: 2,
|
||||
leaveCount: null,
|
||||
totalLeave: 200,
|
||||
|
|
@ -162,6 +167,12 @@ export class ProfileLeaveController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
const leaveType = await this.leaveTypeRepository.findOne({
|
||||
where: { id: body.leaveTypeId },
|
||||
});
|
||||
if (!leaveType) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลประเภทลานี้");
|
||||
}
|
||||
|
||||
const data = new ProfileLeave();
|
||||
|
||||
|
|
@ -189,6 +200,13 @@ export class ProfileLeaveController extends Controller {
|
|||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const leaveType = await this.leaveTypeRepository.findOne({
|
||||
where: { id: body.leaveTypeId },
|
||||
});
|
||||
if (!leaveType) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลประเภทลานี้");
|
||||
}
|
||||
|
||||
const history = new ProfileLeaveHistory();
|
||||
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
|
|
|
|||
|
|
@ -1,150 +1,189 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { CreateProfileSalary, ProfileSalary, UpdateProfileSalary } from "../entities/ProfileSalary";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { ProfileSalary, CreateProfileSalary, UpdateProfileSalary } from "../entities/ProfileSalary";
|
||||
import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { Not } from "typeorm";
|
||||
|
||||
@Route("api/v1/org/profileSalary")
|
||||
@Route("api/v1/org/profile/salary")
|
||||
@Tags("ProfileSalary")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class ProfileSalaryController extends Controller {
|
||||
private profileSalaryRepository = AppDataSource.getRepository(ProfileSalary);
|
||||
private profileRepository = AppDataSource.getRepository(Profile);
|
||||
private profileRepo = AppDataSource.getRepository(Profile);
|
||||
private salaryRepo = AppDataSource.getRepository(ProfileSalary);
|
||||
private salaryHistoryRepo = AppDataSource.getRepository(ProfileSalaryHistory);
|
||||
|
||||
@Get("{profileId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
message: "สำเร็จ",
|
||||
result: [
|
||||
{
|
||||
id: "3cf02fb7-2f0c-471b-b641-51d557375c0a",
|
||||
createdAt: "2024-03-12T02:55:56.915Z",
|
||||
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
lastUpdatedAt: "2024-03-12T02:55:56.915Z",
|
||||
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
createdFullName: "สาวิตรี ศรีสมัย",
|
||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
isActive: true,
|
||||
startDate: "2024-03-12T09:55:23.000Z",
|
||||
endDate: "2024-03-12T09:55:23.000Z",
|
||||
numberOrder: "string",
|
||||
topic: "string",
|
||||
place: "string",
|
||||
dateOrder: "2024-03-12T09:55:23.000Z",
|
||||
department: "string",
|
||||
duration: "string",
|
||||
name: "string",
|
||||
yearly: 0,
|
||||
isDate: true,
|
||||
},
|
||||
],
|
||||
})
|
||||
public async getSalary(@Path() profileId: string) {
|
||||
const record = await this.salaryRepo.findBy({ profileId });
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Get("history/{salaryId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
message: "สำเร็จ",
|
||||
result: [
|
||||
{
|
||||
id: "6d4e9dbe-8697-4546-9651-0a1c3ea0a82d",
|
||||
createdAt: "2024-03-12T02:55:56.971Z",
|
||||
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
lastUpdatedAt: "2024-03-12T02:55:56.971Z",
|
||||
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
createdFullName: "สาวิตรี ศรีสมัย",
|
||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
isActive: true,
|
||||
startDate: "2024-03-12T09:55:23.000Z",
|
||||
endDate: "2024-03-12T09:55:23.000Z",
|
||||
numberOrder: "string",
|
||||
topic: "string",
|
||||
place: "string",
|
||||
dateOrder: "2024-03-12T09:55:23.000Z",
|
||||
department: "string",
|
||||
duration: "string",
|
||||
name: "string",
|
||||
yearly: 0,
|
||||
isDate: true,
|
||||
profileSalaryId: "3cf02fb7-2f0c-471b-b641-51d557375c0a",
|
||||
},
|
||||
{
|
||||
id: "a251c176-3dac-4d09-9813-38c8db1127e3",
|
||||
createdAt: "2024-03-12T02:58:17.917Z",
|
||||
createdUserId: "00000000-0000-0000-0000-000000000000",
|
||||
lastUpdatedAt: "2024-03-12T02:58:17.917Z",
|
||||
lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
|
||||
createdFullName: "string",
|
||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
isActive: true,
|
||||
startDate: "2024-03-12T09:57:44.000Z",
|
||||
endDate: "2024-03-12T09:57:44.000Z",
|
||||
numberOrder: "string",
|
||||
topic: "topic",
|
||||
place: "place",
|
||||
dateOrder: "2024-03-12T09:57:44.000Z",
|
||||
department: "department",
|
||||
duration: "string",
|
||||
name: "name",
|
||||
yearly: 0,
|
||||
isDate: true,
|
||||
profileSalaryId: "3cf02fb7-2f0c-471b-b641-51d557375c0a",
|
||||
},
|
||||
],
|
||||
})
|
||||
public async salaryHistory(@Path() salaryId: string) {
|
||||
const record = await this.salaryHistoryRepo.findBy({
|
||||
profileSalaryId: salaryId,
|
||||
});
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* API Create profile salary
|
||||
*
|
||||
* @summary Create profile salary
|
||||
*
|
||||
*/
|
||||
@Post()
|
||||
async CreateProfileSalary(
|
||||
@Body()
|
||||
requestBody: CreateProfileSalary,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const profileSalary = Object.assign(new ProfileSalary(), requestBody);
|
||||
if (!profileSalary) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
public async newSalary(@Request() req: RequestWithUser, @Body() body: CreateProfileSalary) {
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
||||
const profile = await this.profileRepository.findOne({
|
||||
where: { id: profileSalary.profileId },
|
||||
});
|
||||
const profile = await this.profileRepo.findOneBy({ id: body.profileId });
|
||||
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
|
||||
profileSalary.createdUserId = request.user.sub;
|
||||
profileSalary.createdFullName = request.user.name;
|
||||
profileSalary.lastUpdateUserId = request.user.sub;
|
||||
profileSalary.lastUpdateFullName = request.user.name;
|
||||
await this.profileSalaryRepository.save(profileSalary);
|
||||
const data = new ProfileSalary();
|
||||
|
||||
const meta = {
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
};
|
||||
|
||||
Object.assign(data, { ...body, ...meta });
|
||||
|
||||
await this.salaryRepo.save(data);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API Update profile salary
|
||||
*
|
||||
* @summary Update profile salary
|
||||
*
|
||||
* @param {string} id Id ProfileSalaryId
|
||||
*/
|
||||
@Put("{id}")
|
||||
async UpdateProfileSalary(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: UpdateProfileSalary,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Patch("{salaryId}")
|
||||
public async editSalary(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body() body: UpdateProfileSalary,
|
||||
@Path() salaryId: string,
|
||||
) {
|
||||
const profileSalary = await this.profileSalaryRepository.findOne({ where: { id: id } });
|
||||
if (!profileSalary) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
}
|
||||
const record = await this.salaryRepo.findOneBy({ id: salaryId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const history = new ProfileSalaryHistory();
|
||||
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
Object.assign(record, body);
|
||||
history.profileSalaryId = salaryId;
|
||||
record.lastUpdateFullName = req.user.name;
|
||||
history.lastUpdateFullName = req.user.name;
|
||||
|
||||
await Promise.all([this.salaryRepo.save(record), this.salaryHistoryRepo.save(history)]);
|
||||
|
||||
profileSalary.lastUpdateUserId = request.user.sub;
|
||||
profileSalary.lastUpdateFullName = request.user.name;
|
||||
this.profileSalaryRepository.merge(profileSalary, requestBody);
|
||||
await this.profileSalaryRepository.save(profileSalary);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API Delete profile salary
|
||||
*
|
||||
* @summary Delete profile salary
|
||||
*
|
||||
* @param {string} id Id ProfileSalaryId
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async DeleteProfileSalary(@Path() id: string) {
|
||||
const delprofileSalary = await this.profileSalaryRepository.findOne({
|
||||
where: { id },
|
||||
@Delete("{salaryId}")
|
||||
public async deleteSalary(@Path() salaryId: string) {
|
||||
await this.salaryHistoryRepo.delete({
|
||||
profileSalaryId: salaryId,
|
||||
});
|
||||
if (!delprofileSalary) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
|
||||
const result = await this.salaryRepo.delete({ id: salaryId });
|
||||
|
||||
if (result.affected && result.affected <= 0) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
await this.profileSalaryRepository.delete({ id: id });
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API GetById ProfileSalary
|
||||
*
|
||||
* @summary GetById Profile
|
||||
*
|
||||
* @param {string} id Id ProfileId
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetById(@Path() id: string) {
|
||||
const profileSalary = await this.profileSalaryRepository.find({
|
||||
where: { profileId:id },
|
||||
select: ["id", "date", "amount", "positionSalaryAmount", "mouthSalaryAmount", "profileId"],
|
||||
});
|
||||
if (!profileSalary) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
return new HttpSuccess(profileSalary);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * API GetLists profile salary
|
||||
// *
|
||||
// * @summary GetLists profile salary
|
||||
// *
|
||||
// */
|
||||
// @Get()
|
||||
// async GetLists() {
|
||||
// const profileSalary = await this.profileSalaryRepository.find({
|
||||
// select: ["id", "date", "amount", "positionSalaryAmount", "mouthSalaryAmount", "profileId"],
|
||||
// order: { createdAt: "ASC" },
|
||||
// });
|
||||
|
||||
// if (!profileSalary) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
// return new HttpSuccess(profileSalary);
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
153
src/controllers/ProvinceController.ts
Normal file
153
src/controllers/ProvinceController.ts
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
import {
|
||||
Controller,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { Province, CreateProvince, UpdateProvince } from "../entities/Province";
|
||||
import { Not } from "typeorm";
|
||||
|
||||
@Route("api/v1/org/metadata/province")
|
||||
@Tags("Province")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class ProvinceController extends Controller {
|
||||
private provinceRepository = AppDataSource.getRepository(Province);
|
||||
|
||||
/**
|
||||
* API list รายการจังหวัด
|
||||
*
|
||||
* @summary CRUD จังหวัด (ADMIN)
|
||||
*
|
||||
*/
|
||||
@Get()
|
||||
async GetResult() {
|
||||
const _province = await this.provinceRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(_province);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดรายการจังหวัด
|
||||
*
|
||||
* @summary CRUD จังหวัด (ADMIN)
|
||||
*
|
||||
* @param {string} id Id จังหวัด
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetById(@Path() id: string) {
|
||||
const _province = await this.provinceRepository.findOne({
|
||||
where: { id },
|
||||
select: ["id", "name"],
|
||||
relations: { districts: true },
|
||||
});
|
||||
if (!_province) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางจังหวัดนี้");
|
||||
}
|
||||
|
||||
return new HttpSuccess(_province);
|
||||
}
|
||||
|
||||
/**
|
||||
* API สร้างรายการ body จังหวัด
|
||||
*
|
||||
* @summary CRUD จังหวัด (ADMIN)
|
||||
*
|
||||
*/
|
||||
@Post()
|
||||
async Post(
|
||||
@Body()
|
||||
requestBody: CreateProvince,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const _province = Object.assign(new Province(), requestBody);
|
||||
if (!_province) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางจังหวัดนี้");
|
||||
}
|
||||
|
||||
const checkName = await this.provinceRepository.findOne({
|
||||
where: { name: requestBody.name },
|
||||
});
|
||||
|
||||
if (checkName) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
_province.createdUserId = request.user.sub;
|
||||
_province.createdFullName = request.user.name;
|
||||
_province.lastUpdateUserId = request.user.sub;
|
||||
_province.lastUpdateFullName = request.user.name;
|
||||
await this.provinceRepository.save(_province);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขรายการ body จังหวัด
|
||||
*
|
||||
* @summary CRUD จังหวัด (ADMIN)
|
||||
*
|
||||
* @param {string} id Id จังหวัด
|
||||
*/
|
||||
@Put("{id}")
|
||||
async Put(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: UpdateProvince,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const _province = await this.provinceRepository.findOne({ where: { id: id } });
|
||||
if (!_province) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางจังหวัดนี้");
|
||||
}
|
||||
const checkName = await this.provinceRepository.findOne({
|
||||
where: { id: Not(id), name: requestBody.name },
|
||||
});
|
||||
if (checkName) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
_province.lastUpdateUserId = request.user.sub;
|
||||
_province.lastUpdateFullName = request.user.name;
|
||||
this.provinceRepository.merge(_province, requestBody);
|
||||
await this.provinceRepository.save(_province);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API ลบรายการจังหวัด
|
||||
*
|
||||
* @summary CRUD จังหวัด (ADMIN)
|
||||
*
|
||||
* @param {string} id Id จังหวัด
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async Delete(@Path() id: string) {
|
||||
const _delProvince = await this.provinceRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!_delProvince) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางจังหวัดนี้");
|
||||
}
|
||||
await this.provinceRepository.delete(_delProvince.id);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
152
src/controllers/SubDistrictController.ts
Normal file
152
src/controllers/SubDistrictController.ts
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
import {
|
||||
Controller,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { SubDistrict, CreateSubDistrict, UpdateSubDistrict } from "../entities/SubDistrict";
|
||||
import { Not } from "typeorm";
|
||||
|
||||
@Route("api/v1/org/metadata/subDistrict")
|
||||
@Tags("SubDistrict")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class SubDistrictController extends Controller {
|
||||
private subDistrictRepository = AppDataSource.getRepository(SubDistrict);
|
||||
|
||||
/**
|
||||
* API list รายการเพศ
|
||||
*
|
||||
* @summary ORG_058 - CRUD เพศ (ADMIN) #62
|
||||
*
|
||||
*/
|
||||
@Get()
|
||||
async GetResult() {
|
||||
const _subDistrict = await this.subDistrictRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(_subDistrict);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดรายการเพศ
|
||||
*
|
||||
* @summary ORG_058 - CRUD เพศ (ADMIN) #62
|
||||
*
|
||||
* @param {string} id Id เพศ
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetById(@Path() id: string) {
|
||||
const _subDistrict = await this.subDistrictRepository.findOne({
|
||||
where: { id },
|
||||
select: ["id", "name"],
|
||||
});
|
||||
if (!_subDistrict) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเพศนี้");
|
||||
}
|
||||
|
||||
return new HttpSuccess(_subDistrict);
|
||||
}
|
||||
|
||||
/**
|
||||
* API สร้างรายการ body เพศ
|
||||
*
|
||||
* @summary ORG_058 - CRUD เพศ (ADMIN) #62
|
||||
*
|
||||
*/
|
||||
@Post()
|
||||
async Post(
|
||||
@Body()
|
||||
requestBody: CreateSubDistrict,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const _subDistrict = Object.assign(new SubDistrict(), requestBody);
|
||||
if (!_subDistrict) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเพศนี้");
|
||||
}
|
||||
|
||||
const checkName = await this.subDistrictRepository.findOne({
|
||||
where: { name: requestBody.name },
|
||||
});
|
||||
|
||||
if (checkName) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
_subDistrict.createdUserId = request.user.sub;
|
||||
_subDistrict.createdFullName = request.user.name;
|
||||
_subDistrict.lastUpdateUserId = request.user.sub;
|
||||
_subDistrict.lastUpdateFullName = request.user.name;
|
||||
await this.subDistrictRepository.save(_subDistrict);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขรายการ body เพศ
|
||||
*
|
||||
* @summary ORG_058 - CRUD เพศ (ADMIN) #62
|
||||
*
|
||||
* @param {string} id Id เพศ
|
||||
*/
|
||||
@Put("{id}")
|
||||
async Put(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: UpdateSubDistrict,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const _subDistrict = await this.subDistrictRepository.findOne({ where: { id: id } });
|
||||
if (!_subDistrict) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเพศนี้");
|
||||
}
|
||||
const checkName = await this.subDistrictRepository.findOne({
|
||||
where: { id: Not(id), name: requestBody.name },
|
||||
});
|
||||
if (checkName) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
_subDistrict.lastUpdateUserId = request.user.sub;
|
||||
_subDistrict.lastUpdateFullName = request.user.name;
|
||||
this.subDistrictRepository.merge(_subDistrict, requestBody);
|
||||
await this.subDistrictRepository.save(_subDistrict);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API ลบรายการเพศ
|
||||
*
|
||||
* @summary ORG_058 - CRUD เพศ (ADMIN) #62
|
||||
*
|
||||
* @param {string} id Id เพศ
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async Delete(@Path() id: string) {
|
||||
const _delSubDistrict = await this.subDistrictRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!_delSubDistrict) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเพศนี้");
|
||||
}
|
||||
await this.subDistrictRepository.delete(_delSubDistrict.id);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
41
src/entities/District.ts
Normal file
41
src/entities/District.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { Entity, Column, JoinColumn, ManyToOne, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Province } from "./Province";
|
||||
import { SubDistrict } from "./SubDistrict";
|
||||
|
||||
@Entity("district")
|
||||
export class District extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เขต",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง province",
|
||||
})
|
||||
provinceId: string;
|
||||
|
||||
@ManyToOne(() => Province, (province) => province.districts)
|
||||
@JoinColumn({ name: "provinceId" })
|
||||
province: Province;
|
||||
|
||||
@OneToMany(() => SubDistrict, (subDistrict) => subDistrict.district)
|
||||
subDistricts: SubDistrict[];
|
||||
|
||||
@OneToMany(() => District, (district) => district.registrationDistricts)
|
||||
registrationDistricts: District[];
|
||||
|
||||
@OneToMany(() => District, (district) => district.currentDistricts)
|
||||
currentDistricts: District[];
|
||||
}
|
||||
|
||||
export class CreateDistrict {
|
||||
@Column()
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type UpdateDistrict = Partial<CreateDistrict>;
|
||||
|
|
@ -6,6 +6,7 @@ import { OrgChild1 } from "./OrgChild1";
|
|||
import { OrgChild2 } from "./OrgChild2";
|
||||
import { OrgChild3 } from "./OrgChild3";
|
||||
import { OrgChild4 } from "./OrgChild4";
|
||||
import { EmployeePosMaster } from "./EmployeePosMaster";
|
||||
|
||||
@Entity("orgRevision")
|
||||
export class OrgRevision extends EntityBase {
|
||||
|
|
@ -47,6 +48,9 @@ export class OrgRevision extends EntityBase {
|
|||
@OneToMany(() => PosMaster, (posMaster) => posMaster.orgRevision)
|
||||
posMasters: PosMaster[];
|
||||
|
||||
@OneToMany(() => EmployeePosMaster, (employeePosMaster) => employeePosMaster.orgRevision)
|
||||
employeePosMasters: EmployeePosMaster[];
|
||||
|
||||
@OneToMany(() => OrgRoot, (orgRoot) => orgRoot.orgRevision)
|
||||
orgRoots: OrgRoot[];
|
||||
|
||||
|
|
|
|||
|
|
@ -18,14 +18,20 @@ import { ProfileNopaid } from "./ProfileNopaid";
|
|||
import { ProfileOther } from "./ProfileOther";
|
||||
import { ProfileFamilyHistory } from "./ProfileFamily";
|
||||
import { ProfileGovernment } from "./ProfileGovernment";
|
||||
import { Gender } from "./Gender";
|
||||
import { Relationship } from "./Relationship";
|
||||
import { BloodGroup } from "./BloodGroup";
|
||||
import { Religion } from "./Religion";
|
||||
import { calculateRetireYear } from "../interfaces/utils";
|
||||
import { Province } from "./Province";
|
||||
import { SubDistrict } from "./SubDistrict";
|
||||
import { District } from "./District";
|
||||
|
||||
@Entity("profile")
|
||||
export class Profile extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ยศ",
|
||||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
rank: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "คำนำหน้าชื่อ",
|
||||
|
|
@ -179,10 +185,7 @@ export class Profile extends EntityBase {
|
|||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
genderId: string;
|
||||
|
||||
@ManyToOne(() => Gender, (v) => v.profile)
|
||||
gender: Gender;
|
||||
gender: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -190,10 +193,7 @@ export class Profile extends EntityBase {
|
|||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
relationshipId: string;
|
||||
|
||||
@ManyToOne(() => Relationship, (v) => v.profile)
|
||||
relationship: Relationship;
|
||||
relationship: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -201,10 +201,7 @@ export class Profile extends EntityBase {
|
|||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
religionId: string;
|
||||
|
||||
@ManyToOne(() => Religion, (v) => v.profile)
|
||||
religion: Religion;
|
||||
religion: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -212,10 +209,7 @@ export class Profile extends EntityBase {
|
|||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
bloodGroupId: string;
|
||||
|
||||
@ManyToOne(() => BloodGroup, (v) => v.profile)
|
||||
bloodGroup: BloodGroup;
|
||||
bloodGroup: string;
|
||||
|
||||
@OneToMany(() => PosMaster, (posMaster) => posMaster.current_holder)
|
||||
current_holders: PosMaster[];
|
||||
|
|
@ -282,6 +276,104 @@ export class Profile extends EntityBase {
|
|||
// calculateRetireYear(): number {
|
||||
// return calculateRetireYear(this.birthDate);
|
||||
// }
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ที่อยู่ตามทะเบียนบ้าน",
|
||||
default: null,
|
||||
length: 255,
|
||||
})
|
||||
registrationAddress: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "จังหวัดตามทะเบียนบ้าน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
registrationProvinceId: string;
|
||||
|
||||
@ManyToOne(() => Province, (v) => v.registrationProvinces)
|
||||
registrationProvince: Province;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เขตตามทะเบียนบ้าน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
registrationDistrictId: string;
|
||||
|
||||
@ManyToOne(() => District, (v) => v.registrationDistricts)
|
||||
registrationDistrict: District;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "แขวงตามทะเบียนบ้าน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
registrationSubDistrictId: string;
|
||||
|
||||
@ManyToOne(() => SubDistrict, (v) => v.registrationSubDistricts)
|
||||
registrationSubDistrict: SubDistrict;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "รหัสไปรษณีย์ตามทะเบียนบ้าน",
|
||||
default: null,
|
||||
length: 5,
|
||||
})
|
||||
registrationZipCode: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ที่อยู่ตามปัจจุบัน",
|
||||
default: null,
|
||||
length: 255,
|
||||
})
|
||||
currentAddress: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "จังหวัดตามปัจจุบัน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
currentProvinceId: string;
|
||||
|
||||
@ManyToOne(() => Province, (v) => v.currentProvinces)
|
||||
currentProvince: Province;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เขตตามปัจจุบัน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
currentDistrictId: string;
|
||||
|
||||
@ManyToOne(() => District, (v) => v.currentDistricts)
|
||||
currentDistrict: District;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "แขวงตามปัจจุบัน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
currentSubDistrictId: string;
|
||||
|
||||
@ManyToOne(() => SubDistrict, (v) => v.currentSubDistricts)
|
||||
currentSubDistrict: SubDistrict;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "รหัสไปรษณีย์ตามปัจจุบัน",
|
||||
default: null,
|
||||
length: 5,
|
||||
})
|
||||
currentZipCode: string;
|
||||
}
|
||||
|
||||
@Entity("profileHistory")
|
||||
|
|
@ -298,7 +390,120 @@ export class ProfileHistory extends Profile {
|
|||
profile: Profile;
|
||||
}
|
||||
|
||||
@Entity("profileAddressHistory")
|
||||
export class ProfileAddressHistory extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileInformation",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ที่อยู่ตามทะเบียนบ้าน",
|
||||
default: null,
|
||||
length: 255,
|
||||
})
|
||||
registrationAddress: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "จังหวัดตามทะเบียนบ้าน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
registrationProvinceId: string;
|
||||
|
||||
@ManyToOne(() => Province, (v) => v.registrationProvinces)
|
||||
registrationProvince: Province;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เขตตามทะเบียนบ้าน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
registrationDistrictId: string;
|
||||
|
||||
@ManyToOne(() => District, (v) => v.registrationDistricts)
|
||||
registrationDistrict: District;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "แขวงตามทะเบียนบ้าน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
registrationSubDistrictId: string;
|
||||
|
||||
@ManyToOne(() => SubDistrict, (v) => v.registrationSubDistricts)
|
||||
registrationSubDistrict: SubDistrict;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "รหัสไปรษณีย์ตามทะเบียนบ้าน",
|
||||
default: null,
|
||||
length: 5,
|
||||
})
|
||||
registrationZipCode: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ที่อยู่ตามปัจจุบัน",
|
||||
default: null,
|
||||
length: 255,
|
||||
})
|
||||
currentAddress: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "จังหวัดตามปัจจุบัน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
currentProvinceId: string;
|
||||
|
||||
@ManyToOne(() => Province, (v) => v.currentProvinces)
|
||||
currentProvince: Province;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เขตตามปัจจุบัน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
currentDistrictId: string;
|
||||
|
||||
@ManyToOne(() => District, (v) => v.currentDistricts)
|
||||
currentDistrict: District;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "แขวงตามปัจจุบัน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
currentSubDistrictId: string;
|
||||
|
||||
@ManyToOne(() => SubDistrict, (v) => v.currentSubDistricts)
|
||||
currentSubDistrict: SubDistrict;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "รหัสไปรษณีย์ตามปัจจุบัน",
|
||||
default: null,
|
||||
length: 5,
|
||||
})
|
||||
currentZipCode: string;
|
||||
|
||||
@ManyToOne(() => Profile, (v) => v.histories, { onDelete: "CASCADE" })
|
||||
profile: Profile;
|
||||
}
|
||||
|
||||
export class CreateProfile {
|
||||
rank: string;
|
||||
prefix: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
|
|
@ -312,15 +517,16 @@ export class CreateProfile {
|
|||
telephoneNumber: string | null;
|
||||
nationality: string | null;
|
||||
citizenId: string;
|
||||
religionId: string | null;
|
||||
religion: string | null;
|
||||
posLevelId: string | null;
|
||||
posTypeId: string | null;
|
||||
genderId: string | null;
|
||||
relationshipId: string | null;
|
||||
bloodGroupId: string | null;
|
||||
gender: string | null;
|
||||
relationship: string | null;
|
||||
bloodGroup: string | null;
|
||||
}
|
||||
|
||||
export type UpdateProfile = {
|
||||
rank?: string | null;
|
||||
prefix?: string | null;
|
||||
firstName?: string | null;
|
||||
lastName?: string | null;
|
||||
|
|
@ -335,10 +541,23 @@ export type UpdateProfile = {
|
|||
telephoneNumber?: string | null;
|
||||
nationality?: string | null;
|
||||
citizenId?: string | null;
|
||||
religionId: string | null;
|
||||
religion: string | null;
|
||||
posLevelId?: string | null;
|
||||
posTypeId?: string | null;
|
||||
genderId?: string | null;
|
||||
relationshipId?: string | null;
|
||||
bloodGroupId?: string | null;
|
||||
gender?: string | null;
|
||||
relationship?: string | null;
|
||||
bloodGroup?: string | null;
|
||||
};
|
||||
|
||||
export type UpdateProfileAddress = {
|
||||
registrationAddress?: string | null;
|
||||
registrationProvinceId?: string | null;
|
||||
registrationDistrictId?: string | null;
|
||||
registrationSubDistrictId?: string | null;
|
||||
registrationZipCode?: string | null;
|
||||
currentAddress?: string | null;
|
||||
currentProvinceId?: string | null;
|
||||
currentDistrictId?: string | null;
|
||||
currentSubDistrictId?: string | null;
|
||||
currentZipCode?: string | null;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ export class ProfileEducation extends EntityBase {
|
|||
|
||||
export class CreateProfileEducation {
|
||||
profileId: string | null;
|
||||
|
||||
country: string | null;
|
||||
degree: string | null;
|
||||
duration: string | null;
|
||||
|
|
|
|||
|
|
@ -5,13 +5,17 @@ import { EmployeePosType } from "./EmployeePosType";
|
|||
import { EmployeePosMaster } from "./EmployeePosMaster";
|
||||
import { ProfileSalaryEmployee } from "./ProfileSalaryEmployee";
|
||||
import { ProfileDisciplineEmployee } from "./ProfileDisciplineEmployee";
|
||||
import { BloodGroup } from "./BloodGroup";
|
||||
import { Relationship } from "./Relationship";
|
||||
import { Gender } from "./Gender";
|
||||
import { Religion } from "./Religion";
|
||||
|
||||
@Entity("profileEmployee")
|
||||
export class ProfileEmployee extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ยศ",
|
||||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
rank: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "คำนำหน้าชื่อ",
|
||||
|
|
@ -147,10 +151,7 @@ export class ProfileEmployee extends EntityBase {
|
|||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
genderId: string;
|
||||
|
||||
@ManyToOne(() => Gender, (v) => v.profileEmployee)
|
||||
gender: Gender;
|
||||
gender: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -158,10 +159,7 @@ export class ProfileEmployee extends EntityBase {
|
|||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
relationshipId: string;
|
||||
|
||||
@ManyToOne(() => Relationship, (v) => v.profileEmployee)
|
||||
relationship: Relationship;
|
||||
relationship: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -169,10 +167,7 @@ export class ProfileEmployee extends EntityBase {
|
|||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
religionId: string;
|
||||
|
||||
@ManyToOne(() => Religion, (v) => v.profile)
|
||||
religion: Religion;
|
||||
religion: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -180,10 +175,7 @@ export class ProfileEmployee extends EntityBase {
|
|||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
bloodGroupId: string;
|
||||
|
||||
@ManyToOne(() => BloodGroup, (v) => v.profileEmployee)
|
||||
bloodGroup: BloodGroup;
|
||||
bloodGroup: string;
|
||||
|
||||
@OneToMany(() => EmployeePosMaster, (v) => v.current_holder)
|
||||
current_holders: EmployeePosMaster[];
|
||||
|
|
@ -222,6 +214,7 @@ export class ProfileEmployeeHistory extends ProfileEmployee {
|
|||
}
|
||||
|
||||
export class CreateProfileEmployee {
|
||||
rank: string;
|
||||
prefix: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
|
|
@ -233,15 +226,16 @@ export class CreateProfileEmployee {
|
|||
ethnicity: string | null;
|
||||
telephoneNumber: string | null;
|
||||
citizenId: string;
|
||||
religionId: string | null;
|
||||
religion: string | null;
|
||||
posLevelId: string | null;
|
||||
posTypeId: string | null;
|
||||
genderId: string | null;
|
||||
relationshipId: string | null;
|
||||
bloodGroupId: string | null;
|
||||
gender: string | null;
|
||||
relationship: string | null;
|
||||
bloodGroup: string | null;
|
||||
}
|
||||
|
||||
export type UpdateProfileEmployee = {
|
||||
rank?: string | null;
|
||||
prefix?: string | null;
|
||||
firstName?: string | null;
|
||||
lastName?: string | null;
|
||||
|
|
@ -253,10 +247,10 @@ export type UpdateProfileEmployee = {
|
|||
ethnicity?: string | null;
|
||||
telephoneNumber?: string | null;
|
||||
citizenId?: string;
|
||||
religionId: string | null;
|
||||
religion: string | null;
|
||||
posLevelId?: string | null;
|
||||
posTypeId?: string | null;
|
||||
genderId?: string | null;
|
||||
relationshipId?: string | null;
|
||||
bloodGroupId?: string | null;
|
||||
gender?: string | null;
|
||||
relationship?: string | null;
|
||||
bloodGroup?: string | null;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ export type UpdateProfileInsignia = {
|
|||
section?: string | null;
|
||||
page?: string | null;
|
||||
receiveDate?: Date | null;
|
||||
insigniaId?: string | null;
|
||||
insigniaId?: string;
|
||||
insigniaType?: string | null;
|
||||
dateAnnounce?: Date | null;
|
||||
issue?: string | null;
|
||||
|
|
|
|||
|
|
@ -24,10 +24,18 @@ export class ProfileLeave extends EntityBase {
|
|||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "วัน เดือน ปี ที่ลา",
|
||||
comment: "วัน เดือน ปี ที่เริ่มลา",
|
||||
default: null,
|
||||
})
|
||||
dateLeave: Date;
|
||||
dateLeaveStart: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "วัน เดือน ปี ที่สิ้นสุดลา",
|
||||
default: null,
|
||||
})
|
||||
dateLeaveEnd: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -95,8 +103,9 @@ export class ProfileLeaveHistory extends ProfileLeave {
|
|||
|
||||
export class CreateProfileLeave {
|
||||
profileId: string | null;
|
||||
leaveTypeId: string | null;
|
||||
dateLeave: Date | null;
|
||||
leaveTypeId: string;
|
||||
dateLeaveStart: Date | null;
|
||||
dateLeaveEnd: Date | null;
|
||||
leaveDays: number | null;
|
||||
leaveCount: number | null;
|
||||
totalLeave: number | null;
|
||||
|
|
@ -105,8 +114,9 @@ export class CreateProfileLeave {
|
|||
}
|
||||
|
||||
export type UpdateProfileLeave = {
|
||||
leaveTypeId?: string | null;
|
||||
dateLeave?: Date | null;
|
||||
leaveTypeId?: string;
|
||||
dateLeaveStart?: Date | null;
|
||||
dateLeaveEnd?: Date | null;
|
||||
leaveDays?: number | null;
|
||||
leaveCount?: number | null;
|
||||
totalLeave?: number | null;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@ import { ProfileSalaryHistory } from "./ProfileSalaryHistory";
|
|||
|
||||
@Entity("profileSalary")
|
||||
export class ProfileSalary extends EntityBase {
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
type: "uuid",
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
comment: "วันที่",
|
||||
type: "datetime",
|
||||
|
|
@ -21,6 +28,62 @@ export class ProfileSalary extends EntityBase {
|
|||
})
|
||||
date: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "เลขที่ตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
posNo: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
position: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "สายงาน",
|
||||
default: null,
|
||||
})
|
||||
positionLine: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ด้าน/สาขา",
|
||||
default: null,
|
||||
})
|
||||
positionPathSide: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ตำแหน่งทางการบริหาร",
|
||||
default: null,
|
||||
})
|
||||
positionExecutive: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ประเภทตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
positionType: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ระดับตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
positionLevel: string;
|
||||
|
||||
@Column({
|
||||
comment: "เงินเดือนฐาน",
|
||||
default: 0,
|
||||
|
|
@ -45,180 +108,9 @@ export class ProfileSalary extends EntityBase {
|
|||
})
|
||||
mouthSalaryAmount: Double;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
type: "uuid",
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะการใช้งาน",
|
||||
default: false,
|
||||
})
|
||||
isActive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ตำแหน่ง (รายละเอียด)",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
salaryClass: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เอกสารอ้างอิง",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
salaryRef: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id เลขที่ตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
posNoId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id เลขที่ตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id สังกัด",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
ocId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ตำแหน่งทางการบริหาร",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionExecutiveId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ด้านทางการบริหาร",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionExecutiveSideId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionLevelId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id สายงาน",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionLineId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ด้าน/สาขา",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionPathSideId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ประเภทตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionTypeId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ชื่อย่อหน่วยงาน",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
organizationShortNameId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id กลุ่มงาน",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionEmployeeGroupId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ระดับชั้นงาน",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionEmployeeLevelId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionEmployeePositionId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ด้านของตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionEmployeePositionSideId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id เลขที่ตำแหน่งลูกจ้าง",
|
||||
default: null,
|
||||
})
|
||||
posNoEmployee: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "เอกสารอ้างอิง (ลงวันที่)",
|
||||
default: null,
|
||||
})
|
||||
refCommandDate: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
|
||||
comment: "เลขที่คำสั่ง",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
|
|
@ -226,30 +118,11 @@ export class ProfileSalary extends EntityBase {
|
|||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ลำดับ",
|
||||
default: null,
|
||||
})
|
||||
order: number;
|
||||
|
||||
@Column({
|
||||
comment: "เลขที่คำสั่ง",
|
||||
type: "text",
|
||||
})
|
||||
commandNo: string;
|
||||
|
||||
@Column({
|
||||
comment: "ประเภทคำสั่ง",
|
||||
type: "text",
|
||||
})
|
||||
commandTypeName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ประเภทตำแหน่งกรณีพิเศษ",
|
||||
comment: "เอกสารอ้างอิง",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
salaryStatus: string;
|
||||
templateDoc: string;
|
||||
|
||||
@OneToMany(() => ProfileSalaryHistory, (profileSalaryHistory) => profileSalaryHistory.histories)
|
||||
profileSalaryHistories: ProfileSalaryHistory[];
|
||||
|
|
@ -260,194 +133,34 @@ export class ProfileSalary extends EntityBase {
|
|||
}
|
||||
|
||||
export class CreateProfileSalary {
|
||||
@Column({
|
||||
type: "datetime",
|
||||
})
|
||||
date: Date;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
amount: Double;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
positionSalaryAmount: Double;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
mouthSalaryAmount: Double;
|
||||
|
||||
@Column({
|
||||
type: "uuid",
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
// @Column()
|
||||
// isActive: boolean;
|
||||
|
||||
// @Column()
|
||||
// salaryClass: string | null;
|
||||
|
||||
// @Column()
|
||||
// salaryRef: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// posNoId: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionId: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// ocId: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionExecutiveId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionExecutiveSideId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionLevelId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionLineId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionPathSideId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionTypeId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// organizationShortNameId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeeGroupId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeeLevelId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeePositionId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeePositionSideId : string | null;
|
||||
|
||||
// @Column()
|
||||
// posNoEmployee : string | null;
|
||||
|
||||
// @Column()
|
||||
// refCommandDate: Date | null;
|
||||
|
||||
// @Column()
|
||||
// refCommandNo: string | null;
|
||||
|
||||
// @Column()
|
||||
// order: number | null;
|
||||
|
||||
// @Column()
|
||||
// commandNo: string;
|
||||
|
||||
// @Column()
|
||||
// commandTypeName: string;
|
||||
|
||||
// @Column()
|
||||
// salaryStatus: string | null;
|
||||
date?: Date | null;
|
||||
amount?: Double | null;
|
||||
positionSalaryAmount?: Double | null;
|
||||
mouthSalaryAmount?: Double | null;
|
||||
posNo: string | null;
|
||||
position: string | null;
|
||||
positionLine: string | null;
|
||||
positionPathSide: string | null;
|
||||
positionExecutive: string | null;
|
||||
positionType: string | null;
|
||||
positionLevel: string | null;
|
||||
refCommandNo: string | null;
|
||||
templateDoc: string | null;
|
||||
}
|
||||
|
||||
export class UpdateProfileSalary {
|
||||
@Column({
|
||||
type: "datetime",
|
||||
})
|
||||
date: Date;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
amount: Double;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
positionSalaryAmount: Double;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
mouthSalaryAmount: Double;
|
||||
|
||||
// @Column()
|
||||
// isActive: boolean;
|
||||
|
||||
// @Column()
|
||||
// salaryClass: string;
|
||||
|
||||
// @Column()
|
||||
// salaryRef: string;
|
||||
|
||||
// @Column("uuid")
|
||||
// posNoId: string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionId: string;
|
||||
|
||||
// @Column("uuid")
|
||||
// ocId: string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionExecutiveId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionExecutiveSideId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionLevelId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionLineId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionPathSideId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionTypeId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// organizationShortNameId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeeGroupId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeeLevelId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeePositionId : string;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeePositionSideId : string;
|
||||
|
||||
// @Column()
|
||||
// posNoEmployee : string;
|
||||
|
||||
// @Column()
|
||||
// refCommandDate: Date;
|
||||
|
||||
// @Column()
|
||||
// refCommandNo: string;
|
||||
|
||||
// @Column()
|
||||
// order: number;
|
||||
|
||||
// @Column()
|
||||
// commandNo: string;
|
||||
|
||||
// @Column()
|
||||
// commandTypeName: string;
|
||||
|
||||
// @Column()
|
||||
// salaryStatus: string;
|
||||
}
|
||||
export type UpdateProfileSalary = {
|
||||
date?: Date | null;
|
||||
amount?: Double | null;
|
||||
positionSalaryAmount?: Double | null;
|
||||
mouthSalaryAmount?: Double | null;
|
||||
posNo?: string | null;
|
||||
position?: string | null;
|
||||
positionLine?: string | null;
|
||||
positionPathSide?: string | null;
|
||||
positionExecutive?: string | null;
|
||||
positionType?: string | null;
|
||||
positionLevel?: string | null;
|
||||
refCommandNo?: string | null;
|
||||
templateDoc?: string | null;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@ import { ProfileSalary } from "./ProfileSalary";
|
|||
|
||||
@Entity("profileSalaryHistory")
|
||||
export class ProfileSalaryHistory extends EntityBase {
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
type: "uuid",
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
comment: "วันที่",
|
||||
type: "datetime",
|
||||
|
|
@ -21,6 +28,62 @@ export class ProfileSalaryHistory extends EntityBase {
|
|||
})
|
||||
date: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "เลขที่ตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
posNo: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
position: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "สายงาน",
|
||||
default: null,
|
||||
})
|
||||
positionLine: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ด้าน/สาขา",
|
||||
default: null,
|
||||
})
|
||||
positionPathSide: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ตำแหน่งทางการบริหาร",
|
||||
default: null,
|
||||
})
|
||||
positionExecutive: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ประเภทตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
positionType: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ระดับตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
positionLevel: string;
|
||||
|
||||
@Column({
|
||||
comment: "เงินเดือนฐาน",
|
||||
default: 0,
|
||||
|
|
@ -45,180 +108,9 @@ export class ProfileSalaryHistory extends EntityBase {
|
|||
})
|
||||
mouthSalaryAmount: Double;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
type: "uuid",
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะการใช้งาน",
|
||||
default: false,
|
||||
})
|
||||
isActive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ตำแหน่ง (รายละเอียด)",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
salaryClass: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เอกสารอ้างอิง",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
salaryRef: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id เลขที่ตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
posNoId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id เลขที่ตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id สังกัด",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
ocId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ตำแหน่งทางการบริหาร",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionExecutiveId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ด้านทางการบริหาร",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionExecutiveSideId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionLevelId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id สายงาน",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionLineId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ด้าน/สาขา",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionPathSideId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ประเภทตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionTypeId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ชื่อย่อหน่วยงาน",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
organizationShortNameId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id กลุ่มงาน",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionEmployeeGroupId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ระดับชั้นงาน",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionEmployeeLevelId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionEmployeePositionId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id ด้านของตำแหน่ง",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
positionEmployeePositionSideId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "Id เลขที่ตำแหน่งลูกจ้าง",
|
||||
default: null,
|
||||
})
|
||||
posNoEmployee: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "เอกสารอ้างอิง (ลงวันที่)",
|
||||
default: null,
|
||||
})
|
||||
refCommandDate: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
|
||||
comment: "เลขที่คำสั่ง",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
|
|
@ -226,30 +118,17 @@ export class ProfileSalaryHistory extends EntityBase {
|
|||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ลำดับ",
|
||||
default: null,
|
||||
})
|
||||
order: number;
|
||||
|
||||
@Column({
|
||||
comment: "เลขที่คำสั่ง",
|
||||
type: "text",
|
||||
})
|
||||
commandNo: string;
|
||||
|
||||
@Column({
|
||||
comment: "ประเภทคำสั่ง",
|
||||
type: "text",
|
||||
})
|
||||
commandTypeName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ประเภทตำแหน่งกรณีพิเศษ",
|
||||
comment: "เอกสารอ้างอิง",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
salaryStatus: string;
|
||||
templateDoc: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profileSalary",
|
||||
})
|
||||
profileSalaryId: string;
|
||||
|
||||
@ManyToOne(() => ProfileSalary, (profileSalary) => profileSalary.profileSalaryHistories)
|
||||
@JoinColumn({ name: "profileSalaryId" })
|
||||
|
|
@ -257,194 +136,34 @@ export class ProfileSalaryHistory extends EntityBase {
|
|||
}
|
||||
|
||||
export class CreateProfileSalaryHistory {
|
||||
@Column({
|
||||
type: "datetime",
|
||||
})
|
||||
date: Date;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
amount: Double;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
positionSalaryAmount: Double;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
mouthSalaryAmount: Double;
|
||||
|
||||
@Column({
|
||||
type: "uuid",
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
// @Column()
|
||||
// isActive: boolean;
|
||||
|
||||
// @Column()
|
||||
// salaryClass: string | null;
|
||||
|
||||
// @Column()
|
||||
// salaryRef: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// posNoId: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionId: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// ocId: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionExecutiveId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionExecutiveSideId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionLevelId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionLineId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionPathSideId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionTypeId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// organizationShortNameId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeeGroupId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeeLevelId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeePositionId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeePositionSideId : string | null;
|
||||
|
||||
// @Column()
|
||||
// posNoEmployee : string | null;
|
||||
|
||||
// @Column()
|
||||
// refCommandDate: Date | null;
|
||||
|
||||
// @Column()
|
||||
// refCommandNo: string | null;
|
||||
|
||||
// @Column()
|
||||
// order: number | null;
|
||||
|
||||
// @Column()
|
||||
// commandNo: string;
|
||||
|
||||
// @Column()
|
||||
// commandTypeName: string;
|
||||
|
||||
// @Column()
|
||||
// salaryStatus: string | null;
|
||||
date?: Date | null;
|
||||
amount?: Double | null;
|
||||
positionSalaryAmount?: Double | null;
|
||||
mouthSalaryAmount?: Double | null;
|
||||
posNo: string | null;
|
||||
position: string | null;
|
||||
positionLine: string | null;
|
||||
positionPathSide: string | null;
|
||||
positionExecutive: string | null;
|
||||
positionType: string | null;
|
||||
positionLevel: string | null;
|
||||
refCommandNo: string | null;
|
||||
templateDoc: string | null;
|
||||
}
|
||||
|
||||
export class UpdateProfileSalaryHistory {
|
||||
@Column({
|
||||
type: "datetime",
|
||||
})
|
||||
date: Date;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
amount: Double;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
positionSalaryAmount: Double;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
})
|
||||
mouthSalaryAmount: Double;
|
||||
|
||||
// @Column()
|
||||
// isActive: boolean;
|
||||
|
||||
// @Column()
|
||||
// salaryClass: string | null;
|
||||
|
||||
// @Column()
|
||||
// salaryRef: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// posNoId: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionId: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// ocId: string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionExecutiveId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionExecutiveSideId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionLevelId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionLineId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionPathSideId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionTypeId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// organizationShortNameId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeeGroupId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeeLevelId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeePositionId : string | null;
|
||||
|
||||
// @Column("uuid")
|
||||
// positionEmployeePositionSideId : string | null;
|
||||
|
||||
// @Column()
|
||||
// posNoEmployee : string | null;
|
||||
|
||||
// @Column()
|
||||
// refCommandDate: Date | null;
|
||||
|
||||
// @Column()
|
||||
// refCommandNo: string | null;
|
||||
|
||||
// @Column()
|
||||
// order: number | null;
|
||||
|
||||
// @Column()
|
||||
// commandNo: string;
|
||||
|
||||
// @Column()
|
||||
// commandTypeName: string;
|
||||
|
||||
// @Column()
|
||||
// salaryStatus: string | null;
|
||||
date?: Date | null;
|
||||
amount?: Double | null;
|
||||
positionSalaryAmount?: Double | null;
|
||||
mouthSalaryAmount?: Double | null;
|
||||
posNo?: string | null;
|
||||
position?: string | null;
|
||||
positionLine?: string | null;
|
||||
positionPathSide?: string | null;
|
||||
positionExecutive?: string | null;
|
||||
positionType?: string | null;
|
||||
positionLevel?: string | null;
|
||||
refCommandNo?: string | null;
|
||||
templateDoc?: string | null;
|
||||
}
|
||||
|
|
|
|||
30
src/entities/Province.ts
Normal file
30
src/entities/Province.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { District } from "./District";
|
||||
|
||||
@Entity("province")
|
||||
export class Province extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "จังหวัด",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@OneToMany(() => District, (district) => district.province)
|
||||
districts: District[];
|
||||
|
||||
@OneToMany(() => Province, (province) => province.registrationProvinces)
|
||||
registrationProvinces: Province[];
|
||||
|
||||
@OneToMany(() => Province, (province) => province.currentProvinces)
|
||||
currentProvinces: Province[];
|
||||
}
|
||||
|
||||
export class CreateProvince {
|
||||
@Column()
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type UpdateProvince = Partial<CreateProvince>;
|
||||
45
src/entities/SubDistrict.ts
Normal file
45
src/entities/SubDistrict.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { District } from "./District";
|
||||
|
||||
@Entity("subDistrict")
|
||||
export class SubDistrict extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "แขวง",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "รหัสไปรษณีย์",
|
||||
length: 10,
|
||||
default: null,
|
||||
})
|
||||
zipCode: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง district",
|
||||
})
|
||||
districtId: string;
|
||||
|
||||
@ManyToOne(() => District, (district) => district.subDistricts)
|
||||
@JoinColumn({ name: "districtId" })
|
||||
district: District;
|
||||
|
||||
@OneToMany(() => SubDistrict, (subDistrict) => subDistrict.registrationSubDistricts)
|
||||
registrationSubDistricts: SubDistrict[];
|
||||
|
||||
@OneToMany(() => SubDistrict, (subDistrict) => subDistrict.currentSubDistricts)
|
||||
currentSubDistricts: SubDistrict[];
|
||||
}
|
||||
|
||||
export class CreateSubDistrict {
|
||||
@Column()
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type UpdateSubDistrict = Partial<CreateSubDistrict>;
|
||||
118
src/migration/1711441796847-add_table_province.ts
Normal file
118
src/migration/1711441796847-add_table_province.ts
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddTableProvince1711441796847 implements MigrationInterface {
|
||||
name = 'AddTableProvince1711441796847'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP FOREIGN KEY \`FK_7ef8f3cf3bf8ec9440bd63b2d38\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP FOREIGN KEY \`FK_b6c5eda5127746a8db2f0808286\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP FOREIGN KEY \`FK_c2c8a7cc54dac1327de6b272d01\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP FOREIGN KEY \`FK_df0b55e065380973137c14b08c4\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP FOREIGN KEY \`FK_0df69e346870ac817ac228c0a66\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP FOREIGN KEY \`FK_35659805a8e5883b8a8d9b3c8ca\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP FOREIGN KEY \`FK_d111ac24d84c01fd9afe8eb5d9c\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP FOREIGN KEY \`FK_f61a2b02f164e8dd987399e9836\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_31ba86a3ae1521c819e9eba08a0\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_356bcde9bd0797157000ec565db\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_c1a2bc732f78592afd6bd5ac264\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_c3ebe0ffebc265ed89743d14770\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_1bd1f0ec33d3660b8580a04c850\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_2b9eaacb0b48b7057c124901cfa\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_6dc992d2dcea1c987e94a7f6ac2\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_f62b33c6cf3d6eb453bdae64443\``);
|
||||
await queryRunner.query(`CREATE TABLE \`province\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`name\` varchar(255) NULL COMMENT 'จังหวัด', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`district\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`name\` varchar(255) NULL COMMENT 'เขต', \`provinceId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง province', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`subDistrict\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`name\` varchar(255) NULL COMMENT 'แขวง', \`zipCode\` varchar(10) NULL COMMENT 'รหัสไปรษณีย์', \`districtId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง district', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`genderId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`relationshipId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`bloodGroupId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`religionId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`genderId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`relationshipId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`bloodGroupId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`religionId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`genderId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`relationshipId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`bloodGroupId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`religionId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`genderId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`relationshipId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`bloodGroupId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`religionId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`gender\` varchar(40) NULL COMMENT 'เพศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`relationship\` varchar(40) NULL COMMENT 'ความสัมพันธ์'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`religion\` varchar(255) NULL COMMENT 'ศาสนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`bloodGroup\` varchar(40) NULL COMMENT 'กรุ๊ปเลือด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`gender\` varchar(40) NULL COMMENT 'เพศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`relationship\` varchar(40) NULL COMMENT 'ความสัมพันธ์'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`religion\` varchar(255) NULL COMMENT 'ศาสนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`bloodGroup\` varchar(40) NULL COMMENT 'กรุ๊ปเลือด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`gender\` varchar(40) NULL COMMENT 'เพศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`relationship\` varchar(40) NULL COMMENT 'ความสัมพันธ์'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`religion\` varchar(255) NULL COMMENT 'ศาสนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`bloodGroup\` varchar(40) NULL COMMENT 'กรุ๊ปเลือด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`gender\` varchar(40) NULL COMMENT 'เพศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`relationship\` varchar(40) NULL COMMENT 'ความสัมพันธ์'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`religion\` varchar(255) NULL COMMENT 'ศาสนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`bloodGroup\` varchar(40) NULL COMMENT 'กรุ๊ปเลือด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`district\` ADD CONSTRAINT \`FK_23a21b38208367a242b1dd3a424\` FOREIGN KEY (\`provinceId\`) REFERENCES \`province\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`subDistrict\` ADD CONSTRAINT \`FK_2b4108b71558ef7e601b6bd4edb\` FOREIGN KEY (\`districtId\`) REFERENCES \`district\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`subDistrict\` DROP FOREIGN KEY \`FK_2b4108b71558ef7e601b6bd4edb\``);
|
||||
await queryRunner.query(`ALTER TABLE \`district\` DROP FOREIGN KEY \`FK_23a21b38208367a242b1dd3a424\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`bloodGroup\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`religion\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`relationship\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`gender\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`bloodGroup\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`religion\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`relationship\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`gender\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`bloodGroup\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`religion\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`relationship\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`gender\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`bloodGroup\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`religion\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`relationship\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`gender\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`religionId\` varchar(255) NULL COMMENT 'ศาสนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`bloodGroupId\` varchar(40) NULL COMMENT 'กรุ๊ปเลือด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`relationshipId\` varchar(40) NULL COMMENT 'ความสัมพันธ์'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`genderId\` varchar(40) NULL COMMENT 'เพศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`religionId\` varchar(255) NULL COMMENT 'ศาสนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`bloodGroupId\` varchar(40) NULL COMMENT 'กรุ๊ปเลือด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`relationshipId\` varchar(40) NULL COMMENT 'ความสัมพันธ์'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`genderId\` varchar(40) NULL COMMENT 'เพศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`religionId\` varchar(255) NULL COMMENT 'ศาสนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`bloodGroupId\` varchar(40) NULL COMMENT 'กรุ๊ปเลือด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`relationshipId\` varchar(40) NULL COMMENT 'ความสัมพันธ์'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`genderId\` varchar(40) NULL COMMENT 'เพศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`religionId\` varchar(255) NULL COMMENT 'ศาสนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`bloodGroupId\` varchar(40) NULL COMMENT 'กรุ๊ปเลือด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`relationshipId\` varchar(40) NULL COMMENT 'ความสัมพันธ์'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`genderId\` varchar(40) NULL COMMENT 'เพศ'`);
|
||||
await queryRunner.query(`DROP TABLE \`subDistrict\``);
|
||||
await queryRunner.query(`DROP TABLE \`district\``);
|
||||
await queryRunner.query(`DROP TABLE \`province\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_f62b33c6cf3d6eb453bdae64443\` FOREIGN KEY (\`genderId\`) REFERENCES \`gender\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_6dc992d2dcea1c987e94a7f6ac2\` FOREIGN KEY (\`bloodGroupId\`) REFERENCES \`bloodGroup\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_2b9eaacb0b48b7057c124901cfa\` FOREIGN KEY (\`religionId\`) REFERENCES \`religion\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_1bd1f0ec33d3660b8580a04c850\` FOREIGN KEY (\`relationshipId\`) REFERENCES \`relationship\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_c3ebe0ffebc265ed89743d14770\` FOREIGN KEY (\`relationshipId\`) REFERENCES \`relationship\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_c1a2bc732f78592afd6bd5ac264\` FOREIGN KEY (\`bloodGroupId\`) REFERENCES \`bloodGroup\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_356bcde9bd0797157000ec565db\` FOREIGN KEY (\`religionId\`) REFERENCES \`religion\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_31ba86a3ae1521c819e9eba08a0\` FOREIGN KEY (\`genderId\`) REFERENCES \`gender\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD CONSTRAINT \`FK_f61a2b02f164e8dd987399e9836\` FOREIGN KEY (\`bloodGroupId\`) REFERENCES \`bloodGroup\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD CONSTRAINT \`FK_d111ac24d84c01fd9afe8eb5d9c\` FOREIGN KEY (\`genderId\`) REFERENCES \`gender\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD CONSTRAINT \`FK_35659805a8e5883b8a8d9b3c8ca\` FOREIGN KEY (\`religionId\`) REFERENCES \`religion\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD CONSTRAINT \`FK_0df69e346870ac817ac228c0a66\` FOREIGN KEY (\`relationshipId\`) REFERENCES \`relationship\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD CONSTRAINT \`FK_df0b55e065380973137c14b08c4\` FOREIGN KEY (\`bloodGroupId\`) REFERENCES \`bloodGroup\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD CONSTRAINT \`FK_c2c8a7cc54dac1327de6b272d01\` FOREIGN KEY (\`genderId\`) REFERENCES \`gender\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD CONSTRAINT \`FK_b6c5eda5127746a8db2f0808286\` FOREIGN KEY (\`religionId\`) REFERENCES \`religion\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD CONSTRAINT \`FK_7ef8f3cf3bf8ec9440bd63b2d38\` FOREIGN KEY (\`relationshipId\`) REFERENCES \`relationship\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
}
|
||||
20
src/migration/1711442537793-update_table_profile_add_rank.ts
Normal file
20
src/migration/1711442537793-update_table_profile_add_rank.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableProfileAddRank1711442537793 implements MigrationInterface {
|
||||
name = 'UpdateTableProfileAddRank1711442537793'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`rank\` varchar(40) NULL COMMENT 'ยศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`rank\` varchar(40) NULL COMMENT 'ยศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`rank\` varchar(40) NULL COMMENT 'ยศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`rank\` varchar(40) NULL COMMENT 'ยศ'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`rank\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`rank\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`rank\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`rank\``);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableProfileAddAddress1711448340746 implements MigrationInterface {
|
||||
name = 'UpdateTableProfileAddAddress1711448340746'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE TABLE \`profileAddressHistory\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileInformation', \`registrationAddress\` varchar(255) NULL COMMENT 'ที่อยู่ตามทะเบียนบ้าน', \`registrationProvinceId\` varchar(255) NULL COMMENT 'จังหวัดตามทะเบียนบ้าน', \`registrationDistrictId\` varchar(255) NULL COMMENT 'เขตตามทะเบียนบ้าน', \`registrationSubDistrictId\` varchar(255) NULL COMMENT 'แขวงตามทะเบียนบ้าน', \`registrationZipCode\` varchar(5) NULL COMMENT 'รหัสไปรษณีย์ตามทะเบียนบ้าน', \`currentAddress\` varchar(255) NULL COMMENT 'ที่อยู่ตามปัจจุบัน', \`currentProvinceId\` varchar(255) NULL COMMENT 'จังหวัดตามปัจจุบัน', \`currentDistrictId\` varchar(255) NULL COMMENT 'เขตตามปัจจุบัน', \`currentSubDistrictId\` varchar(255) NULL COMMENT 'แขวงตามปัจจุบัน', \`currentZipCode\` varchar(5) NULL COMMENT 'รหัสไปรษณีย์ตามปัจจุบัน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`registrationAddress\` varchar(255) NULL COMMENT 'ที่อยู่ตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`registrationProvinceId\` varchar(255) NULL COMMENT 'จังหวัดตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`registrationDistrictId\` varchar(255) NULL COMMENT 'เขตตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`registrationSubDistrictId\` varchar(255) NULL COMMENT 'แขวงตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`registrationZipCode\` varchar(5) NULL COMMENT 'รหัสไปรษณีย์ตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`currentAddress\` varchar(255) NULL COMMENT 'ที่อยู่ตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`currentProvinceId\` varchar(255) NULL COMMENT 'จังหวัดตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`currentDistrictId\` varchar(255) NULL COMMENT 'เขตตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`currentSubDistrictId\` varchar(255) NULL COMMENT 'แขวงตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`currentZipCode\` varchar(5) NULL COMMENT 'รหัสไปรษณีย์ตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`registrationAddress\` varchar(255) NULL COMMENT 'ที่อยู่ตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`registrationProvinceId\` varchar(255) NULL COMMENT 'จังหวัดตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`registrationDistrictId\` varchar(255) NULL COMMENT 'เขตตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`registrationSubDistrictId\` varchar(255) NULL COMMENT 'แขวงตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`registrationZipCode\` varchar(5) NULL COMMENT 'รหัสไปรษณีย์ตามทะเบียนบ้าน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`currentAddress\` varchar(255) NULL COMMENT 'ที่อยู่ตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`currentProvinceId\` varchar(255) NULL COMMENT 'จังหวัดตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`currentDistrictId\` varchar(255) NULL COMMENT 'เขตตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`currentSubDistrictId\` varchar(255) NULL COMMENT 'แขวงตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`currentZipCode\` varchar(5) NULL COMMENT 'รหัสไปรษณีย์ตามปัจจุบัน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_bb2c4b4d673544ba2a89a9e21e8\` FOREIGN KEY (\`registrationProvinceId\`) REFERENCES \`province\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_ce5a42df6c41dc18f5452820121\` FOREIGN KEY (\`registrationDistrictId\`) REFERENCES \`district\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_5e4f0f40544f17b502781383f89\` FOREIGN KEY (\`registrationSubDistrictId\`) REFERENCES \`subDistrict\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_61f059865a7b33d29caafeb2d74\` FOREIGN KEY (\`currentProvinceId\`) REFERENCES \`province\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_087ef04a7387b73e863f1f0af35\` FOREIGN KEY (\`currentDistrictId\`) REFERENCES \`district\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_dffa5d7a2b9d0563051b02bd230\` FOREIGN KEY (\`currentSubDistrictId\`) REFERENCES \`subDistrict\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_2023ae8b6774af7128d7053b653\` FOREIGN KEY (\`registrationProvinceId\`) REFERENCES \`province\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_6f9cd94fb99179bdfa689e56370\` FOREIGN KEY (\`registrationDistrictId\`) REFERENCES \`district\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_55f7510ad1d44582aac7be9883f\` FOREIGN KEY (\`registrationSubDistrictId\`) REFERENCES \`subDistrict\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_b03ec064e4b6c6d7e93156382f4\` FOREIGN KEY (\`currentProvinceId\`) REFERENCES \`province\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_ee4e482e154d9a951c0cda180b5\` FOREIGN KEY (\`currentDistrictId\`) REFERENCES \`district\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD CONSTRAINT \`FK_12ed805134266126f63f115c9d8\` FOREIGN KEY (\`currentSubDistrictId\`) REFERENCES \`subDistrict\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` ADD CONSTRAINT \`FK_d989d2145861b81700dabce671b\` FOREIGN KEY (\`registrationProvinceId\`) REFERENCES \`province\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` ADD CONSTRAINT \`FK_aa053080f29a464448ae1b5910e\` FOREIGN KEY (\`registrationDistrictId\`) REFERENCES \`district\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` ADD CONSTRAINT \`FK_d83169dbeee077fbbbdc74f348f\` FOREIGN KEY (\`registrationSubDistrictId\`) REFERENCES \`subDistrict\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` ADD CONSTRAINT \`FK_5a9724b9705a9860aafd7ab2636\` FOREIGN KEY (\`currentProvinceId\`) REFERENCES \`province\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` ADD CONSTRAINT \`FK_ba065f30134ec4a42d31f74d4dc\` FOREIGN KEY (\`currentDistrictId\`) REFERENCES \`district\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` ADD CONSTRAINT \`FK_ad334e864613fb09d0b265d73d5\` FOREIGN KEY (\`currentSubDistrictId\`) REFERENCES \`subDistrict\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` ADD CONSTRAINT \`FK_29613818254524b09a2938a2576\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` DROP FOREIGN KEY \`FK_29613818254524b09a2938a2576\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` DROP FOREIGN KEY \`FK_ad334e864613fb09d0b265d73d5\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` DROP FOREIGN KEY \`FK_ba065f30134ec4a42d31f74d4dc\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` DROP FOREIGN KEY \`FK_5a9724b9705a9860aafd7ab2636\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` DROP FOREIGN KEY \`FK_d83169dbeee077fbbbdc74f348f\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` DROP FOREIGN KEY \`FK_aa053080f29a464448ae1b5910e\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileAddressHistory\` DROP FOREIGN KEY \`FK_d989d2145861b81700dabce671b\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_12ed805134266126f63f115c9d8\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_ee4e482e154d9a951c0cda180b5\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_b03ec064e4b6c6d7e93156382f4\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_55f7510ad1d44582aac7be9883f\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_6f9cd94fb99179bdfa689e56370\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP FOREIGN KEY \`FK_2023ae8b6774af7128d7053b653\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_dffa5d7a2b9d0563051b02bd230\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_087ef04a7387b73e863f1f0af35\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_61f059865a7b33d29caafeb2d74\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_5e4f0f40544f17b502781383f89\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_ce5a42df6c41dc18f5452820121\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_bb2c4b4d673544ba2a89a9e21e8\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`currentZipCode\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`currentSubDistrictId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`currentDistrictId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`currentProvinceId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`currentAddress\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`registrationZipCode\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`registrationSubDistrictId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`registrationDistrictId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`registrationProvinceId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`registrationAddress\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`currentZipCode\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`currentSubDistrictId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`currentDistrictId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`currentProvinceId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`currentAddress\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`registrationZipCode\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`registrationSubDistrictId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`registrationDistrictId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`registrationProvinceId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`registrationAddress\``);
|
||||
await queryRunner.query(`DROP TABLE \`profileAddressHistory\``);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableProfileSalaryAddPosition1711467720922 implements MigrationInterface {
|
||||
name = 'UpdateTableProfileSalaryAddPosition1711467720922'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`isActive\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`salaryClass\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`salaryRef\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`posNoId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`ocId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionExecutiveId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionExecutiveSideId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionLevelId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionLineId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionPathSideId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionTypeId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`organizationShortNameId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionEmployeeGroupId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionEmployeeLevelId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionEmployeePositionId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionEmployeePositionSideId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`posNoEmployee\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`refCommandDate\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`order\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`commandNo\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`commandTypeName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`salaryStatus\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`isActive\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`salaryClass\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`salaryRef\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`posNoId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`ocId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionExecutiveId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionExecutiveSideId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionLevelId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionLineId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionPathSideId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionTypeId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`organizationShortNameId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionEmployeeGroupId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionEmployeeLevelId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionEmployeePositionId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionEmployeePositionSideId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`posNoEmployee\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`refCommandDate\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`order\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`commandNo\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`commandTypeName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`salaryStatus\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeave\` DROP COLUMN \`dateLeave\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` DROP COLUMN \`dateLeave\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`posNo\` varchar(40) NULL COMMENT 'เลขที่ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionLine\` varchar(255) NULL COMMENT 'สายงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionPathSide\` varchar(255) NULL COMMENT 'ด้าน/สาขา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionExecutive\` varchar(255) NULL COMMENT 'ตำแหน่งทางการบริหาร'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionType\` varchar(255) NULL COMMENT 'ประเภทตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionLevel\` varchar(255) NULL COMMENT 'ระดับตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`templateDoc\` text NULL COMMENT 'เอกสารอ้างอิง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`posNo\` varchar(40) NULL COMMENT 'เลขที่ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionLine\` varchar(255) NULL COMMENT 'สายงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionPathSide\` varchar(255) NULL COMMENT 'ด้าน/สาขา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionExecutive\` varchar(255) NULL COMMENT 'ตำแหน่งทางการบริหาร'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionType\` varchar(255) NULL COMMENT 'ประเภทตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionLevel\` varchar(255) NULL COMMENT 'ระดับตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`templateDoc\` text NULL COMMENT 'เอกสารอ้างอิง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeave\` ADD \`dateLeaveStart\` datetime NULL COMMENT 'วัน เดือน ปี ที่เริ่มลา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeave\` ADD \`dateLeaveEnd\` datetime NULL COMMENT 'วัน เดือน ปี ที่สิ้นสุดลา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` ADD \`dateLeaveStart\` datetime NULL COMMENT 'วัน เดือน ปี ที่เริ่มลา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` ADD \`dateLeaveEnd\` datetime NULL COMMENT 'วัน เดือน ปี ที่สิ้นสุดลา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP FOREIGN KEY \`FK_f1ded3e1f83ab2437f739a14f38\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` CHANGE \`refCommandNo\` \`refCommandNo\` text NULL COMMENT 'เลขที่คำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`profileSalaryId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`profileSalaryId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profileSalary'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` CHANGE \`refCommandNo\` \`refCommandNo\` text NULL COMMENT 'เลขที่คำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD CONSTRAINT \`FK_f1ded3e1f83ab2437f739a14f38\` FOREIGN KEY (\`profileSalaryId\`) REFERENCES \`profileSalary\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP FOREIGN KEY \`FK_f1ded3e1f83ab2437f739a14f38\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` CHANGE \`refCommandNo\` \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`profileSalaryId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`profileSalaryId\` varchar(36) NULL`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` CHANGE \`refCommandNo\` \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD CONSTRAINT \`FK_f1ded3e1f83ab2437f739a14f38\` FOREIGN KEY (\`profileSalaryId\`) REFERENCES \`profileSalary\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` DROP COLUMN \`dateLeaveEnd\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` DROP COLUMN \`dateLeaveStart\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeave\` DROP COLUMN \`dateLeaveEnd\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeave\` DROP COLUMN \`dateLeaveStart\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`templateDoc\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionLevel\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionType\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionExecutive\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionPathSide\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionLine\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`position\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`posNo\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`templateDoc\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionLevel\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionType\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionExecutive\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionPathSide\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`positionLine\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`position\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`posNo\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` ADD \`dateLeave\` datetime NULL COMMENT 'วัน เดือน ปี ที่ลา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileLeave\` ADD \`dateLeave\` datetime NULL COMMENT 'วัน เดือน ปี ที่ลา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`salaryStatus\` text NULL COMMENT 'ประเภทตำแหน่งกรณีพิเศษ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`commandTypeName\` text NOT NULL COMMENT 'ประเภทคำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`commandNo\` text NOT NULL COMMENT 'เลขที่คำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`order\` int NULL COMMENT 'ลำดับ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`posNoEmployee\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่งลูกจ้าง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionEmployeePositionSideId\` varchar(40) NULL COMMENT 'Id ด้านของตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionEmployeePositionId\` varchar(40) NULL COMMENT 'Id ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionEmployeeLevelId\` varchar(40) NULL COMMENT 'Id ระดับชั้นงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionEmployeeGroupId\` varchar(40) NULL COMMENT 'Id กลุ่มงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`organizationShortNameId\` varchar(40) NULL COMMENT 'Id ชื่อย่อหน่วยงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionTypeId\` varchar(40) NULL COMMENT 'Id ประเภทตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionPathSideId\` varchar(40) NULL COMMENT 'Id ด้าน/สาขา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionLineId\` varchar(40) NULL COMMENT 'Id สายงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionLevelId\` varchar(40) NULL`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionExecutiveSideId\` varchar(40) NULL COMMENT 'Id ด้านทางการบริหาร'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionExecutiveId\` varchar(40) NULL COMMENT 'Id ตำแหน่งทางการบริหาร'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`ocId\` varchar(40) NULL COMMENT 'Id สังกัด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`posNoId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`salaryRef\` text NULL COMMENT 'เอกสารอ้างอิง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`salaryClass\` text NULL COMMENT 'ตำแหน่ง (รายละเอียด)'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT '0'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`salaryStatus\` text NULL COMMENT 'ประเภทตำแหน่งกรณีพิเศษ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`commandTypeName\` text NOT NULL COMMENT 'ประเภทคำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`commandNo\` text NOT NULL COMMENT 'เลขที่คำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`order\` int NULL COMMENT 'ลำดับ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`posNoEmployee\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่งลูกจ้าง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionEmployeePositionSideId\` varchar(40) NULL COMMENT 'Id ด้านของตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionEmployeePositionId\` varchar(40) NULL COMMENT 'Id ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionEmployeeLevelId\` varchar(40) NULL COMMENT 'Id ระดับชั้นงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionEmployeeGroupId\` varchar(40) NULL COMMENT 'Id กลุ่มงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`organizationShortNameId\` varchar(40) NULL COMMENT 'Id ชื่อย่อหน่วยงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionTypeId\` varchar(40) NULL COMMENT 'Id ประเภทตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionPathSideId\` varchar(40) NULL COMMENT 'Id ด้าน/สาขา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionLineId\` varchar(40) NULL COMMENT 'Id สายงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionLevelId\` varchar(40) NULL`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionExecutiveSideId\` varchar(40) NULL COMMENT 'Id ด้านทางการบริหาร'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionExecutiveId\` varchar(40) NULL COMMENT 'Id ตำแหน่งทางการบริหาร'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`ocId\` varchar(40) NULL COMMENT 'Id สังกัด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`positionId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`posNoId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`salaryRef\` text NULL COMMENT 'เอกสารอ้างอิง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`salaryClass\` text NULL COMMENT 'ตำแหน่ง (รายละเอียด)'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT '0'`);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue