feat: allowance journey

This commit is contained in:
Abdalhamid Alhamad
2024-12-19 15:18:35 +03:00
parent fd6c1d1442
commit a201692c0c
31 changed files with 884 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import { BadRequestException, Injectable } from '@nestjs/common';
import { BadRequestException, forwardRef, Inject, Injectable } from '@nestjs/common';
import { Transactional } from 'typeorm-transactional';
import { Roles } from '~/auth/enums';
import { UserService } from '~/auth/services';
@ -14,9 +14,9 @@ import { JuniorTokenService } from './junior-token.service';
export class JuniorService {
constructor(
private readonly juniorRepository: JuniorRepository,
private readonly userService: UserService,
private readonly customerService: CustomerService,
private readonly juniorTokenService: JuniorTokenService,
@Inject(forwardRef(() => UserService)) private readonly userService: UserService,
) {}
@Transactional()
@ -86,4 +86,10 @@ export class JuniorService {
generateToken(juniorId: string) {
return this.juniorTokenService.generateToken(juniorId);
}
async doesJuniorBelongToGuardian(guardianId: string, juniorId: string) {
const junior = await this.findJuniorById(juniorId, false, guardianId);
return !!junior;
}
}