From 58a30a7c74e0357fa7b7d7c29e94bee1ec96c858 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Tue, 9 Apr 2024 11:38:13 +0700 Subject: [PATCH] set report development --- src/controllers/ReportController.ts | 127 ++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 src/controllers/ReportController.ts diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts new file mode 100644 index 0000000..f0b976d --- /dev/null +++ b/src/controllers/ReportController.ts @@ -0,0 +1,127 @@ +import { + Controller, + Get, + Post, + Put, + Delete, + Route, + Security, + Tags, + Body, + Path, + Request, + Query, +} from "tsoa"; +import { AppDataSource } from "../database/data-source"; +import { Brackets, Not } from "typeorm"; +import HttpSuccess from "../interfaces/http-success"; +import HttpError from "../interfaces/http-error"; +import HttpStatusCode from "../interfaces/http-status"; +import { Development } from "../entities/Development"; +import { + CreateDevelopmentHistory, + DevelopmentHistory, + UpdateDevelopmentHistory, +} from "../entities/DevelopmentHistory"; +import { PosType } from "../entities/PosType"; +import { PosLevel } from "../entities/PosLevel"; + +@Route("api/v1/development/report") +@Tags("Report") +@Security("bearerAuth") +export class ReportController extends Controller { + private developmentHistoryRepository = AppDataSource.getRepository(DevelopmentHistory); + private developmentRepository = AppDataSource.getRepository(Development); + private posTypeRepository = AppDataSource.getRepository(PosType); + private posLevelRepository = AppDataSource.getRepository(PosLevel); + + /** + * API Report รายการโครงการ/หลักสูตรการฝึกอบรมที่หน่วยงานของกรุงเทพมหานครเป็นผู้จัด + * + * @summary DEV_0xx - Report รายการโครงการ/หลักสูตรการฝึกอบรมที่หน่วยงานของกรุงเทพมหานครเป็นผู้จัด #xx + * + * @param {string} type type ประเภท report + */ + @Get("main/{type}") + async GetReportDevelopemtMain(@Path() type: string) { + const _type = type.trim().toUpperCase(); + const formattedData = { + org: _type, + }; + + return new HttpSuccess({ + template: "development", + reportName: "development", + data: { + data: formattedData, + }, + }); + } + + /** + * API Report รายการประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ + * + * @summary DEV_0xx - Report รายการประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ #xx + * + * @param {string} type type ประเภท report + */ + @Get("history-officer/{type}") + async GetReportDevelopemtHistoryOfficer(@Path() type: string) { + const _type = type.trim().toUpperCase(); + const formattedData = { + org: _type, + }; + + return new HttpSuccess({ + template: "development", + reportName: "development", + data: { + data: formattedData, + }, + }); + } + + /** + * API Report รายการประวัติฝึกอบรม/ดูงานลูกจ้าง + * + * @summary DEV_0xx - Report รายการประวัติฝึกอบรม/ดูงานลูกจ้าง #xx + * + * @param {string} type type ประเภท report + */ + @Get("history-employee/{type}") + async GetReportDevelopemtHistoryEmployee(@Path() type: string) { + const _type = type.trim().toUpperCase(); + const formattedData = { + org: _type, + }; + + return new HttpSuccess({ + template: "development", + reportName: "development", + data: { + data: formattedData, + }, + }); + } + + /** + * API Report รายการข้าราชการฯที่ได้รับทุนการศึกษา/ฝึกอบรม + * + * @summary DEV_0xx - Report รายการข้าราชการฯที่ได้รับทุนการศึกษา/ฝึกอบรม #xx + * + */ + @Get("scholarship") + async GetReportDevelopemtScholarship() { + const formattedData = { + org: "_type", + }; + + return new HttpSuccess({ + template: "development", + reportName: "development", + data: { + data: formattedData, + }, + }); + } +}