refactor(monitor,cert-plugin): 移除废弃的certFile字段相关逻辑

1.  给certFile字段添加废弃注释
2.  删除证书申请成功事件中传递的file参数
3.  简化updateCertByPipelineId方法参数,移除file相关入参和赋值逻辑
This commit is contained in:
xiaojunnuo
2026-07-01 01:10:08 +08:00
parent bce7d95838
commit b35e7b0702
4 changed files with 4 additions and 9 deletions
@@ -15,8 +15,8 @@ export class AutoPipelineEmitterRegister {
} }
async onCertApplySuccess() { async onCertApplySuccess() {
pipelineEmitter.on(EVENT_CERT_APPLY_SUCCESS, async (event: PipelineEvent<{ cert: CertInfo; file: string }>) => { pipelineEmitter.on(EVENT_CERT_APPLY_SUCCESS, async (event: PipelineEvent<{ cert: CertInfo }>) => {
await this.certInfoService.updateCertByPipelineId(event.pipeline.id, event.event.cert, event.event.file); await this.certInfoService.updateCertByPipelineId(event.pipeline.id, event.event.cert);
}); });
} }
} }
@@ -42,6 +42,7 @@ export class CertInfoEntity {
@Column({ name: "cert_info", comment: "证书详情" }) @Column({ name: "cert_info", comment: "证书详情" })
certInfo: string; certInfo: string;
// Deprecated 废弃
@Column({ name: "cert_file", comment: "证书下载" }) @Column({ name: "cert_file", comment: "证书下载" })
certFile: string; certFile: string;
@@ -12,7 +12,6 @@ export type UploadCertReq = {
fromType?: string; fromType?: string;
userId?: number; userId?: number;
projectId?: number; projectId?: number;
file?: any;
}; };
@Provide("CertInfoService") @Provide("CertInfoService")
@@ -158,7 +157,7 @@ export class CertInfoService extends BaseService<CertInfoEntity> {
}; };
} }
async updateCertByPipelineId(pipelineId: number, cert: CertInfo, file?: string, fromType = "pipeline") { async updateCertByPipelineId(pipelineId: number, cert: CertInfo, fromType = "pipeline") {
const found = await this.repository.findOne({ const found = await this.repository.findOne({
where: { where: {
pipelineId, pipelineId,
@@ -168,7 +167,6 @@ export class CertInfoService extends BaseService<CertInfoEntity> {
id: found?.id, id: found?.id,
certReader: new CertReader(cert), certReader: new CertReader(cert),
fromType, fromType,
file,
}); });
return bean; return bean;
} }
@@ -194,9 +192,6 @@ export class CertInfoService extends BaseService<CertInfoEntity> {
bean.certProvider = certReader.detail.issuer.commonName; bean.certProvider = certReader.detail.issuer.commonName;
bean.userId = userId; bean.userId = userId;
bean.projectId = req.projectId; bean.projectId = req.projectId;
if (req.file) {
bean.certFile = req.file;
}
await this.addOrUpdate(bean); await this.addOrUpdate(bean);
return bean; return bean;
} }
@@ -84,7 +84,6 @@ export abstract class CertApplyBaseConvertPlugin extends AbstractTaskPlugin {
const emitter = this.ctx.emitter; const emitter = this.ctx.emitter;
const value = { const value = {
cert: this.cert, cert: this.cert,
file: this._result.files[0].path,
}; };
await emitter.emit(EVENT_CERT_APPLY_SUCCESS, value); await emitter.emit(EVENT_CERT_APPLY_SUCCESS, value);
} }