reseller : bug

This commit is contained in:
2026-04-18 16:26:46 +03:30
parent b369794d42
commit f8a66e9d42
+11 -1
View File
@@ -30,7 +30,7 @@ export class ResellerService {
private readonly userBankAccountRepository: UserBankAccountRepository,
private readonly walletsService: WalletsService,
private readonly dataSource: DataSource,
) {}
) { }
// ---------------------------------------------------------------------------
// Create a reseller record for an existing user.
@@ -44,6 +44,16 @@ export class ResellerService {
throw new BadRequestException(AuthMessage.USER_NOT_FOUND);
}
const exsiting = await this.resellerRepository.findOne({
where: {
owner: { id: user.id }
}
})
if (exsiting) {
throw new BadRequestException("شخص مورد نظر نمایندگی دارد .")
}
const reseller = this.resellerRepository.create({
name,
owner: user,