Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-01-26 09:57:03 +07:00
commit bea20bb46b
2 changed files with 0 additions and 516 deletions

View file

@ -1,279 +0,0 @@
/* tslint:disable */
/* eslint-disable */
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { Controller, ValidationService, FieldErrors, ValidateError, TsoaRoute, HttpStatusCodeLiteral, TsoaResponse, fetchMiddlewares } from '@tsoa/runtime';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { OrgRootController } from './controllers/OrgRootController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { AppController } from './controllers/MyController';
import { expressAuthentication } from './middlewares/auth';
// @ts-ignore - no great way to install types from subpackage
import type { RequestHandler, Router } from 'express';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
const models: TsoaRoute.Models = {
"OrgRootRank": {
"dataType": "refEnum",
"enums": ["department","office","division","section"],
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"CreateOrgRoot": {
"dataType": "refObject",
"properties": {
"orgRootName": {"dataType":"string","required":true},
"orgRootShortName": {"dataType":"string","required":true},
"orgRootCode": {"dataType":"string","required":true},
"orgRootRank": {"ref":"OrgRootRank","required":true},
"orgRootOrder": {"dataType":"double","required":true},
"orgRootPhoneEx": {"dataType":"string","required":true},
"orgRootPhoneIn": {"dataType":"string","required":true},
"orgRootFax": {"dataType":"string","required":true},
"orgRootIsNormal": {"dataType":"boolean","required":true},
},
"additionalProperties": false,
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
};
const validationService = new ValidationService(models);
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
export function RegisterRoutes(app: Router) {
// ###########################################################################################################
// NOTE: If you do not see routes for all of your controllers in this file, then you might not have informed tsoa of where to look
// Please look into the "controllerPathGlobs" config option described in the readme: https://github.com/lukeautry/tsoa
// ###########################################################################################################
app.post('/organization/root',
...(fetchMiddlewares<RequestHandler>(OrgRootController)),
...(fetchMiddlewares<RequestHandler>(OrgRootController.prototype.create)),
function OrgRootController_create(request: any, response: any, next: any) {
const args = {
requestBody: {"in":"body","name":"requestBody","required":true,"ref":"CreateOrgRoot"},
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
let validatedArgs: any[] = [];
try {
validatedArgs = getValidatedArgs(args, request, response);
const controller = new OrgRootController();
const promise = controller.create.apply(controller, validatedArgs as any);
promiseHandler(controller, promise, response, undefined, next);
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.put('/organization/root/:id',
...(fetchMiddlewares<RequestHandler>(OrgRootController)),
...(fetchMiddlewares<RequestHandler>(OrgRootController.prototype.update)),
function OrgRootController_update(request: any, response: any, next: any) {
const args = {
id: {"in":"path","name":"id","required":true,"dataType":"string"},
requestBody: {"in":"body","name":"requestBody","required":true,"ref":"CreateOrgRoot"},
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
let validatedArgs: any[] = [];
try {
validatedArgs = getValidatedArgs(args, request, response);
const controller = new OrgRootController();
const promise = controller.update.apply(controller, validatedArgs as any);
promiseHandler(controller, promise, response, undefined, next);
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.get('/hello',
authenticateMiddleware([{"bearerAuth":[]}]),
...(fetchMiddlewares<RequestHandler>(AppController)),
...(fetchMiddlewares<RequestHandler>(AppController.prototype.GET)),
function AppController_GET(request: any, response: any, next: any) {
const args = {
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
let validatedArgs: any[] = [];
try {
validatedArgs = getValidatedArgs(args, request, response);
const controller = new AppController();
const promise = controller.GET.apply(controller, validatedArgs as any);
promiseHandler(controller, promise, response, undefined, next);
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
function authenticateMiddleware(security: TsoaRoute.Security[] = []) {
return async function runAuthenticationMiddleware(request: any, _response: any, next: any) {
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
// keep track of failed auth attempts so we can hand back the most
// recent one. This behavior was previously existing so preserving it
// here
const failedAttempts: any[] = [];
const pushAndRethrow = (error: any) => {
failedAttempts.push(error);
throw error;
};
const secMethodOrPromises: Promise<any>[] = [];
for (const secMethod of security) {
if (Object.keys(secMethod).length > 1) {
const secMethodAndPromises: Promise<any>[] = [];
for (const name in secMethod) {
secMethodAndPromises.push(
expressAuthentication(request, name, secMethod[name])
.catch(pushAndRethrow)
);
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
secMethodOrPromises.push(Promise.all(secMethodAndPromises)
.then(users => { return users[0]; }));
} else {
for (const name in secMethod) {
secMethodOrPromises.push(
expressAuthentication(request, name, secMethod[name])
.catch(pushAndRethrow)
);
}
}
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
try {
request['user'] = await Promise.any(secMethodOrPromises);
next();
}
catch(err) {
// Show most recent error as response
const error = failedAttempts.pop();
error.status = error.status || 401;
next(error);
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
}
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
function isController(object: any): object is Controller {
return 'getHeaders' in object && 'getStatus' in object && 'setStatus' in object;
}
function promiseHandler(controllerObj: any, promise: any, response: any, successStatus: any, next: any) {
return Promise.resolve(promise)
.then((data: any) => {
let statusCode = successStatus;
let headers;
if (isController(controllerObj)) {
headers = controllerObj.getHeaders();
statusCode = controllerObj.getStatus() || statusCode;
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
returnHandler(response, statusCode, data, headers)
})
.catch((error: any) => next(error));
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
function returnHandler(response: any, statusCode?: number, data?: any, headers: any = {}) {
if (response.headersSent) {
return;
}
Object.keys(headers).forEach((name: string) => {
response.set(name, headers[name]);
});
if (data && typeof data.pipe === 'function' && data.readable && typeof data._read === 'function') {
response.status(statusCode || 200)
data.pipe(response);
} else if (data !== null && data !== undefined) {
response.status(statusCode || 200).json(data);
} else {
response.status(statusCode || 204).end();
}
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
function responder(response: any): TsoaResponse<HttpStatusCodeLiteral, unknown> {
return function(status, data, headers) {
returnHandler(response, status, data, headers);
};
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
function getValidatedArgs(args: any, request: any, response: any): any[] {
const fieldErrors: FieldErrors = {};
const values = Object.keys(args).map((key) => {
const name = args[key].name;
switch (args[key].in) {
case 'request':
return request;
case 'query':
return validationService.ValidateParam(args[key], request.query[name], name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
case 'queries':
return validationService.ValidateParam(args[key], request.query, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
case 'path':
return validationService.ValidateParam(args[key], request.params[name], name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
case 'header':
return validationService.ValidateParam(args[key], request.header(name), name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
case 'body':
return validationService.ValidateParam(args[key], request.body, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
case 'body-prop':
return validationService.ValidateParam(args[key], request.body[name], name, fieldErrors, 'body.', {"noImplicitAdditionalProperties":"throw-on-extras"});
case 'formData':
if (args[key].dataType === 'file') {
return validationService.ValidateParam(args[key], request.file, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
} else if (args[key].dataType === 'array' && args[key].array.dataType === 'file') {
return validationService.ValidateParam(args[key], request.files, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
} else {
return validationService.ValidateParam(args[key], request.body[name], name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
}
case 'res':
return responder(response);
}
});
if (Object.keys(fieldErrors).length > 0) {
throw new ValidateError(fieldErrors, '');
}
return values;
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

View file

@ -1,237 +0,0 @@
{
"openapi": "3.0.0",
"components": {
"examples": {},
"headers": {},
"parameters": {},
"requestBodies": {},
"responses": {},
"schemas": {
"OrgRootRank": {
"enum": [
"department",
"office",
"division",
"section"
],
"type": "string"
},
"CreateOrgRoot": {
"properties": {
"orgRootName": {
"type": "string"
},
"orgRootShortName": {
"type": "string"
},
"orgRootCode": {
"type": "string"
},
"orgRootRank": {
"$ref": "#/components/schemas/OrgRootRank"
},
"orgRootOrder": {
"type": "number",
"format": "double"
},
"orgRootPhoneEx": {
"type": "string"
},
"orgRootPhoneIn": {
"type": "string"
},
"orgRootFax": {
"type": "string"
},
"orgRootIsNormal": {
"type": "boolean"
}
},
"required": [
"orgRootName",
"orgRootShortName",
"orgRootCode",
"orgRootRank",
"orgRootOrder",
"orgRootPhoneEx",
"orgRootPhoneIn",
"orgRootFax",
"orgRootIsNormal"
],
"type": "object",
"additionalProperties": false
}
},
"securitySchemes": {
"bearerAuth": {
"type": "apiKey",
"name": "Authorization",
"description": "Keycloak Bearer Token",
"in": "header"
}
}
},
"info": {
"title": "bma-ehr-organization - API",
"version": "0.0.1",
"description": "ระบบโครงสร้างอัตรากำลัง",
"license": {
"name": "by Frappet",
"url": "https://frappet.com"
}
},
"paths": {
"/organization/root": {
"post": {
"operationId": "Create",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {},
"examples": {
"Example 1": {
"value": [
{
"orgRootName": "string",
"orgRootShortName": "string",
"orgRootCode": "string",
"orgRootOrder": "number",
"orgRootPhoneEx": "string",
"orgRootPhoneIn": "string",
"orgRootFax": "string",
"orgRootIsNormal": "boolean"
}
]
}
}
}
}
}
},
"description": "สร้างโครงสร้างระดับ Root",
"summary": "ORG_001 - สร้างโครงสร้างระดับ Root (ADMIN) #1",
"tags": [
"OrgRoot"
],
"security": [],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateOrgRoot"
}
}
}
}
}
},
"/organization/root/{id}": {
"put": {
"operationId": "Update",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {},
"examples": {
"Example 1": {
"value": [
{
"orgRootName": "string",
"orgRootShortName": "string",
"orgRootCode": "string",
"orgRootOrder": "number",
"orgRootPhoneEx": "string",
"orgRootPhoneIn": "string",
"orgRootFax": "string",
"orgRootIsNormal": "boolean"
}
]
}
}
}
}
}
},
"description": "แก้ไขโครงสร้างระดับ Root",
"summary": "ORG_002 - แก้ไขโครงสร้างระดับ Root (ADMIN) #2",
"tags": [
"OrgRoot"
],
"security": [],
"parameters": [
{
"description": "Guid, *Id root",
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateOrgRoot"
}
}
}
}
}
},
"/hello": {
"get": {
"operationId": "GET",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
}
}
}
}
},
"tags": [
"Test"
],
"security": [
{
"bearerAuth": []
}
],
"parameters": []
}
}
},
"servers": [
{
"url": "/"
}
],
"tags": [
{
"name": "Test",
"description": "ทดสอบ"
}
],
"basePath": "/"
}