mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
feat(server): add model base (#9734)
This commit is contained in:
19
packages/backend/server/src/models/base.ts
Normal file
19
packages/backend/server/src/models/base.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Inject, Logger } from '@nestjs/common';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
import { Config } from '../base';
|
||||
import type { Models } from '.';
|
||||
import { MODELS_SYMBOL } from './provider';
|
||||
|
||||
export class BaseModel {
|
||||
protected readonly logger = new Logger(this.constructor.name);
|
||||
|
||||
@Inject(MODELS_SYMBOL)
|
||||
protected readonly models!: Models;
|
||||
|
||||
@Inject(Config)
|
||||
protected readonly config!: Config;
|
||||
|
||||
@Inject(PrismaClient)
|
||||
protected readonly db!: PrismaClient;
|
||||
}
|
||||
Reference in New Issue
Block a user