import { ContainerModule, type interfaces } from "inversify"; import type { IArticlesRepository } from "../application/repositories/articles.repository.interface"; import { MockArticlesRepository } from "../infrastructure/repositories/articles.repository.mock"; import { getArticlesUseCase, type IGetArticlesUseCase, } from "../application/use-cases/get-articles.use-case"; import { createArticleUseCase, type ICreateArticleUseCase, } from "../application/use-cases/create-article.use-case"; import { getArticleBySlugUseCase, type IGetArticleBySlugUseCase, } from "../application/use-cases/get-article-by-slug.use-case"; import { getArticlesController, type IGetArticlesController, } from "../interface-adapters/controllers/get-articles.controller"; import { createArticleController, type ICreateArticleController, } from "../interface-adapters/controllers/create-article.controller"; import { getArticleBySlugController, type IGetArticleBySlugController, } from "../interface-adapters/controllers/get-article-by-slug.controller"; import { BLOG_SYMBOLS } from "./symbols"; export const BlogModule = new ContainerModule((bind: interfaces.Bind) => { bind(BLOG_SYMBOLS.IArticlesRepository).to(MockArticlesRepository); bind(BLOG_SYMBOLS.IGetArticlesUseCase).toDynamicValue((ctx) => getArticlesUseCase( ctx.container.get(BLOG_SYMBOLS.IArticlesRepository), ), ); bind(BLOG_SYMBOLS.ICreateArticleUseCase).toDynamicValue((ctx) => createArticleUseCase( ctx.container.get(BLOG_SYMBOLS.IArticlesRepository), ), ); bind(BLOG_SYMBOLS.IGetArticleBySlugUseCase).toDynamicValue((ctx) => getArticleBySlugUseCase( ctx.container.get(BLOG_SYMBOLS.IArticlesRepository), ), ); bind(BLOG_SYMBOLS.IGetArticlesController).toDynamicValue((ctx) => getArticlesController( ctx.container.get(BLOG_SYMBOLS.IGetArticlesUseCase), ), ); bind(BLOG_SYMBOLS.ICreateArticleController).toDynamicValue((ctx) => createArticleController( ctx.container.get(BLOG_SYMBOLS.ICreateArticleUseCase), ), ); bind(BLOG_SYMBOLS.IGetArticleBySlugController).toDynamicValue((ctx) => getArticleBySlugController( ctx.container.get(BLOG_SYMBOLS.IGetArticleBySlugUseCase), ), ); });