clean order services

This commit is contained in:
2026-01-27 14:52:55 +03:30
parent 935f905e29
commit e2b065aa2b
9 changed files with 319 additions and 277 deletions
+9 -1
View File
@@ -1,4 +1,4 @@
import { ConflictException, Injectable, NotFoundException } from '@nestjs/common';
import { BadRequestException, ConflictException, Injectable, NotFoundException } from '@nestjs/common';
import { Admin } from '../entities/admin.entity';
import { Role } from '../../roles/entities/role.entity';
import { EntityManager, RequiredEntityData } from '@mikro-orm/postgresql';
@@ -113,4 +113,12 @@ export class AdminService {
// TODO :L is this correct to soft delete
return this.em.removeAndFlush(admin);
}
async findOrFail(adminId: string) {
const admin = await this.findById(adminId)
if (!admin) {
throw new BadRequestException("Admin not found")
}
return admin
}
}