mirror of
https://github.com/certd/certd.git
synced 2026-05-16 13:17:29 +08:00
perf: 站点证书监控增加导出和分组功能
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { BaseService } from '@certd/lib-server';
|
||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { merge } from 'lodash-es';
|
||||
import { GroupEntity } from '../entity/group.js';
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class GroupService extends BaseService<GroupEntity> {
|
||||
@InjectEntityModel(GroupEntity)
|
||||
repository: Repository<GroupEntity>;
|
||||
|
||||
//@ts-ignore
|
||||
getRepository() {
|
||||
return this.repository;
|
||||
}
|
||||
|
||||
async add(bean: any) {
|
||||
if (!bean.type) {
|
||||
throw new Error('type is required');
|
||||
}
|
||||
bean = merge(
|
||||
{
|
||||
favorite: false,
|
||||
},
|
||||
bean
|
||||
);
|
||||
return await this.repository.save(bean);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user