chore: add business logic
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { BadRequestException, Injectable } from "@nestjs/common";
|
||||
|
||||
import { BusinessMessage } from "../../../common/enums/message.enum";
|
||||
import { BusinessRepository } from "../repositories/business.repository";
|
||||
|
||||
@Injectable()
|
||||
export class BusinessService {
|
||||
constructor(private readonly businessRepository: BusinessRepository) {}
|
||||
|
||||
async getBusinessByDanakSubscriptionId(danakSubscriptionId: string) {
|
||||
const business = await this.businessRepository.findOne({ danakSubscriptionId, deletedAt: null });
|
||||
if (!business) throw new BadRequestException(BusinessMessage.NOT_FOUND);
|
||||
|
||||
return business;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user