修复提示

This commit is contained in:
EL 2026-04-03 10:01:21 +08:00
parent d2d87701de
commit cfd2f1e8dc

View File

@ -178,6 +178,13 @@ export class DevicesService {
*/ */
async remove(actor: ActorContext, id: number) { async remove(actor: ActorContext, id: number) {
const current = await this.findRemovableDevice(actor, id); const current = await this.findRemovableDevice(actor, id);
const relatedTaskCount = await this.prisma.taskItem.count({
where: { deviceId: current.id },
});
if (relatedTaskCount > 0) {
throw new ConflictException(MESSAGES.DEVICE.DELETE_CONFLICT);
}
try { try {
return await this.prisma.device.delete({ return await this.prisma.device.delete({