| 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; | |
| } | |
| } |