diff --git a/CommonServer/Services/IncidentCustomFieldService.ts b/CommonServer/Services/IncidentCustomFieldService.ts new file mode 100644 index 0000000000..9123792d64 --- /dev/null +++ b/CommonServer/Services/IncidentCustomFieldService.ts @@ -0,0 +1,10 @@ +import PostgresDatabase from '../Infrastructure/PostgresDatabase'; +import Model from 'Model/Models/IncidentCustomField'; +import DatabaseService from './DatabaseService'; + +export class Service extends DatabaseService { + public constructor(postgresDatabase?: PostgresDatabase) { + super(Model, postgresDatabase); + } +} +export default new Service(); diff --git a/CommonServer/Services/MonitorCustomFieldService.ts b/CommonServer/Services/MonitorCustomFieldService.ts new file mode 100644 index 0000000000..627a3bca98 --- /dev/null +++ b/CommonServer/Services/MonitorCustomFieldService.ts @@ -0,0 +1,10 @@ +import PostgresDatabase from '../Infrastructure/PostgresDatabase'; +import Model from 'Model/Models/MonitorCustomField'; +import DatabaseService from './DatabaseService'; + +export class Service extends DatabaseService { + public constructor(postgresDatabase?: PostgresDatabase) { + super(Model, postgresDatabase); + } +} +export default new Service(); diff --git a/CommonServer/Services/ScheduledMaintenanceCustomFieldService.ts b/CommonServer/Services/ScheduledMaintenanceCustomFieldService.ts new file mode 100644 index 0000000000..fbd6db0d62 --- /dev/null +++ b/CommonServer/Services/ScheduledMaintenanceCustomFieldService.ts @@ -0,0 +1,10 @@ +import PostgresDatabase from '../Infrastructure/PostgresDatabase'; +import Model from 'Model/Models/ScheduledMaintenanceCustomField'; +import DatabaseService from './DatabaseService'; + +export class Service extends DatabaseService { + public constructor(postgresDatabase?: PostgresDatabase) { + super(Model, postgresDatabase); + } +} +export default new Service(); diff --git a/CommonServer/Services/StatusPageCustomFieldService.ts b/CommonServer/Services/StatusPageCustomFieldService.ts new file mode 100644 index 0000000000..6e96272b37 --- /dev/null +++ b/CommonServer/Services/StatusPageCustomFieldService.ts @@ -0,0 +1,10 @@ +import PostgresDatabase from '../Infrastructure/PostgresDatabase'; +import Model from 'Model/Models/StatusPageCustomField'; +import DatabaseService from './DatabaseService'; + +export class Service extends DatabaseService { + public constructor(postgresDatabase?: PostgresDatabase) { + super(Model, postgresDatabase); + } +} +export default new Service(); diff --git a/DashboardAPI/Index.ts b/DashboardAPI/Index.ts index 9b34cdc8d9..54ddd6e1e3 100755 --- a/DashboardAPI/Index.ts +++ b/DashboardAPI/Index.ts @@ -201,6 +201,30 @@ import StatusPageAPI from 'CommonServer/API/StatusPageAPI'; import StatusPageSubscriberAPI from 'CommonServer/API/StatusPageSubscriberAPI'; + +// Custom Fields API +import StatusPageCustomField from 'Model/Models/StatusPageCustomField'; +import StatusPageCustomFieldService, { + Service as StatusPageCustomFieldServiceType, +} from 'CommonServer/Services/StatusPageCustomFieldService'; + + +import MonitorCustomField from 'Model/Models/MonitorCustomField'; +import MonitorCustomFieldService, { + Service as MonitorCustomFieldServiceType, +} from 'CommonServer/Services/MonitorCustomFieldService'; + +import IncidentCustomField from 'Model/Models/IncidentCustomField'; +import IncidentCustomFieldService, { + Service as IncidentCustomFieldServiceType, +} from 'CommonServer/Services/IncidentCustomFieldService'; + +import ScheduledMaintenanceCustomField from 'Model/Models/ScheduledMaintenanceCustomField'; +import ScheduledMaintenanceCustomFieldService, { + Service as ScheduledMaintenanceCustomFieldServiceType, +} from 'CommonServer/Services/ScheduledMaintenanceCustomFieldService'; + + const app: ExpressApplication = Express.getExpressApp(); const APP_NAME: string = 'api'; @@ -516,6 +540,47 @@ app.use( ).getRouter() ); + + +app.use( + `/${APP_NAME.toLocaleLowerCase()}`, + new BaseAPI( + ScheduledMaintenanceCustomField, + ScheduledMaintenanceCustomFieldService + ).getRouter() +); + + + +app.use( + `/${APP_NAME.toLocaleLowerCase()}`, + new BaseAPI( + IncidentCustomField, + IncidentCustomFieldService + ).getRouter() +); + + + +app.use( + `/${APP_NAME.toLocaleLowerCase()}`, + new BaseAPI( + MonitorCustomField, + MonitorCustomFieldService + ).getRouter() +); + + +app.use( + `/${APP_NAME.toLocaleLowerCase()}`, + new BaseAPI( + StatusPageCustomField, + StatusPageCustomFieldService + ).getRouter() +); + + + const init: Function = async (): Promise => { try { // init the app