Files
certd/packages/ui/certd-server/src/modules/pipeline/service/history-log-service.ts
T

40 lines
967 B
TypeScript
Raw Normal View History

2024-07-15 00:30:33 +08:00
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
2023-01-29 13:44:19 +08:00
import { InjectEntityModel } from '@midwayjs/typeorm';
import { In, Repository } from 'typeorm';
2024-10-03 22:03:49 +08:00
import { BaseService } from '@certd/lib-server';
2024-07-15 00:30:33 +08:00
import { HistoryLogEntity } from '../entity/history-log.js';
2023-01-29 13:44:19 +08:00
/**
* 证书申请
*/
@Provide()
@Scope(ScopeEnum.Singleton)
export class HistoryLogService extends BaseService<HistoryLogEntity> {
@InjectEntityModel(HistoryLogEntity)
repository: Repository<HistoryLogEntity>;
2024-10-09 02:34:28 +08:00
//@ts-ignore
2023-01-29 13:44:19 +08:00
getRepository() {
return this.repository;
}
async save(bean: HistoryLogEntity) {
if (bean.id > 0) {
await this.update(bean);
} else {
await this.add(bean);
}
}
async deleteByHistoryIds(numbers: number[]) {
if (numbers.length === 0) {
return;
}
await this.repository.delete({ historyId: In(numbers) });
}
async deleteByPipelineId(id: number) {
await this.repository.delete({ pipelineId: id });
}
2023-01-29 13:44:19 +08:00
}