- import { Provide } from '@midwayjs/decorator';
- import { InjectEntityModel } from '@midwayjs/typegoose';
- import { ReturnModelType } from '@typegoose/typegoose';
- import { BaseService } from 'free-midway-component';
- import { Config } from '../entity/config.entity';
- type modelType = ReturnModelType<typeof Config>;
- @Provide()
- export class ConfigService extends BaseService<modelType> {
- @InjectEntityModel(Config)
- model: modelType;
- async findByOne(): Promise<object> {
- const result = await this.model.findOne({}).lean();
- return result;
- }
- }
|