mirror of
https://github.com/certd/certd.git
synced 2026-04-24 20:57:26 +08:00
chore: project
This commit is contained in:
@@ -105,7 +105,9 @@ export class PipelineController extends CrudController<PipelineService> {
|
|||||||
async save(@Body(ALL) bean: { addToMonitorEnabled: boolean, addToMonitorDomains: string } & PipelineEntity) {
|
async save(@Body(ALL) bean: { addToMonitorEnabled: boolean, addToMonitorDomains: string } & PipelineEntity) {
|
||||||
const { userId ,projectId} = await this.getProjectUserIdWrite()
|
const { userId ,projectId} = await this.getProjectUserIdWrite()
|
||||||
if (bean.id > 0) {
|
if (bean.id > 0) {
|
||||||
await this.checkOwner(this.getService(), bean.id,"write",true);
|
const {userId,projectId} = await this.checkOwner(this.getService(), bean.id,"write",true);
|
||||||
|
bean.userId = userId;
|
||||||
|
bean.projectId = projectId;
|
||||||
} else {
|
} else {
|
||||||
bean.userId = userId;
|
bean.userId = userId;
|
||||||
bean.projectId = projectId;
|
bean.projectId = projectId;
|
||||||
|
|||||||
@@ -40,11 +40,12 @@ export class CertInfoService extends BaseService<CertInfoEntity> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateDomains(pipelineId: number, userId: number, domains: string[],fromType?:string) {
|
async updateDomains(pipelineId: number, userId: number, projectId: number, domains: string[],fromType?:string) {
|
||||||
const found = await this.repository.findOne({
|
const found = await this.repository.findOne({
|
||||||
where: {
|
where: {
|
||||||
pipelineId,
|
pipelineId,
|
||||||
userId,
|
userId,
|
||||||
|
projectId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const bean = new CertInfoEntity();
|
const bean = new CertInfoEntity();
|
||||||
@@ -55,6 +56,7 @@ export class CertInfoService extends BaseService<CertInfoEntity> {
|
|||||||
//create
|
//create
|
||||||
bean.pipelineId = pipelineId;
|
bean.pipelineId = pipelineId;
|
||||||
bean.userId = userId;
|
bean.userId = userId;
|
||||||
|
bean.projectId = projectId;
|
||||||
bean.fromType = fromType
|
bean.fromType = fromType
|
||||||
if (!domains || domains.length === 0) {
|
if (!domains || domains.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -256,7 +256,6 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.doUpdatePipelineJson(bean, pipeline);
|
await this.doUpdatePipelineJson(bean, pipeline);
|
||||||
|
|
||||||
//保存域名信息到certInfo表
|
//保存域名信息到certInfo表
|
||||||
let fromType = "pipeline";
|
let fromType = "pipeline";
|
||||||
if (bean.type === "cert_upload") {
|
if (bean.type === "cert_upload") {
|
||||||
@@ -264,7 +263,9 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
|||||||
} else if (bean.type === "cert_auto") {
|
} else if (bean.type === "cert_auto") {
|
||||||
fromType = "auto";
|
fromType = "auto";
|
||||||
}
|
}
|
||||||
await this.certInfoService.updateDomains(pipeline.id, pipeline.userId || bean.userId, domains, fromType);
|
const userId = pipeline.userId || bean.userId;
|
||||||
|
const projectId = pipeline.projectId ?? bean.projectId ??null;
|
||||||
|
await this.certInfoService.updateDomains(pipeline.id, userId, projectId , domains, fromType);
|
||||||
return {
|
return {
|
||||||
...bean,
|
...bean,
|
||||||
version: pipeline.version,
|
version: pipeline.version,
|
||||||
@@ -293,6 +294,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
|||||||
bean.content = JSON.stringify(pipeline);
|
bean.content = JSON.stringify(pipeline);
|
||||||
await this.addOrUpdate(bean);
|
await this.addOrUpdate(bean);
|
||||||
await this.registerTrigger(bean);
|
await this.registerTrigger(bean);
|
||||||
|
return bean
|
||||||
}
|
}
|
||||||
|
|
||||||
private async checkMaxPipelineCount(bean: PipelineEntity, pipeline: Pipeline, domains: string[]) {
|
private async checkMaxPipelineCount(bean: PipelineEntity, pipeline: Pipeline, domains: string[]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user