修复提示
This commit is contained in:
parent
d2d87701de
commit
cfd2f1e8dc
@ -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({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user