add services

This commit is contained in:
Simon Larsen 2023-02-26 15:30:11 +00:00
parent 3b052ffc92
commit 5766ec2f76
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
5 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,10 @@
import PostgresDatabase from '../Infrastructure/PostgresDatabase';
import Model from 'Model/Models/IncidentCustomField';
import DatabaseService from './DatabaseService';
export class Service extends DatabaseService<Model> {
public constructor(postgresDatabase?: PostgresDatabase) {
super(Model, postgresDatabase);
}
}
export default new Service();

View File

@ -0,0 +1,10 @@
import PostgresDatabase from '../Infrastructure/PostgresDatabase';
import Model from 'Model/Models/MonitorCustomField';
import DatabaseService from './DatabaseService';
export class Service extends DatabaseService<Model> {
public constructor(postgresDatabase?: PostgresDatabase) {
super(Model, postgresDatabase);
}
}
export default new Service();

View File

@ -0,0 +1,10 @@
import PostgresDatabase from '../Infrastructure/PostgresDatabase';
import Model from 'Model/Models/ScheduledMaintenanceCustomField';
import DatabaseService from './DatabaseService';
export class Service extends DatabaseService<Model> {
public constructor(postgresDatabase?: PostgresDatabase) {
super(Model, postgresDatabase);
}
}
export default new Service();

View File

@ -0,0 +1,10 @@
import PostgresDatabase from '../Infrastructure/PostgresDatabase';
import Model from 'Model/Models/StatusPageCustomField';
import DatabaseService from './DatabaseService';
export class Service extends DatabaseService<Model> {
public constructor(postgresDatabase?: PostgresDatabase) {
super(Model, postgresDatabase);
}
}
export default new Service();

View File

@ -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, ScheduledMaintenanceCustomFieldServiceType>(
ScheduledMaintenanceCustomField,
ScheduledMaintenanceCustomFieldService
).getRouter()
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<IncidentCustomField, IncidentCustomFieldServiceType>(
IncidentCustomField,
IncidentCustomFieldService
).getRouter()
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<MonitorCustomField, MonitorCustomFieldServiceType>(
MonitorCustomField,
MonitorCustomFieldService
).getRouter()
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<StatusPageCustomField, StatusPageCustomFieldServiceType>(
StatusPageCustomField,
StatusPageCustomFieldService
).getRouter()
);
const init: Function = async (): Promise<void> => {
try {
// init the app