fix(templates): Correct template file paths and organization for service projects
This commit is contained in:
30
assets/templates/service/ts/classes.some.db.ts
Normal file
30
assets/templates/service/ts/classes.some.db.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
fileName: classes.{{module.name}}db.ts
|
||||
---
|
||||
import * as plugins from './{{module.name}}.plugins.js';
|
||||
import { {{module.name}} } from './classes.{{module.name}}.js';
|
||||
|
||||
|
||||
|
||||
export class {{module.name}}Db {
|
||||
public smartdataDb: plugins.smartdata.SmartdataDb;
|
||||
public {{module.name}}Ref: {{module.name}};
|
||||
|
||||
constructor({{module.name}}RefArg: {{module.name}}) {
|
||||
this.{{module.name}}Ref = {{module.name}}RefArg;
|
||||
}
|
||||
|
||||
public async start() {
|
||||
this.smartdataDb = new plugins.smartdata.SmartdataDb({
|
||||
mongoDbUser: this.{{module.name}}Ref.serviceQenv.getEnvVarOnDemand('MONGO_DB_USER'),
|
||||
mongoDbName: this.{{module.name}}Ref.serviceQenv.getEnvVarOnDemand('MONGO_DB_NAME'),
|
||||
mongoDbPass: this.{{module.name}}Ref.serviceQenv.getEnvVarOnDemand('MONGO_DB_PASS'),
|
||||
mongoDbUrl: this.{{module.name}}Ref.serviceQenv.getEnvVarOnDemand('MONGO_DB_URL'),
|
||||
});
|
||||
await this.smartdataDb.init();
|
||||
}
|
||||
|
||||
public async stop() {
|
||||
await this.smartdataDb.close();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user