Merge branch 'net-dav' into develop

This commit is contained in:
Methapon2001 2024-03-21 14:29:57 +07:00
commit 25fd373c5c
33 changed files with 228 additions and 894 deletions

View file

@ -47,7 +47,6 @@ export class ProfileAbilityController extends Controller {
createdFullName: "test bar", createdFullName: "test bar",
lastUpdateFullName: "test bar", lastUpdateFullName: "test bar",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
isActive: true,
remark: "ต้องส่งให้ทันก่อนวันที่ 15 มีนาคม", remark: "ต้องส่งให้ทันก่อนวันที่ 15 มีนาคม",
detail: "-", detail: "-",
reference: "-", reference: "-",
@ -78,7 +77,6 @@ export class ProfileAbilityController extends Controller {
lastUpdateUserId: "00000000-0000-0000-0000-000000000000", lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
createdFullName: "string", createdFullName: "string",
lastUpdateFullName: "test bar", lastUpdateFullName: "test bar",
isActive: true,
remark: "ต้องส่งให้ทันก่อนวันที่ 15 มีนาคม", remark: "ต้องส่งให้ทันก่อนวันที่ 15 มีนาคม",
detail: "ด่วน", detail: "ด่วน",
reference: "-", reference: "-",
@ -95,7 +93,6 @@ export class ProfileAbilityController extends Controller {
lastUpdateUserId: "00000000-0000-0000-0000-000000000000", lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
createdFullName: "string", createdFullName: "string",
lastUpdateFullName: "test bar", lastUpdateFullName: "test bar",
isActive: true,
remark: "ต้องส่งให้ทันก่อนวันที่ 15 มีนาคม", remark: "ต้องส่งให้ทันก่อนวันที่ 15 มีนาคม",
detail: "ด่วนมากสุด", detail: "ด่วนมากสุด",
reference: "-", reference: "-",

View file

@ -53,7 +53,6 @@ export class ProfileAssessmentsController extends Controller {
createdFullName: "test bar", createdFullName: "test bar",
lastUpdateFullName: "test bar", lastUpdateFullName: "test bar",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
isActive: true,
name: "สาวิตรี ศรีสมัย", name: "สาวิตรี ศรีสมัย",
date: "2024-03-13T03:55:42.000Z", date: "2024-03-13T03:55:42.000Z",
point1: 0, point1: 0,
@ -86,7 +85,6 @@ export class ProfileAssessmentsController extends Controller {
lastUpdateUserId: "00000000-0000-0000-0000-000000000000", lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
createdFullName: "string", createdFullName: "string",
lastUpdateFullName: "test bar", lastUpdateFullName: "test bar",
isActive: true,
name: "สาวิตรี ศรีสมัย", name: "สาวิตรี ศรีสมัย",
date: "2024-03-13T03:55:42.000Z", date: "2024-03-13T03:55:42.000Z",
point1: 0, point1: 0,
@ -105,7 +103,6 @@ export class ProfileAssessmentsController extends Controller {
lastUpdateUserId: "00000000-0000-0000-0000-000000000000", lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
createdFullName: "string", createdFullName: "string",
lastUpdateFullName: "test bar", lastUpdateFullName: "test bar",
isActive: true,
name: "สาวิตรี ศรีสมัย", name: "สาวิตรี ศรีสมัย",
date: "2024-03-13T03:55:42.000Z", date: "2024-03-13T03:55:42.000Z",
point1: 50, point1: 50,

View file

@ -48,7 +48,6 @@ export class ProfileCertificateController extends Controller {
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
expireDate: "2024-03-12T10:01:48.000Z", expireDate: "2024-03-12T10:01:48.000Z",
isActive: true,
issueDate: "2024-03-12T10:01:48.000Z", issueDate: "2024-03-12T10:01:48.000Z",
certificateNo: "string", certificateNo: "string",
certificateType: "string", certificateType: "string",
@ -75,7 +74,6 @@ export class ProfileCertificateController extends Controller {
createdFullName: "string", createdFullName: "string",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
expireDate: "2024-03-12T10:03:05.000Z", expireDate: "2024-03-12T10:03:05.000Z",
isActive: true,
issueDate: "2024-03-12T10:03:05.000Z", issueDate: "2024-03-12T10:03:05.000Z",
certificateNo: "no", certificateNo: "no",
certificateType: "type", certificateType: "type",
@ -91,7 +89,6 @@ export class ProfileCertificateController extends Controller {
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
expireDate: "2024-03-12T10:01:48.000Z", expireDate: "2024-03-12T10:01:48.000Z",
isActive: true,
issueDate: "2024-03-12T10:01:48.000Z", issueDate: "2024-03-12T10:01:48.000Z",
certificateNo: "string", certificateNo: "string",
certificateType: "string", certificateType: "string",

View file

@ -40,7 +40,6 @@ export class ProfileChangeNameController extends Controller {
result: [ result: [
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
prefix: "string", prefix: "string",
firstName: "string", firstName: "string",
lastName: "string", lastName: "string",
@ -51,7 +50,7 @@ export class ProfileChangeNameController extends Controller {
public async getChangeName(@Path() profileId: string) { public async getChangeName(@Path() profileId: string) {
const lists = await this.changeNameRepository.find({ const lists = await this.changeNameRepository.find({
where: { profileId: profileId }, where: { profileId: profileId },
select: ["id", "isActive", "prefix", "firstName", "lastName", "status"], select: ["id", "prefix", "firstName", "lastName", "status"],
}); });
return new HttpSuccess(lists); return new HttpSuccess(lists);
} }
@ -63,7 +62,6 @@ export class ProfileChangeNameController extends Controller {
result: [ result: [
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
prefix: "string", prefix: "string",
firstName: "string", firstName: "string",
lastName: "string", lastName: "string",
@ -73,7 +71,6 @@ export class ProfileChangeNameController extends Controller {
}, },
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
prefix: "string", prefix: "string",
firstName: "string", firstName: "string",
lastName: "string", lastName: "string",
@ -86,16 +83,7 @@ export class ProfileChangeNameController extends Controller {
public async changeNameHistory(@Path() changeNameId: string) { public async changeNameHistory(@Path() changeNameId: string) {
const record = await this.changeNameHistoryRepository.find({ const record = await this.changeNameHistoryRepository.find({
where: { profileChangeNameId: changeNameId }, where: { profileChangeNameId: changeNameId },
select: [ select: ["id", "prefix", "firstName", "lastName", "status", "createdFullName", "createdAt"],
"id",
"isActive",
"prefix",
"firstName",
"lastName",
"status",
"createdFullName",
"createdAt",
],
order: { createdAt: "DESC" }, order: { createdAt: "DESC" },
}); });
return new HttpSuccess(record); return new HttpSuccess(record);

View file

@ -40,7 +40,6 @@ export class ProfileDisciplineController extends Controller {
result: [ result: [
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
date: "2024-03-12T10:09:47.000Z", date: "2024-03-12T10:09:47.000Z",
level: "string", level: "string",
detail: "string", detail: "string",
@ -53,16 +52,7 @@ export class ProfileDisciplineController extends Controller {
public async getDiscipline(@Path() profileId: string) { public async getDiscipline(@Path() profileId: string) {
const lists = await this.disciplineRepository.find({ const lists = await this.disciplineRepository.find({
where: { profileId: profileId }, where: { profileId: profileId },
select: [ select: ["id", "date", "level", "detail", "unStigma", "refCommandNo", "refCommandDate"],
"id",
"isActive",
"date",
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
],
}); });
return new HttpSuccess(lists); return new HttpSuccess(lists);
} }
@ -74,7 +64,6 @@ export class ProfileDisciplineController extends Controller {
result: [ result: [
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
date: "2024-03-12T10:09:47.000Z", date: "2024-03-12T10:09:47.000Z",
level: "string", level: "string",
detail: "string", detail: "string",
@ -84,7 +73,6 @@ export class ProfileDisciplineController extends Controller {
}, },
{ {
id: "ba0e2f82-014e-46c6-8b82-a7c28eb5325f", id: "ba0e2f82-014e-46c6-8b82-a7c28eb5325f",
isActive: true,
date: "2024-03-12T10:09:47.000Z", date: "2024-03-12T10:09:47.000Z",
level: "string", level: "string",
detail: "string", detail: "string",
@ -97,17 +85,8 @@ export class ProfileDisciplineController extends Controller {
public async disciplineHistory(@Path() disciplineId: string) { public async disciplineHistory(@Path() disciplineId: string) {
const record = await this.disciplineHistoryRepository.find({ const record = await this.disciplineHistoryRepository.find({
where: { profileDisciplineId: disciplineId }, where: { profileDisciplineId: disciplineId },
select: [ select: ["id", "date", "level", "detail", "unStigma", "refCommandNo", "refCommandDate"],
"id", order: { createdAt: "DESC" },
"isActive",
"date",
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
],
order: { createdAt: "DESC" }
}); });
return new HttpSuccess(record); return new HttpSuccess(record);
} }

View file

@ -36,7 +36,6 @@ export class ProfileDutyController extends Controller {
result: [ result: [
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
dateStart: "2024-03-12T10:09:47.000Z", dateStart: "2024-03-12T10:09:47.000Z",
dateEnd: "string", dateEnd: "string",
reference: "string", reference: "string",
@ -51,7 +50,6 @@ export class ProfileDutyController extends Controller {
where: { profileId: profileId }, where: { profileId: profileId },
select: [ select: [
"id", "id",
"isActive",
"dateStart", "dateStart",
"dateEnd", "dateEnd",
"reference", "reference",
@ -70,7 +68,6 @@ export class ProfileDutyController extends Controller {
result: [ result: [
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
dateStart: "2024-03-12T10:09:47.000Z", dateStart: "2024-03-12T10:09:47.000Z",
dateEnd: "string", dateEnd: "string",
reference: "string", reference: "string",
@ -80,7 +77,6 @@ export class ProfileDutyController extends Controller {
}, },
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
dateStart: "2024-03-12T10:09:47.000Z", dateStart: "2024-03-12T10:09:47.000Z",
dateEnd: "string", dateEnd: "string",
reference: "string", reference: "string",
@ -95,7 +91,6 @@ export class ProfileDutyController extends Controller {
where: { profileDutyId: dutyId }, where: { profileDutyId: dutyId },
select: [ select: [
"id", "id",
"isActive",
"dateStart", "dateStart",
"dateEnd", "dateEnd",
"reference", "reference",

View file

@ -48,7 +48,6 @@ export class ProfileFamilyHistoryController extends Controller {
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
couple: true, couple: true,
couplePrefix: "string", couplePrefix: "string",
coupleFirstName: "string", coupleFirstName: "string",
@ -79,7 +78,6 @@ export class ProfileFamilyHistoryController extends Controller {
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
childrenCareer: "string", childrenCareer: "string",
childrenFirstName: "string", childrenFirstName: "string",
childrenLastName: "string", childrenLastName: "string",
@ -124,7 +122,6 @@ export class ProfileFamilyHistoryController extends Controller {
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
couple: true, couple: true,
couplePrefix: "string", couplePrefix: "string",
coupleFirstName: "string", coupleFirstName: "string",
@ -155,7 +152,6 @@ export class ProfileFamilyHistoryController extends Controller {
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: false,
childrenCareer: "hey", childrenCareer: "hey",
childrenFirstName: "hey", childrenFirstName: "hey",
childrenLastName: "hey", childrenLastName: "hey",
@ -174,7 +170,6 @@ export class ProfileFamilyHistoryController extends Controller {
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: false,
childrenCareer: "ay", childrenCareer: "ay",
childrenFirstName: "ay", childrenFirstName: "ay",
childrenLastName: "ay", childrenLastName: "ay",
@ -195,7 +190,6 @@ export class ProfileFamilyHistoryController extends Controller {
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
couple: true, couple: true,
couplePrefix: "string", couplePrefix: "string",
coupleFirstName: "string", coupleFirstName: "string",

View file

@ -43,7 +43,6 @@ export class ProfileHonorController extends Controller {
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
isActive: true,
detail: "string", detail: "string",
issueDate: "2024-03-12T10:09:47.000Z", issueDate: "2024-03-12T10:09:47.000Z",
issuer: "string", issuer: "string",
@ -71,7 +70,6 @@ export class ProfileHonorController extends Controller {
lastUpdateUserId: "00000000-0000-0000-0000-000000000000", lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
createdFullName: "string", createdFullName: "string",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
detail: "detail", detail: "detail",
issueDate: "2024-03-12T10:10:31.000Z", issueDate: "2024-03-12T10:10:31.000Z",
issuer: "issuer", issuer: "issuer",
@ -88,7 +86,6 @@ export class ProfileHonorController extends Controller {
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
detail: "string", detail: "string",
issueDate: "2024-03-12T10:09:47.000Z", issueDate: "2024-03-12T10:09:47.000Z",
issuer: "string", issuer: "string",

View file

@ -47,7 +47,6 @@ export class ProfileInsigniaController extends Controller {
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
isActive: true,
year: 0, year: 0,
no: "string", no: "string",
volume: "string", volume: "string",
@ -90,7 +89,6 @@ export class ProfileInsigniaController extends Controller {
lastUpdateUserId: "00000000-0000-0000-0000-000000000000", lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
createdFullName: "string", createdFullName: "string",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
year: 0, year: 0,
no: "no", no: "no",
volume: "volume", volume: "volume",
@ -115,7 +113,6 @@ export class ProfileInsigniaController extends Controller {
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
year: 0, year: 0,
no: "string", no: "string",
volume: "string", volume: "string",

View file

@ -13,11 +13,16 @@ import {
Tags, Tags,
} from "tsoa"; } from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import { CreateProfileLeave, ProfileLeave, UpdateProfileLeave } from "../entities/ProfileLeave"; import {
ProfileLeaveHistory,
CreateProfileLeave,
ProfileLeave,
UpdateProfileLeave,
} from "../entities/ProfileLeave";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { ProfileLeaveHistory } from "../entities/ProfileLeaveHistory";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import { Profile } from "../entities/Profile"; import { Profile } from "../entities/Profile";
@ -33,10 +38,41 @@ export class ProfileLeaveController extends Controller {
@Example({ @Example({
status: 200, status: 200,
message: "สำเร็จ", message: "สำเร็จ",
result: [], result: {
id: "adbb08a6-d2f4-41b0-a9c1-49e883ca96bc",
createdAt: "2024-03-20T23:35:45.230Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-20T23:40:06.000Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
leaveTypeId: "8dc5e672-b416-4323-b086-06dde8c4353c",
dateLeave: "2024-03-21T06:39:46.000Z",
leaveDays: 0,
leaveCount: null,
totalLeave: 0,
status: "string",
reason: "string",
leaveType: {
id: "8dc5e672-b416-4323-b086-06dde8c4353c",
createdAt: "2024-02-04T21:28:40.536Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-02-04T21:28:40.536Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
name: "ลาป่วย",
code: "CM-002",
limit: 1,
},
},
}) })
public async getLeave(@Path() profileId: string) { public async getLeave(@Path() profileId: string) {
const record = await this.leaveRepo.findBy({ profileId }); const record = await this.leaveRepo.findOne({
relations: { leaveType: true },
where: { profileId },
});
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@ -44,11 +80,73 @@ export class ProfileLeaveController extends Controller {
@Example({ @Example({
status: 200, status: 200,
message: "สำเร็จ", message: "สำเร็จ",
result: [], result: [
{
id: "7eed2e72-d71c-4b3b-a90b-e1b7abdaa838",
createdAt: "2024-03-20T23:35:45.230Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-20T23:40:06.000Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
leaveTypeId: "8dc5e672-b416-4323-b086-06dde8c4353c",
dateLeave: "2024-03-21T06:39:46.000Z",
leaveDays: 0,
leaveCount: null,
totalLeave: 0,
status: "string",
reason: "string",
leaveType: {
id: "8dc5e672-b416-4323-b086-06dde8c4353c",
createdAt: "2024-02-04T21:28:40.536Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-02-04T21:28:40.536Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
name: "ลาป่วย",
code: "CM-002",
limit: 1,
},
profileLeaveId: "adbb08a6-d2f4-41b0-a9c1-49e883ca96bc",
},
{
id: "b1b9c291-9c96-4cbb-9309-6ff5a2a6e0e8",
createdAt: "2024-03-20T23:35:45.230Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-20T23:35:45.230Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
leaveTypeId: "7dc4e314-b456-4323-b086-06dde8c4353c",
dateLeave: "2024-03-21T06:34:49.000Z",
leaveDays: 2,
leaveCount: null,
totalLeave: 200,
status: "ไม่ผ่าน",
reason: "ติดงานสำคัญ",
leaveType: {
id: "7dc4e314-b456-4323-b086-06dde8c4353c",
createdAt: "2024-02-04T21:28:40.536Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-02-04T21:28:40.536Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
name: "ลาพักร้อน",
code: "CM-001",
limit: 356,
},
profileLeaveId: "adbb08a6-d2f4-41b0-a9c1-49e883ca96bc",
},
],
}) })
public async leaveHistory(@Path() leaveId: string) { public async leaveHistory(@Path() leaveId: string) {
const record = await this.leaveHistoryRepo.findBy({ const record = await this.leaveHistoryRepo.find({
profileLeaveId: leaveId, relations: { leaveType: true },
where: { profileLeaveId: leaveId },
}); });
return new HttpSuccess(record); return new HttpSuccess(record);
} }

View file

@ -36,7 +36,6 @@ export class ProfileNopaidController extends Controller {
result: [ result: [
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
date: "2024-03-12T10:09:47.000Z", date: "2024-03-12T10:09:47.000Z",
reference: "string", reference: "string",
detail: "string", detail: "string",
@ -59,7 +58,6 @@ export class ProfileNopaidController extends Controller {
result: [ result: [
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
date: "2024-03-12T10:09:47.000Z", date: "2024-03-12T10:09:47.000Z",
reference: "string", reference: "string",
detail: "string", detail: "string",
@ -68,7 +66,6 @@ export class ProfileNopaidController extends Controller {
}, },
{ {
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
isActive: true,
date: "2024-03-12T10:09:47.000Z", date: "2024-03-12T10:09:47.000Z",
reference: "string", reference: "string",
detail: "string", detail: "string",

44
src/entities/LeaveType.ts Normal file
View file

@ -0,0 +1,44 @@
import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { ProfileLeave } from "./ProfileLeave";
@Entity("leaveType")
export class LeaveType extends EntityBase {
@Column({
nullable: true,
comment: "ประเภทการลา",
length: 255,
default: null,
})
name: string;
@Column({
nullable: true,
comment: "รหัสประเภอการลา",
default: null,
})
code: string;
@Column({
nullable: true,
comment: "ลาได้สูงสุด(วัน)",
default: true,
})
limit: number;
@OneToMany(() => ProfileLeave, (v) => v.leaveType)
profileLeave: ProfileLeave;
}
export class CreateLeaveType {
name: string | null;
code: string | null;
limit: number | null;
}
export type UpdateLeaveType = {
name?: string | null;
code?: string | null;
limit?: number | null;
};

View file

@ -13,12 +13,6 @@ export class ProfileAbility extends EntityBase {
}) })
profileId: string; profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
comment: "หมายเหตุ", comment: "หมายเหตุ",
@ -80,7 +74,6 @@ export class ProfileAbility extends EntityBase {
export class CreateProfileAbility { export class CreateProfileAbility {
profileId: string | null; profileId: string | null;
isActive: boolean;
remark: string | null; remark: string | null;
detail: string | null; detail: string | null;
reference: string | null; reference: string | null;
@ -90,7 +83,6 @@ export class CreateProfileAbility {
} }
export type UpdateProfileAbility = { export type UpdateProfileAbility = {
isActive?: boolean;
remark?: string | null; remark?: string | null;
detail?: string | null; detail?: string | null;
reference?: string | null; reference?: string | null;

View file

@ -5,12 +5,6 @@ import { ProfileAbility } from "./ProfileAbility";
@Entity("profileAbilityHistory") @Entity("profileAbilityHistory")
export class ProfileAbilityHistory extends EntityBase { export class ProfileAbilityHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
comment: "หมายเหตุ", comment: "หมายเหตุ",

View file

@ -21,12 +21,6 @@ export class ProfileCertificate extends EntityBase {
}) })
expireDate: Date; expireDate: Date;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
type: "datetime", type: "datetime",
@ -34,7 +28,7 @@ export class ProfileCertificate extends EntityBase {
default: null, default: null,
}) })
issueDate: Date; issueDate: Date;
@Column({ @Column({
nullable: true, nullable: true,
comment: "เลขที่ใบอนุญาต", comment: "เลขที่ใบอนุญาต",
@ -50,7 +44,7 @@ export class ProfileCertificate extends EntityBase {
default: null, default: null,
}) })
certificateType: string; certificateType: string;
@Column({ @Column({
nullable: true, nullable: true,
comment: "หน่วยงานผู้ออกใบอนุญาต", comment: "หน่วยงานผู้ออกใบอนุญาต",
@ -59,19 +53,20 @@ export class ProfileCertificate extends EntityBase {
}) })
issuer: string; issuer: string;
@OneToMany(() => ProfileCertificateHistory, (profileCertificateHistory) => profileCertificateHistory.histories) @OneToMany(
() => ProfileCertificateHistory,
(profileCertificateHistory) => profileCertificateHistory.histories,
)
profileCertificateHistories: ProfileCertificateHistory[]; profileCertificateHistories: ProfileCertificateHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileCertificates) @ManyToOne(() => Profile, (profile) => profile.profileCertificates)
@JoinColumn({ name: "profileId" }) @JoinColumn({ name: "profileId" })
profile: Profile; profile: Profile;
} }
export class CreateProfileCertificate { export class CreateProfileCertificate {
profileId: string | null; profileId: string | null;
expireDate: Date | null; expireDate: Date | null;
isActive: boolean;
issueDate: Date | null; issueDate: Date | null;
certificateNo: string | null; certificateNo: string | null;
certificateType: string | null; certificateType: string | null;
@ -80,7 +75,6 @@ export class CreateProfileCertificate {
export type UpdateProfileCertificate = { export type UpdateProfileCertificate = {
expireDate?: Date | null; expireDate?: Date | null;
isActive?: boolean;
issueDate?: Date | null; issueDate?: Date | null;
certificateNo?: string | null; certificateNo?: string | null;
certificateType?: string | null; certificateType?: string | null;

View file

@ -5,7 +5,6 @@ import { ProfileCertificate } from "./ProfileCertificate";
@Entity("profileCertificateHistory") @Entity("profileCertificateHistory")
export class ProfileCertificateHistory extends EntityBase { export class ProfileCertificateHistory extends EntityBase {
@Column({ @Column({
nullable: true, nullable: true,
type: "datetime", type: "datetime",
@ -14,12 +13,6 @@ export class ProfileCertificateHistory extends EntityBase {
}) })
expireDate: Date; expireDate: Date;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
type: "datetime", type: "datetime",
@ -27,7 +20,7 @@ export class ProfileCertificateHistory extends EntityBase {
default: null, default: null,
}) })
issueDate: Date; issueDate: Date;
@Column({ @Column({
nullable: true, nullable: true,
comment: "เลขที่ใบอนุญาต", comment: "เลขที่ใบอนุญาต",
@ -43,7 +36,7 @@ export class ProfileCertificateHistory extends EntityBase {
default: null, default: null,
}) })
certificateType: string; certificateType: string;
@Column({ @Column({
nullable: true, nullable: true,
comment: "หน่วยงานผู้ออกใบอนุญาต", comment: "หน่วยงานผู้ออกใบอนุญาต",
@ -60,35 +53,32 @@ export class ProfileCertificateHistory extends EntityBase {
}) })
profileCertificateId: string; profileCertificateId: string;
@ManyToOne(() => ProfileCertificate, (profileCertificate) => profileCertificate.profileCertificateHistories) @ManyToOne(
() => ProfileCertificate,
(profileCertificate) => profileCertificate.profileCertificateHistories,
)
@JoinColumn({ name: "profileCertificateId" }) @JoinColumn({ name: "profileCertificateId" })
histories: ProfileCertificate; histories: ProfileCertificate;
} }
export class CreateProfileCertificateHistory { export class CreateProfileCertificateHistory {
@Column() @Column()
expireDate: Date | null; expireDate: Date | null;
@Column()
isActive: boolean;
@Column() @Column()
issueDate: Date | null; issueDate: Date | null;
@Column() @Column()
certificateNo: string | null; certificateNo: string | null;
@Column() @Column()
certificateType: string | null; certificateType: string | null;
@Column() @Column()
issuer: string | null; issuer: string | null;
@Column("uuid") @Column("uuid")
profileCertificateId: string | null; profileCertificateId: string | null;
} }
export type UpdateProfileCertificateHistory = Partial<CreateProfileCertificateHistory>; export type UpdateProfileCertificateHistory = Partial<CreateProfileCertificateHistory>;

View file

@ -14,12 +14,6 @@ export class ProfileChangeName extends EntityBase {
}) })
profileId: string; profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
length: 40, length: 40,
@ -68,17 +62,19 @@ export class ProfileChangeName extends EntityBase {
}) })
documentId: string; documentId: string;
@OneToMany(() => ProfileChangeNameHistory, (profileChangeNameHistory) => profileChangeNameHistory.histories) @OneToMany(
profileChangeNameHistories: ProfileChangeNameHistory[]; () => ProfileChangeNameHistory,
(profileChangeNameHistory) => profileChangeNameHistory.histories,
)
profileChangeNameHistories: ProfileChangeNameHistory[];
// @ManyToOne(() => Profile, (profile) => profile.profileChangeName) // @ManyToOne(() => Profile, (profile) => profile.profileChangeName)
// @JoinColumn({ name: "profileId" }) // @JoinColumn({ name: "profileId" })
// profile: Profile; // profile: Profile;
} }
export class CreateProfileChangeName { export class CreateProfileChangeName {
profileId: string | null; profileId: string | null;
isActive: boolean;
prefixId: string | null; prefixId: string | null;
prefix: string | null; prefix: string | null;
firstName: string | null; firstName: string | null;
@ -88,7 +84,6 @@ export class CreateProfileChangeName {
} }
export type UpdateProfileChangeName = { export type UpdateProfileChangeName = {
isActive?: boolean;
prefixId?: string | null; prefixId?: string | null;
prefix?: string | null; prefix?: string | null;
firstName?: string | null; firstName?: string | null;

View file

@ -5,13 +5,6 @@ import { ProfileChangeName } from "./ProfileChangeName";
@Entity("profileChangeNameHistory") @Entity("profileChangeNameHistory")
export class ProfileChangeNameHistory extends EntityBase { export class ProfileChangeNameHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
length: 40, length: 40,
@ -68,15 +61,16 @@ export class ProfileChangeNameHistory extends EntityBase {
}) })
profileChangeNameId: string; profileChangeNameId: string;
@ManyToOne(() => ProfileChangeName, (profileChangeName) => profileChangeName.profileChangeNameHistories) @ManyToOne(
() => ProfileChangeName,
(profileChangeName) => profileChangeName.profileChangeNameHistories,
)
@JoinColumn({ name: "profileChangeNameId" }) @JoinColumn({ name: "profileChangeNameId" })
histories: ProfileChangeName; histories: ProfileChangeName;
} }
export class CreateProfileChangeNameHistory { export class CreateProfileChangeNameHistory {
profileChangeNameId: string | null; profileChangeNameId: string | null;
isActive: boolean;
prefixId: string | null; prefixId: string | null;
prefix: string | null; prefix: string | null;
firstName: string | null; firstName: string | null;
@ -87,7 +81,6 @@ export class CreateProfileChangeNameHistory {
export type UpdateProfileChangeNameHistory = { export type UpdateProfileChangeNameHistory = {
profileChangeNameId?: string | null; profileChangeNameId?: string | null;
isActive?: boolean;
prefixId?: string | null; prefixId?: string | null;
prefix?: string | null; prefix?: string | null;
firstName?: string | null; firstName?: string | null;

View file

@ -20,12 +20,6 @@ export class ProfileDiscipline extends EntityBase {
}) })
profileId: string; profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
comment: "ระดับความผิด", comment: "ระดับความผิด",
@ -80,7 +74,7 @@ export class ProfileDiscipline extends EntityBase {
export class CreateProfileDiscipline { export class CreateProfileDiscipline {
date: Date | null; date: Date | null;
profileId: string; profileId: string;
isActive: boolean | null;
level: string | null; level: string | null;
detail: string | null; detail: string | null;
refCommandDate: Date | null; refCommandDate: Date | null;
@ -90,7 +84,7 @@ export class CreateProfileDiscipline {
export type UpdateProfileDiscipline = { export type UpdateProfileDiscipline = {
date?: Date | null; date?: Date | null;
isActive?: boolean | null;
level?: string | null; level?: string | null;
detail?: string | null; detail?: string | null;
refCommandDate?: Date | null; refCommandDate?: Date | null;

View file

@ -20,12 +20,6 @@ export class ProfileDisciplineHistory extends EntityBase {
}) })
profileDisciplineId: string; profileDisciplineId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
comment: "ระดับความผิด", comment: "ระดับความผิด",
@ -41,7 +35,7 @@ export class ProfileDisciplineHistory extends EntityBase {
default: null, default: null,
}) })
detail: string; detail: string;
@Column({ @Column({
nullable: true, nullable: true,
type: "datetime", type: "datetime",
@ -66,7 +60,10 @@ export class ProfileDisciplineHistory extends EntityBase {
}) })
unStigma: string; unStigma: string;
@ManyToOne(() => ProfileDiscipline, (profileDiscipline) => profileDiscipline.profileDisciplineHistories) @ManyToOne(
() => ProfileDiscipline,
(profileDiscipline) => profileDiscipline.profileDisciplineHistories,
)
@JoinColumn({ name: "profileDisciplineId" }) @JoinColumn({ name: "profileDisciplineId" })
histories: ProfileDiscipline; histories: ProfileDiscipline;
} }

View file

@ -13,12 +13,6 @@ export class ProfileDuty extends EntityBase {
}) })
profileId: string; profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
type: "datetime", type: "datetime",
@ -77,7 +71,7 @@ export class ProfileDuty extends EntityBase {
export class CreateProfileDuty { export class CreateProfileDuty {
profileId: string | null; profileId: string | null;
isActive: boolean;
dateStart: Date | null; dateStart: Date | null;
dateEnd: Date | null; dateEnd: Date | null;
detail: string | null; detail: string | null;
@ -87,7 +81,6 @@ export class CreateProfileDuty {
} }
export type UpdateProfileDuty = { export type UpdateProfileDuty = {
isActive?: boolean;
dateStart?: Date | null; dateStart?: Date | null;
dateEnd?: Date | null; dateEnd?: Date | null;
detail?: string | null; detail?: string | null;

View file

@ -5,12 +5,6 @@ import { ProfileDuty } from "./ProfileDuty";
@Entity("profileDutyHistory") @Entity("profileDutyHistory")
export class ProfileDutyHistory extends EntityBase { export class ProfileDutyHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
type: "datetime", type: "datetime",

View file

@ -13,12 +13,6 @@ export class ProfileEducation extends EntityBase {
}) })
profileId: string; profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
comment: "ประเทศ", comment: "ประเทศ",
@ -178,7 +172,7 @@ export class ProfileEducation extends EntityBase {
export class CreateProfileEducation { export class CreateProfileEducation {
profileId: string | null; profileId: string | null;
isActive: boolean;
country: string | null; country: string | null;
degree: string | null; degree: string | null;
duration: string | null; duration: string | null;
@ -201,7 +195,6 @@ export class CreateProfileEducation {
} }
export type UpdateProfileEducation = { export type UpdateProfileEducation = {
isActive?: boolean;
country?: string | null; country?: string | null;
degree?: string | null; degree?: string | null;
duration?: string | null; duration?: string | null;

View file

@ -5,12 +5,6 @@ import { ProfileEducation } from "./ProfileEducation";
@Entity("profileEducationHistory") @Entity("profileEducationHistory")
export class ProfileEducationHistory extends EntityBase { export class ProfileEducationHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
comment: "ประเทศ", comment: "ประเทศ",
@ -174,9 +168,6 @@ export class ProfileEducationHistory extends EntityBase {
} }
export class CreateProfileEducationHistory { export class CreateProfileEducationHistory {
@Column()
isActive: boolean;
@Column() @Column()
country: string | null; country: string | null;

View file

@ -4,12 +4,6 @@ import { Profile } from "./Profile";
@Entity("profileFamilyHistory") @Entity("profileFamilyHistory")
export class ProfileFamilyHistory extends EntityBase { export class ProfileFamilyHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
default: null, default: null,
@ -170,12 +164,6 @@ export class ProfileFamilyHistory extends EntityBase {
@Entity("profileChildren") @Entity("profileChildren")
export class ProfileChildren extends EntityBase { export class ProfileChildren extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
default: null, default: null,
@ -262,7 +250,6 @@ export class ProfileChildrenHistory extends ProfileChildren {
} }
export type CreateChildren = { export type CreateChildren = {
isActive: boolean;
childrenCareer: string; childrenCareer: string;
childrenFirstName: string; childrenFirstName: string;
childrenLastName: string; childrenLastName: string;
@ -273,7 +260,6 @@ export type CreateChildren = {
export type UpdateChildren = { export type UpdateChildren = {
id: string; id: string;
isActive?: boolean | null;
childrenCareer?: string | null; childrenCareer?: string | null;
childrenFirstName?: string | null; childrenFirstName?: string | null;
childrenLastName?: string | null; childrenLastName?: string | null;
@ -283,7 +269,6 @@ export type UpdateChildren = {
}; };
export type CreateProfileFamily = { export type CreateProfileFamily = {
isActive: boolean | null;
couple: boolean | null; couple: boolean | null;
couplePrefix: string | null; couplePrefix: string | null;
coupleFirstName: string | null; coupleFirstName: string | null;
@ -310,7 +295,6 @@ export type CreateProfileFamily = {
export type UpdateProfileFamily = { export type UpdateProfileFamily = {
id: string; id: string;
isActive?: boolean | null;
couple?: boolean | null; couple?: boolean | null;
couplePrefix?: string | null; couplePrefix?: string | null;
coupleFirstName?: string | null; coupleFirstName?: string | null;

View file

@ -4,12 +4,6 @@ import { Profile } from "./Profile";
@Entity("profileGovernment") @Entity("profileGovernment")
export class ProfileGovernment extends EntityBase { export class ProfileGovernment extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
length: 40, length: 40,
@ -172,7 +166,6 @@ export class ProfileGovernment extends EntityBase {
positionEmployeePositionSide: string; positionEmployeePositionSide: string;
} }
export type CreateProfileGovernment = { export type CreateProfileGovernment = {
isActive: boolean | null;
positionId: string | null; positionId: string | null;
profileId: string | null; profileId: string | null;
profile: Profile | null; profile: Profile | null;
@ -199,7 +192,6 @@ export type CreateProfileGovernment = {
}; };
export type UpdateProfileGovernment = { export type UpdateProfileGovernment = {
isActive?: boolean | null;
positionId?: string | null; positionId?: string | null;
profile?: Profile | null; profile?: Profile | null;
posNoId?: string | null; posNoId?: string | null;

View file

@ -5,12 +5,6 @@ import { ProfileHonor } from "./ProfileHonor";
@Entity("profileHonorHistory") @Entity("profileHonorHistory")
export class ProfileHonorHistory extends EntityBase { export class ProfileHonorHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
length: 2000, length: 2000,
@ -72,9 +66,6 @@ export class ProfileHonorHistory extends EntityBase {
} }
export class CreateProfileHonorHistory { export class CreateProfileHonorHistory {
@Column()
isActive: boolean;
@Column() @Column()
detail: string | null; detail: string | null;

View file

@ -14,12 +14,6 @@ export class ProfileInsignia extends EntityBase {
}) })
profileId: string; profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
comment: "ปีที่ยื่นขอ", comment: "ปีที่ยื่นขอ",
}) })

View file

@ -5,12 +5,6 @@ import { Insignia } from "./Insignia";
@Entity("profileInsigniaHistory") @Entity("profileInsigniaHistory")
export class ProfileInsigniaHistory extends EntityBase { export class ProfileInsigniaHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ comment: "ปีที่ยื่นขอ" }) @Column({ comment: "ปีที่ยื่นขอ" })
year: number; year: number;

View file

@ -1,7 +1,7 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { Profile } from "./Profile"; import { Profile } from "./Profile";
import { ProfileLeaveHistory } from "./ProfileLeaveHistory"; import { LeaveType } from "./LeaveType";
@Entity("profileLeave") @Entity("profileLeave")
export class ProfileLeave extends EntityBase { export class ProfileLeave extends EntityBase {
@ -13,227 +13,37 @@ export class ProfileLeave extends EntityBase {
}) })
profileId: string; profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
type: "double", length: 40,
comment: "", comment: "คีย์นอก(FK)ของตาราง LeaveType",
default: null, default: null,
}) })
restCount: number; leaveTypeId: string;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
restDay: number;
@Column({
nullable: true,
type: "double",
comment: "ลาพักผ่อน (วัน)",
default: null,
})
sickCount: number;
@Column({
nullable: true,
type: "double",
comment: "ลาป่วย (วัน)",
default: null,
})
sickDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
otherDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
personalCount: number;
@Column({
nullable: true,
type: "double",
comment: "ลากิจส่วนตัว (วัน)",
default: null,
})
personalDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
studyCount: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
absentCount: number;
@Column({
nullable: true,
type: "double",
comment: "ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล (วัน)",
default: null,
})
absentDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
agencyCount: number;
@Column({
nullable: true,
type: "double",
comment: "ลาไปปฏิบัติงานในองค์การระหว่างประเทศ (วัน)",
default: null,
})
agencyDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
coupleCount: number;
@Column({
nullable: true,
type: "double",
comment: "ลาติดตามคู่สมรส (วัน)",
default: null,
})
coupleDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
lateCount: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
lateDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
maternityCount: number;
@Column({
nullable: true,
type: "double",
comment: "ลาคลอดบุตร (วัน)",
default: null,
})
maternityDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
militaryCount: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
militaryDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
ordainCount: number;
@Column({
nullable: true,
type: "double",
comment: "ลาอุปสมบทหรือการลาประกอบพิธีฮัจย์ฯ (วัน)",
default: null,
})
ordainDay: number;
@Column({
nullable: true,
type: "double",
comment: "",
default: null,
})
otherCount: number;
@Column({ @Column({
nullable: true, nullable: true,
type: "datetime", type: "datetime",
comment: "วัน เดือน ปี ที่เริ่มลา", comment: "วัน เดือน ปี ที่ลา",
default: null, default: null,
}) })
dateStartLeave: Date; dateLeave: Date;
@Column({
nullable: true,
type: "datetime",
comment: "วัน เดือน ปี ที่สิ้นสุดลา",
default: null,
})
dateEndLeave: Date;
@Column({ @Column({
nullable: true, nullable: true,
type: "double", type: "double",
comment: "ลาครั้งที่", comment: "จำนวนวันลา",
default: null, default: null,
}) })
numLeave: number; leaveDays: number;
@Column({ @Column({
nullable: true, nullable: true,
type: "double", type: "double",
comment: "ลามาล้ว", comment: "ลามาเเล้ว",
default: null, default: null,
}) })
sumLeave: number; leaveCount: number;
@Column({ @Column({
nullable: true, nullable: true,
@ -251,14 +61,6 @@ export class ProfileLeave extends EntityBase {
}) })
status: string; status: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง TypeLeave",
default: null,
})
typeLeaveId: string;
@Column({ @Column({
nullable: true, nullable: true,
comment: "เหตุผล", comment: "เหตุผล",
@ -267,81 +69,47 @@ export class ProfileLeave extends EntityBase {
}) })
reason: string; reason: string;
@OneToMany(() => ProfileLeaveHistory, (profileLeaveHistory) => profileLeaveHistory.histories) @OneToMany(() => ProfileLeaveHistory, (v) => v.profileLeave)
profileLeaves: ProfileLeaveHistory[]; histories: ProfileLeaveHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileLeaves) @ManyToOne(() => LeaveType, (v) => v.profileLeave)
@JoinColumn({ name: "profileId" }) leaveType: LeaveType;
@ManyToOne(() => Profile, (v) => v.profileLeaves)
profile: Profile; profile: Profile;
} }
@Entity("profileLeaveHistory")
export class ProfileLeaveHistory extends ProfileLeave {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileLeave",
default: null,
})
profileLeaveId: string;
@ManyToOne(() => ProfileLeave, (v) => v.histories)
profileLeave: ProfileLeave;
}
export class CreateProfileLeave { export class CreateProfileLeave {
profileId: string | null; profileId: string | null;
isActive: boolean; leaveTypeId: string | null;
restCount: number | null; dateLeave: Date | null;
restDay: number | null; leaveDays: number | null;
sickCount: number | null; leverCount: number | null;
sickDay: number | null;
otherDay: number | null;
personalCount: number | null;
personalDay: number | null;
studyCount: number | null;
absentCount: number | null;
absentDay: number | null;
agencyCount: number | null;
agencyDay: number | null;
coupleCount: number | null;
coupleDay: number | null;
lateCount: number | null;
lateDay: number | null;
maternityCount: number | null;
maternityDay: number | null;
militaryCount: number | null;
militaryDay: number | null;
ordainCount: number | null;
ordainDay: number | null;
otherCount: number | null;
dateStartLeave: Date | null;
dateEndLeave: Date | null;
numLeave: number | null;
sumLeave: number | null;
totalLeave: number | null; totalLeave: number | null;
status: string | null; status: string | null;
typeLeaveId: string | null;
reason: string | null; reason: string | null;
} }
export type UpdateProfileLeave = { export type UpdateProfileLeave = {
isActive?: boolean; leaveTypeId?: string | null;
restCount?: number | null; dateLeave?: Date | null;
restDay?: number | null; leaveDays?: number | null;
sickCount?: number | null; leverCount?: number | null;
sickDay?: number | null;
otherDay?: number | null;
personalCount?: number | null;
personalDay?: number | null;
studyCount?: number | null;
absentCount?: number | null;
absentDay?: number | null;
agencyCount?: number | null;
agencyDay?: number | null;
coupleCount?: number | null;
coupleDay?: number | null;
lateCount?: number | null;
lateDay?: number | null;
maternityCount?: number | null;
maternityDay?: number | null;
militaryCount?: number | null;
militaryDay?: number | null;
ordainCount?: number | null;
ordainDay?: number | null;
otherCount?: number | null;
dateStartLeave?: Date | null;
dateEndLeave?: Date | null;
numLeave?: number | null;
sumLeave?: number | null;
totalLeave?: number | null; totalLeave?: number | null;
status?: string | null; status?: string | null;
typeLeaveId?: string | null;
reason?: string | null; reason?: string | null;
}; };

View file

@ -1,376 +0,0 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileLeave } from "./ProfileLeave";
@Entity("profileLeaveHistory")
export class ProfileLeaveHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// restCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// restDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "ลาพักผ่อน (วัน)",
// default: null,
// })
// sickCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "ลาป่วย (วัน)",
// default: null,
// })
// sickDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// otherDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// personalCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "ลากิจส่วนตัว (วัน)",
// default: null,
// })
// personalDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// studyCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// absentCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล (วัน)",
// default: null,
// })
// absentDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// agencyCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "ลาไปปฏิบัติงานในองค์การระหว่างประเทศ (วัน)",
// default: null,
// })
// agencyDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// coupleCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "ลาติดตามคู่สมรส (วัน)",
// default: null,
// })
// coupleDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// lateCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// lateDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// maternityCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "ลาคลอดบุตร (วัน)",
// default: null,
// })
// maternityDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// militaryCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// militaryDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// ordainCount: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "ลาอุปสมบทหรือการลาประกอบพิธีฮัจย์ฯ (วัน)",
// default: null,
// })
// ordainDay: number;
// @Column({
// nullable: true,
// type: "double",
// comment: "",
// default: null,
// })
// otherCount: number;
@Column({
nullable: true,
type: "datetime",
comment: "วัน เดือน ปี ที่เริ่มลา",
default: null,
})
dateStartLeave: Date;
@Column({
nullable: true,
type: "datetime",
comment: "วัน เดือน ปี ที่สิ้นสุดลา",
default: null,
})
dateEndLeave: Date;
@Column({
nullable: true,
type: "double",
comment: "ลาครั้งที่",
default: null,
})
numLeave: number;
@Column({
nullable: true,
type: "double",
comment: "ลามาแล้ว",
default: null,
})
sumLeave: number;
@Column({
nullable: true,
type: "double",
comment: "รวมเป็น",
default: null,
})
totalLeave: number;
@Column({
nullable: true,
comment: "สถานะ",
type: "text",
default: null,
})
status: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง TypeLeave",
default: null,
})
typeLeaveId: string;
@Column({
nullable: true,
comment: "เหตุผล",
type: "text",
default: null,
})
reason: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileLeave",
default: null,
})
profileLeaveId: string;
@ManyToOne(() => ProfileLeave, (profileLeave) => profileLeave.profileLeaves)
@JoinColumn({ name: "profileLeaveId" })
histories: ProfileLeave;
}
export class CreateProfileLeaveHistory {
@Column()
isActive: boolean;
// @Column()
// restCount: number | null;
// @Column()
// restDay: number | null;
// @Column()
// sickCount: number | null;
// @Column()
// sickDay: number | null;
// @Column()
// otherDay: number | null;
// @Column()
// personalCount: number | null;
// @Column()
// personalDay: number | null;
// @Column()
// studyCount: number | null;
// @Column()
// absentCount: number | null;
// @Column()
// absentDay: number | null;
// @Column()
// agencyCount: number | null;
// @Column()
// agencyDay: number | null;
// @Column()
// coupleCount: number | null;
// @Column()
// coupleDay: number | null;
// @Column()
// lateCount: number | null;
// @Column()
// lateDay: number | null;
// @Column()
// maternityCount: number | null;
// @Column()
// maternityDay: number | null;
// @Column()
// militaryCount: number | null;
// @Column()
// militaryDay: number | null;
// @Column()
// ordainCount: number | null;
// @Column()
// ordainDay: number | null;
// @Column()
// otherCount: number | null;
@Column()
dateStartLeave: Date | null;
@Column()
dateEndLeave: Date | null;
@Column()
numLeave: number | null;
@Column()
sumLeave: number | null;
@Column()
totalLeave: number | null;
@Column()
status: string | null;
@Column("uuid")
typeLeaveId: string | null;
@Column()
reason: string | null;
@Column("uuid")
profileLeaveId: string | null;
}
export type UpdateProfileLeaveHistory = Partial<CreateProfileLeaveHistory>;

View file

@ -13,12 +13,6 @@ export class ProfileNopaid extends EntityBase {
}) })
profileId: string; profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
type: "datetime", type: "datetime",
@ -69,7 +63,7 @@ export class ProfileNopaid extends EntityBase {
export class CreateProfileNopaid { export class CreateProfileNopaid {
profileId: string | null; profileId: string | null;
isActive: boolean;
date: Date | null; date: Date | null;
detail: string | null; detail: string | null;
reference: string | null; reference: string | null;
@ -78,7 +72,6 @@ export class CreateProfileNopaid {
} }
export type UpdateProfileNopaid = { export type UpdateProfileNopaid = {
isActive?: boolean;
date?: Date | null; date?: Date | null;
detail?: string | null; detail?: string | null;
reference?: string | null; reference?: string | null;

View file

@ -5,12 +5,6 @@ import { ProfileNopaid } from "./ProfileNopaid";
@Entity("profileNopaidHistory") @Entity("profileNopaidHistory")
export class ProfileNopaidHistory extends EntityBase { export class ProfileNopaidHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({ @Column({
nullable: true, nullable: true,
type: "datetime", type: "datetime",