mirror of
https://github.com/whyour/qinglong.git
synced 2026-06-30 20:35:09 +08:00
修改表唯一约束
This commit is contained in:
@@ -31,12 +31,6 @@ export default class CronService {
|
||||
}
|
||||
|
||||
public async insert(payload: Crontab): Promise<Crontab> {
|
||||
const cron = await CrontabModel.findOne({
|
||||
where: { command: payload.command },
|
||||
});
|
||||
if (cron) {
|
||||
return cron;
|
||||
}
|
||||
return await CrontabModel.create(payload, { returning: true });
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,12 @@ export default class EnvService {
|
||||
}
|
||||
|
||||
public async insert(payloads: Env[]): Promise<Env[]> {
|
||||
const docs = await EnvModel.bulkCreate(payloads);
|
||||
return docs;
|
||||
const result = [];
|
||||
for (const env of payloads) {
|
||||
const doc = await EnvModel.create(env, { returning: true });
|
||||
result.push(doc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async update(payload: Env): Promise<Env> {
|
||||
|
||||
@@ -24,8 +24,8 @@ export default class OpenService {
|
||||
return { ...doc, tokens: [] };
|
||||
}
|
||||
|
||||
public async insert(payloads: App): Promise<App> {
|
||||
const doc = await AppModel.create(payloads, { returning: true });
|
||||
public async insert(payload: App): Promise<App> {
|
||||
const doc = await AppModel.create(payload, { returning: true });
|
||||
return doc.get({ plain: true }) as App;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user