2024-03-22 23:41:51 +01:00
|
|
|
import { AuthenticationUseCase } from "@/domain/use-cases/Authentication"
|
2024-05-02 23:48:47 +02:00
|
|
|
import { HabitCreateUseCase } from "@/domain/use-cases/HabitCreate"
|
|
|
|
import { HabitEditUseCase } from "@/domain/use-cases/HabitEdit"
|
|
|
|
import { HabitGoalProgressUpdateUseCase } from "@/domain/use-cases/HabitGoalProgressUpdate"
|
|
|
|
import { HabitStopUseCase } from "@/domain/use-cases/HabitStop"
|
|
|
|
import { AuthenticationPresenter } from "@/presentation/presenters/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"
|
2024-03-23 01:43:27 +01:00
|
|
|
import { AuthenticationSupabaseRepository } from "./supabase/repositories/Authentication"
|
|
|
|
import { GetHabitProgressHistorySupabaseRepository } from "./supabase/repositories/GetHabitProgressHistory"
|
|
|
|
import { GetHabitsByUserIdSupabaseRepository } from "./supabase/repositories/GetHabitsByUserId"
|
2024-04-05 00:08:40 +02:00
|
|
|
import { HabitCreateSupabaseRepository } from "./supabase/repositories/HabitCreate"
|
2024-04-11 13:07:17 +02:00
|
|
|
import { HabitEditSupabaseRepository } from "./supabase/repositories/HabitEdit"
|
2024-04-11 23:03:45 +02:00
|
|
|
import { HabitProgressCreateSupabaseRepository } from "./supabase/repositories/HabitProgressCreate"
|
|
|
|
import { HabitProgressUpdateSupabaseRepository } from "./supabase/repositories/HabitProgressUpdate"
|
2024-05-02 23:48:47 +02:00
|
|
|
import { supabaseClient } from "./supabase/supabase"
|
2024-03-15 22:48:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Repositories
|
|
|
|
*/
|
2024-03-22 23:41:51 +01:00
|
|
|
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,
|
|
|
|
})
|
2024-04-05 00:08:40 +02:00
|
|
|
const habitCreateRepository = new HabitCreateSupabaseRepository({
|
|
|
|
supabaseClient,
|
|
|
|
})
|
2024-04-11 13:07:17 +02:00
|
|
|
const habitEditRepository = new HabitEditSupabaseRepository({
|
|
|
|
supabaseClient,
|
|
|
|
})
|
2024-04-11 23:03:45 +02:00
|
|
|
const habitProgressCreateRepository = new HabitProgressCreateSupabaseRepository(
|
|
|
|
{
|
|
|
|
supabaseClient,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
const habitProgressUpdateRepository = new HabitProgressUpdateSupabaseRepository(
|
|
|
|
{
|
|
|
|
supabaseClient,
|
|
|
|
},
|
|
|
|
)
|
2024-03-15 22:48:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Use Cases
|
|
|
|
*/
|
2024-03-22 23:41:51 +01:00
|
|
|
const authenticationUseCase = new AuthenticationUseCase({
|
|
|
|
authenticationRepository,
|
|
|
|
})
|
2024-04-05 00:08:40 +02:00
|
|
|
const habitCreateUseCase = new HabitCreateUseCase({
|
|
|
|
habitCreateRepository,
|
|
|
|
})
|
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,
|
|
|
|
})
|
2024-04-11 13:07:17 +02:00
|
|
|
const habitEditUseCase = new HabitEditUseCase({
|
|
|
|
habitEditRepository,
|
|
|
|
})
|
2024-04-11 23:03:45 +02:00
|
|
|
const habitGoalProgressUpdateUseCase = new HabitGoalProgressUpdateUseCase({
|
|
|
|
habitProgressCreateRepository,
|
|
|
|
habitProgressUpdateRepository,
|
|
|
|
})
|
2024-04-12 15:20:08 +02:00
|
|
|
const habitStopUseCase = new HabitStopUseCase({
|
|
|
|
habitEditRepository,
|
|
|
|
})
|
2024-03-15 22:48:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Presenters
|
|
|
|
*/
|
2024-03-22 23:41:51 +01:00
|
|
|
export const authenticationPresenter = new AuthenticationPresenter({
|
|
|
|
authenticationUseCase,
|
|
|
|
})
|
2024-03-15 22:48:28 +01:00
|
|
|
export const habitsTrackerPresenter = new HabitsTrackerPresenter({
|
|
|
|
retrieveHabitsTrackerUseCase,
|
2024-04-05 00:08:40 +02:00
|
|
|
habitCreateUseCase,
|
2024-04-11 13:07:17 +02:00
|
|
|
habitEditUseCase,
|
2024-04-12 15:20:08 +02:00
|
|
|
habitStopUseCase,
|
2024-04-11 23:03:45 +02:00
|
|
|
habitGoalProgressUpdateUseCase,
|
2024-03-15 22:48:28 +01:00
|
|
|
})
|