This repository has been archived on 2024-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
p61-project/infrastructure/index.ts

44 lines
1.5 KiB
TypeScript
Raw Normal View History

import { AuthenticationUseCase } from "@/domain/use-cases/Authentication"
2024-03-15 22:48:28 +01:00
import { RetrieveHabitsTrackerUseCase } from "../domain/use-cases/RetrieveHabitsTracker"
2024-03-16 00:36:44 +01:00
import { HabitsTrackerPresenter } from "../presentation/presenters/HabitsTracker"
import { AuthenticationSupabaseRepository } from "./repositories/supabase/lib/AuthenticationRepository"
2024-03-16 00:36:44 +01:00
import { GetHabitProgressHistorySupabaseRepository } from "./repositories/supabase/lib/GetHabitProgressHistory"
2024-03-15 22:48:28 +01:00
import { GetHabitsByUserIdSupabaseRepository } from "./repositories/supabase/lib/GetHabitsByUserId"
import { supabaseClient } from "./repositories/supabase/supabase"
import { AuthenticationPresenter } from "@/presentation/presenters/Authentication"
2024-03-15 22:48:28 +01:00
/**
* Repositories
*/
const authenticationRepository = new AuthenticationSupabaseRepository({
supabaseClient,
})
2024-03-16 00:36:44 +01:00
const getHabitProgressesRepository =
new GetHabitProgressHistorySupabaseRepository({
supabaseClient,
})
2024-03-15 22:48:28 +01:00
const getHabitsByUserIdRepository = new GetHabitsByUserIdSupabaseRepository({
supabaseClient,
})
/**
* Use Cases
*/
const authenticationUseCase = new AuthenticationUseCase({
authenticationRepository,
})
2024-03-15 22:48:28 +01:00
const retrieveHabitsTrackerUseCase = new RetrieveHabitsTrackerUseCase({
2024-03-16 00:36:44 +01:00
getHabitProgressHistoryRepository: getHabitProgressesRepository,
2024-03-15 22:48:28 +01:00
getHabitsByUserIdRepository,
})
/**
* Presenters
*/
export const authenticationPresenter = new AuthenticationPresenter({
authenticationUseCase,
})
2024-03-15 22:48:28 +01:00
export const habitsTrackerPresenter = new HabitsTrackerPresenter({
retrieveHabitsTrackerUseCase,
})