clean order services
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user