Skip to content

Commit 57215a7

Browse files
committed
mark dbservice as builtin
1 parent f6cc2f8 commit 57215a7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ try {
2323

2424
async function applyServer(ctx: Context) {
2525
ctx.plugin(require('./service/server'));
26-
ctx.plugin((require('./service/db')).default);
26+
ctx.plugin(require('./service/db'));
2727
ctx.plugin(require('./service/fetcher'));
2828
ctx.inject(['server', 'dbservice', 'fetcher'], (c) => {
2929
c.plugin(require('./handler/misc'));

packages/server/service/db.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ declare module 'cordis' {
2121
}
2222
}
2323

24-
export default class DBService extends Service {
24+
export class DBService extends Service {
2525
constructor(ctx: Context) {
2626
fs.ensureDirSync(path.resolve(process.cwd(), 'data/.db'));
2727
super(ctx, 'dbservice', true);
@@ -47,3 +47,8 @@ export default class DBService extends Service {
4747
await this.initDatabase('teams', []);
4848
}
4949
}
50+
51+
export function apply(ctx: Context) {
52+
ctx.provide('dbservice', undefined, true);
53+
ctx.dbservice = new DBService(ctx);
54+
}

0 commit comments

Comments
 (0)