hrms-api-development/src/controllers/ReportController.ts

128 lines
4 KiB
TypeScript
Raw Normal View History

2024-04-09 11:38:13 +07:00
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,
},
});
}
}