mirror of
https://github.com/certd/certd.git
synced 2026-07-12 16:27:34 +08:00
chore(base-service): 完善batchDelete方法的返回类型并添加返回值
为batchDelete方法添加明确的Promise<number>返回类型,同时返回实际删除的id数量
This commit is contained in:
@@ -279,7 +279,7 @@ export abstract class BaseService<T> {
|
|||||||
return item != null && item != "";
|
return item != null && item != "";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async batchDelete(ids: number[], userId: number, projectId?: number) {
|
async batchDelete(ids: number[], userId: number, projectId?: number): Promise<number> {
|
||||||
ids = this.filterIds(ids);
|
ids = this.filterIds(ids);
|
||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
const userProjectQuery = this.buildUserProjectQuery(userId, projectId);
|
const userProjectQuery = this.buildUserProjectQuery(userId, projectId);
|
||||||
@@ -295,6 +295,7 @@ export abstract class BaseService<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.delete(ids);
|
await this.delete(ids);
|
||||||
|
return ids.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOne(options: FindOneOptions<T>) {
|
async findOne(options: FindOneOptions<T>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user