24 lines
676 B
TypeScript
24 lines
676 B
TypeScript
|
|
import { MusicCatalogService } from "../domain/services/MusicCatalogService"
|
|
import { IMusicRepository } from "../domain/ports/IMusicRepository";
|
|
|
|
import { VinylCatalog } from "../adapters/music/VinylCatalog"
|
|
|
|
export class MusicComponent {
|
|
constructor() {
|
|
|
|
let container = {
|
|
IMusicRepository: () => new VinylCatalog()
|
|
};
|
|
|
|
let inject = (name : string) : any => {
|
|
if (container[name]) {
|
|
return container[name];
|
|
}
|
|
throw new Error(`Failed to resolve ${name}`)
|
|
};
|
|
let musicCatalogService = new MusicCatalogService(inject("IMusicRepository") as IMusicRepository);
|
|
|
|
}
|
|
}
|