import { Injectable } from '@nestjs/common';
import { db, RoleMethodSchema, ObjectType, Prisma } from '@nice/common';
import { BaseService } from '../base/base.service';
@Injectable()
export class RoleService extends BaseService<Prisma.RoleDelegate> {
  constructor() {
    super(db, ObjectType.ROLE);
  }
  /**
   * 批量删除角色
   * @param data 包含要删除的角色ID列表的数据
   * @returns 删除结果
   * @throws 如果未提供ID，将抛出错误
   */
  async softDeleteByIds(ids: string[], data?: Prisma.RoleUpdateInput) {
    await db.roleMap.deleteMany({
      where: {
        roleId: {
          in: ids,
        },
      },
    });
    return await super.softDeleteByIds(ids, data);
  }
}
