import { Request, Response } from 'express'; import { DyFM_Error, DyFM_HttpCallType, DyFM_Log } from '@futdevpro/fsm-dynamo'; import { DyNTS_Endpoint_Params } from '../_models/control-models/endpoint-params.control-model'; import { DyNTS_Controller } from '../_services/route/controller.service'; import { DyNTS_global_settings } from './global-settings.const'; import { DyNTS_RoutingModule } from '../_services/route/routing-module.service'; export function DyNTS_getStarRoute(): DyNTS_RoutingModule { return new DyNTS_RoutingModule({ route: '/**', controllers: [ DyNTS_Star_Controller.getInstance() ], }); } export class DyNTS_Star_Controller extends DyNTS_Controller { static getInstance(): DyNTS_Star_Controller { return DyNTS_Star_Controller.getSingletonInstance(); } setupEndpoints(): void { this.endpoints = [ new DyNTS_Endpoint_Params({ name: 'defaultGet', endpoint: '/*', type: DyFM_HttpCallType.get, tasks: [ async (req: Request, res: Response, issuer: string): Promise => { throw new DyFM_Error({ ...this.getDefaultErrorSettings( 'defaultRoute', new Error(`Invalid route (404): ${req.originalUrl}`), issuer ), status: 404, errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-RMS-G404`, }); } ], }), new DyNTS_Endpoint_Params({ name: 'defaultPost', endpoint: '/*', type: DyFM_HttpCallType.post, tasks: [ async (req: Request, res: Response, issuer: string): Promise => { throw new DyFM_Error({ ...this.getDefaultErrorSettings( 'defaultRoute', new Error(`Invalid route (404): ${req.originalUrl}`), issuer ), status: 404, errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-RMS-PO404`, }); } ], }), new DyNTS_Endpoint_Params({ name: 'defaultPut', endpoint: '/*', type: DyFM_HttpCallType.put, tasks: [ async (req: Request, res: Response, issuer: string): Promise => { throw new DyFM_Error({ ...this.getDefaultErrorSettings( 'defaultRoute', new Error(`Invalid route (404): ${req.originalUrl}`), issuer ), status: 404, errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-RMS-PU404`, }); } ], }), new DyNTS_Endpoint_Params({ name: 'defaultPatch', endpoint: '/*', type: DyFM_HttpCallType.patch, tasks: [ async (req: Request, res: Response, issuer: string): Promise => { throw new DyFM_Error({ ...this.getDefaultErrorSettings( 'defaultRoute', new Error(`Invalid route (404): ${req.originalUrl}`), issuer ), status: 404, errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-RMS-PA404`, }); } ], }), new DyNTS_Endpoint_Params({ name: 'defaultDelete', endpoint: '/*', type: DyFM_HttpCallType.delete, tasks: [ async (req: Request, res: Response, issuer: string): Promise => { throw new DyFM_Error({ ...this.getDefaultErrorSettings( 'defaultRoute', new Error(`Invalid route (404): ${req.originalUrl}`), issuer ), status: 404, errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-RMS-D404`, }); } ], }) ]; } }