Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2025-08-06 11:16:53 +07:00
commit 428df7d08a
63 changed files with 226 additions and 13741 deletions

View file

@ -10,6 +10,7 @@ import {
Route,
Security,
Tags,
Query
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
@ -25,6 +26,7 @@ import {
} from "../entities/ProfileDevelopment";
import permission from "../interfaces/permission";
import { DevelopmentProject } from "../entities/DevelopmentProject";
import { In, Brackets } from "typeorm";
@Route("api/v1/org/profile-employee/development")
@Tags("ProfileDevelopment")
@Security("bearerAuth")
@ -48,15 +50,60 @@ export class ProfileDevelopmentEmployeeController extends Controller {
}
@Get("{profileId}")
public async getDevelopment(@Path() profileId: string, @Request() req: RequestWithUser) {
public async getDevelopment(
@Path() profileId: string,
@Request() req: RequestWithUser,
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query() searchKeyword: string = "",
) {
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
const lists = await this.developmentRepository.find({
where: { profileEmployeeId: profileId },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
const [profileDevelopment, total] = await AppDataSource.getRepository(ProfileDevelopment)
.createQueryBuilder("profileDevelopment")
.where({ profileEmployeeId: profileId })
.andWhere(
new Brackets((qb) => {
qb.where(
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
? "profileDevelopment.name LIKE :keyword"
: "1=1",
{
keyword: `%${searchKeyword}%`,
},
)
.orWhere(
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
? "profileDevelopment.developmentTarget LIKE :keyword"
: "1=1",
{
keyword: `%${searchKeyword}%`,
},
)
.orWhere(
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
? "profileDevelopment.developmentResults LIKE :keyword"
: "1=1",
{
keyword: `%${searchKeyword}%`,
},
)
.orWhere(
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
? "profileDevelopment.developmentReport LIKE :keyword"
: "1=1",
{
keyword: `%${searchKeyword}%`,
},
);
}),
)
.orderBy("profileDevelopment.createdAt", "ASC")
.skip((page - 1) * pageSize)
.take(pageSize)
.getManyAndCount();
return new HttpSuccess({ data: profileDevelopment, total });
}
@Get("history/{developmentId}")