mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
chore:
This commit is contained in:
@@ -52,6 +52,12 @@ export class CnameRecordController extends CrudController<CnameProviderService>
|
||||
return super.delete(id);
|
||||
}
|
||||
|
||||
@Post('/deleteByIds', { summary: 'sys:settings:edit' })
|
||||
async deleteByIds(@Body(ALL) body: { ids: number[] }) {
|
||||
const res = await this.service.delete(body.ids);
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
@Post('/setDefault', { summary: 'sys:settings:edit' })
|
||||
async setDefault(@Body('id') id: number) {
|
||||
await this.service.setDefault(id);
|
||||
|
||||
@@ -49,6 +49,9 @@ export class CnameProviderService extends BaseService<CnameProviderEntity> {
|
||||
}
|
||||
|
||||
async delete(ids: any) {
|
||||
if (!ids) {
|
||||
return;
|
||||
}
|
||||
if (!(ids instanceof Array)) {
|
||||
ids = [ids];
|
||||
}
|
||||
@@ -77,9 +80,9 @@ export class CnameProviderService extends BaseService<CnameProviderEntity> {
|
||||
if (def) {
|
||||
return def;
|
||||
}
|
||||
const found = await this.repository.findOne({ order: { createTime: 'DESC' } });
|
||||
if (found) {
|
||||
return found;
|
||||
const founds = await this.repository.find({ take: 1, order: { createTime: 'DESC' } });
|
||||
if (founds && founds.length > 0) {
|
||||
return founds[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user