fix(core): Corrected typos and added missing keywords.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as paths from './paths.js';
|
||||
import * as plugins from '../plugins.js';
|
||||
import * as paths from '../paths.js';
|
||||
import { logger } from './logging.js';
|
||||
|
||||
import { JwtManager } from './classes.jwtmanager.js';
|
||||
import { LoginSessionManager } from './classes.loginsessionmanager.js';
|
||||
import { RegistrationSessionManager } from './classes.registrationsessionmanager.js';
|
||||
import { ReceptionServer } from './classes.receptionserver.js';
|
||||
import { ReceptionDb } from './classes.receptiondb.js';
|
||||
import { ReceptionMailer } from './classes.receptionmailer.js';
|
||||
import { UserManager } from './classes.usermanager.js';
|
||||
@@ -15,6 +14,15 @@ import { OrganizationManager } from './classes.organizationmanager.js';
|
||||
import { RoleManager } from './classes.rolemanager.js';
|
||||
import { BillingPlanManager } from './classes.billingplanmanager.js';
|
||||
|
||||
export interface IReceptionOptions {
|
||||
/**
|
||||
* a name for the idp instance.
|
||||
*/
|
||||
name: string;
|
||||
mongoDescriptor: plugins.smartdata.IMongoDescriptor;
|
||||
websiteServer: plugins.typedserver.utilityservers.UtilityWebsiteServer;
|
||||
}
|
||||
|
||||
export class Reception {
|
||||
public projectinfoNpm = new plugins.projectinfo.ProjectinfoNpm(paths.packageDir);
|
||||
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||
@@ -22,9 +30,6 @@ export class Reception {
|
||||
public szPlatformClient = new plugins.szPlatformClient.SzPlatformClient();
|
||||
public db = new ReceptionDb(this);
|
||||
|
||||
// server
|
||||
public serviceServer = new ReceptionServer(this);
|
||||
|
||||
// managers
|
||||
public jwtManager = new JwtManager(this);
|
||||
public loginSessionManager = new LoginSessionManager(this);
|
||||
@@ -37,16 +42,25 @@ export class Reception {
|
||||
public billingPlanManager = new BillingPlanManager(this);
|
||||
housekeeping = new ReceptionHousekeeping(this);
|
||||
|
||||
constructor(public databaseName?: string) {}
|
||||
constructor(public options: IReceptionOptions) {
|
||||
if (!options.mongoDescriptor) {
|
||||
throw new Error('mongoDescriptor is required');
|
||||
}
|
||||
if (!options.websiteServer) {
|
||||
throw new Error('websiteServer is required');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* starts the reception instance
|
||||
*/
|
||||
public async start() {
|
||||
logger.log('info', 'starting reception');
|
||||
await this.db.start(this.databaseName);
|
||||
logger.log('info', 'adding typedrouter to website server');
|
||||
this.options.websiteServer.typedrouter.addTypedRouter(this.typedrouter);
|
||||
logger.log('info', 'starting database');
|
||||
await this.db.start();
|
||||
await this.jwtManager.start();
|
||||
await this.serviceServer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +68,6 @@ export class Reception {
|
||||
*/
|
||||
public async stop() {
|
||||
await this.housekeeping.stop();
|
||||
await this.serviceServer.stop();
|
||||
console.log('stopped serviceserver!');
|
||||
await this.db.stop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user