2024-02-16 12:28:40 +00:00
|
|
|
import * as plugins from './plugins.js';
|
|
|
|
import * as paths from './paths.js';
|
2024-02-15 19:30:38 +00:00
|
|
|
import { PlatformServiceDb } from './classes.platformservicedb.js'
|
2024-02-16 19:42:26 +00:00
|
|
|
import { EmailService } from './email/email.classes.emailservice.js';
|
|
|
|
import { SmsService } from './sms/smsservice.js';
|
|
|
|
import { LetterService } from './letter/classes.letterservice.js';
|
|
|
|
import { MtaService } from './mta/mta.classes.mta.js';
|
2024-02-15 19:30:38 +00:00
|
|
|
|
|
|
|
export class SzPlatformService {
|
|
|
|
public projectinfo: plugins.projectinfo.ProjectInfo;
|
|
|
|
public serviceQenv = new plugins.qenv.Qenv('./', './.nogit');
|
|
|
|
public platformserviceDb: PlatformServiceDb;
|
|
|
|
|
|
|
|
public typedserver: plugins.typedserver.TypedServer;
|
|
|
|
public typedrouter = new plugins.typedrequest.TypedRouter();
|
|
|
|
|
2024-02-16 19:42:26 +00:00
|
|
|
// SubServices
|
|
|
|
public emailService: EmailService;
|
|
|
|
public letterService: LetterService;
|
|
|
|
public mtaService: MtaService;
|
|
|
|
public smsService: SmsService;
|
|
|
|
|
2024-02-15 19:30:38 +00:00
|
|
|
public async start() {
|
|
|
|
this.platformserviceDb = new PlatformServiceDb(this);
|
|
|
|
this.projectinfo = new plugins.projectinfo.ProjectInfo(paths.packageDir);
|
2024-02-16 19:42:26 +00:00
|
|
|
|
|
|
|
// lets start the sub services
|
|
|
|
this.emailService = new EmailService(this);
|
|
|
|
this.letterService = new LetterService(this, {
|
|
|
|
letterxpressUser: await this.serviceQenv.getEnvVarOnDemand('LETTER_API_USER'),
|
|
|
|
letterxpressToken: await this.serviceQenv.getEnvVarOnDemand('LETTER_API_TOKEN')
|
|
|
|
});
|
|
|
|
this.mtaService = new MtaService(this);
|
|
|
|
this.smsService = new SmsService(this, {
|
|
|
|
apiGatewayApiToken: await this.serviceQenv.getEnvVarOnDemand('SMS_API_TOKEN'),
|
|
|
|
});
|
|
|
|
|
|
|
|
// lets start the server finally
|
2024-02-15 19:30:38 +00:00
|
|
|
this.typedserver = new plugins.typedserver.TypedServer({
|
|
|
|
cors: true,
|
|
|
|
});
|
|
|
|
await this.typedserver.start();
|
|
|
|
}
|
|
|
|
}
|