ZindagiAssan_Backend / src /modules /auth /auth.factory.ts
Talha812's picture
Upload 45 files
2c16c8c verified
raw
history blame contribute delete
906 Bytes
import { AuthRepositorySupabase } from '@/infra/supabase/repository/auth.repository';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
export class AuthFactory {
private static repository: AuthRepositorySupabase;
private static service: AuthService;
private static controller: AuthController;
static getRepository() {
if (!AuthFactory.repository) {
AuthFactory.repository = new AuthRepositorySupabase();
}
return AuthFactory.repository;
}
static getService() {
if (!AuthFactory.service) {
AuthFactory.service = new AuthService(AuthFactory.getRepository());
}
return AuthFactory.service;
}
static getController() {
if (!AuthFactory.controller) {
AuthFactory.controller = new AuthController(AuthFactory.getService());
}
return AuthFactory.controller;
}
}