mirror of
https://github.com/certd/certd.git
synced 2026-07-05 19:37:34 +08:00
chore: 优化代码格式
This commit is contained in:
@@ -98,17 +98,17 @@ export class LegacyAcmeAccountAccessFix {
|
||||
continue;
|
||||
}
|
||||
const name = buildAcmeAccountAccessName(parsedKey.caType, parsedKey.email);
|
||||
const query = {
|
||||
userId: record.userId,
|
||||
type: "acmeAccount",
|
||||
subtype: parsedKey.caType,
|
||||
name,
|
||||
} as any
|
||||
const query = {
|
||||
userId: record.userId,
|
||||
type: "acmeAccount",
|
||||
subtype: parsedKey.caType,
|
||||
name,
|
||||
} as any;
|
||||
if (record.projectId) {
|
||||
query.projectId = record.projectId;
|
||||
}
|
||||
const exists = await this.accessService.findOne({
|
||||
where:query,
|
||||
where: query,
|
||||
});
|
||||
if (exists) {
|
||||
continue;
|
||||
|
||||
+1
-4
@@ -192,10 +192,7 @@ describe("CertApplyTemplateService", () => {
|
||||
|
||||
await service.setDefault(2, 10, null);
|
||||
|
||||
assert.deepEqual((service as any).updateWhereList, [
|
||||
{ userId: 10 },
|
||||
{ userId: 10, id: 2 },
|
||||
]);
|
||||
assert.deepEqual((service as any).updateWhereList, [{ userId: 10 }, { userId: 10, id: 2 }]);
|
||||
assert.equal(list[0].isDefault, false);
|
||||
assert.equal(list[1].isDefault, true);
|
||||
assert.equal(list[2].isDefault, false);
|
||||
|
||||
@@ -897,13 +897,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
if (param.projectId != null) {
|
||||
query.projectId = param.projectId;
|
||||
}
|
||||
const statusCount = await this.repository
|
||||
.createQueryBuilder()
|
||||
.select("status")
|
||||
.addSelect("count(1)", "count")
|
||||
.where(query)
|
||||
.groupBy("status")
|
||||
.getRawMany();
|
||||
const statusCount = await this.repository.createQueryBuilder().select("status").addSelect("count(1)", "count").where(query).groupBy("status").getRawMany();
|
||||
return statusCount;
|
||||
}
|
||||
|
||||
@@ -915,13 +909,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
if (param.projectId != null) {
|
||||
query.projectId = param.projectId;
|
||||
}
|
||||
const statusCount = await this.repository
|
||||
.createQueryBuilder()
|
||||
.select("disabled")
|
||||
.addSelect("count(1)", "count")
|
||||
.where(query)
|
||||
.groupBy("disabled")
|
||||
.getRawMany();
|
||||
const statusCount = await this.repository.createQueryBuilder().select("disabled").addSelect("count(1)", "count").where(query).groupBy("disabled").getRawMany();
|
||||
const result = {
|
||||
enabled: 0,
|
||||
disabled: 0,
|
||||
@@ -1115,14 +1103,12 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
for (const item of list) {
|
||||
const pipeline = JSON.parse(item.content);
|
||||
if (trigger.props === false) {
|
||||
//清除trigger
|
||||
pipeline.triggers = [];
|
||||
} else {
|
||||
|
||||
const start = dayjs().format("YYYY-MM-DD") + " " + trigger.randomRange[0];
|
||||
let end = dayjs().format("YYYY-MM-DD") + " " + trigger.randomRange[1];
|
||||
if (trigger.randomRange[1] < trigger.randomRange[0]) {
|
||||
@@ -1137,19 +1123,20 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
//随机时间
|
||||
const randomTime = Math.floor(Math.random() * (endTime - startTime)) + startTime;
|
||||
const time = dayjs(randomTime).format(" ss:mm:HH").replaceAll(":", " ").replaceAll(" 0", " ").trim();
|
||||
set(triggerConf, "props.cron", `${time} * * *`)
|
||||
set(triggerConf, "props.cron", `${time} * * *`);
|
||||
}
|
||||
delete triggerConf.random
|
||||
delete triggerConf.random;
|
||||
delete triggerConf.randomRange;
|
||||
pipeline.triggers = [{
|
||||
id: nanoid(),
|
||||
title: "定时触发",
|
||||
...triggerConf
|
||||
}];
|
||||
pipeline.triggers = [
|
||||
{
|
||||
id: nanoid(),
|
||||
title: "定时触发",
|
||||
...triggerConf,
|
||||
},
|
||||
];
|
||||
}
|
||||
await this.doUpdatePipelineJson(item, pipeline);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async batchUpdateNotifications(ids: number[], notification: Notification, userId: any, projectId?: number) {
|
||||
|
||||
Reference in New Issue
Block a user