mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
chore: 支持手动上传证书并部署
This commit is contained in:
@@ -121,6 +121,16 @@ export class CertInfoController extends CrudController<CertInfoService> {
|
||||
return this.ok(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Post('/getCert', { summary: Constants.per.authOnly })
|
||||
async getCert(@Query('id') id: number) {
|
||||
await this.service.checkUserId(id, this.getUserId());
|
||||
const certInfoEntity = await this.service.info(id);
|
||||
const certInfo = JSON.parse(certInfoEntity.certInfo);
|
||||
return this.ok(certInfo);
|
||||
}
|
||||
|
||||
@Post('/upload', { summary: Constants.per.authOnly })
|
||||
async upload(@Body(ALL) body: {cert: CertInfo, pipeline: any, id?: number}) {
|
||||
if (body.id) {
|
||||
@@ -131,23 +141,16 @@ export class CertInfoController extends CrudController<CertInfoService> {
|
||||
userId: this.getUserId(),
|
||||
cert: body.cert,
|
||||
});
|
||||
return this.ok();
|
||||
}else{
|
||||
//添加
|
||||
await this.certUploadService.createUploadCertPipeline({
|
||||
const res = await this.certUploadService.createUploadCertPipeline({
|
||||
userId: this.getUserId(),
|
||||
cert: body.cert,
|
||||
pipeline: body.pipeline,
|
||||
});
|
||||
|
||||
return this.ok(res)
|
||||
}
|
||||
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@Post('/getCert', { summary: Constants.per.authOnly })
|
||||
async getCert(@Query('id') id: number) {
|
||||
await this.service.checkUserId(id, this.getUserId());
|
||||
const certInfoEntity = await this.service.info(id);
|
||||
const certInfo = JSON.parse(certInfoEntity.certInfo);
|
||||
return this.ok(certInfo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user