33 lines
832 B
TypeScript
33 lines
832 B
TypeScript
|
|
import { IRepositoryManager, RepositoryManager } from "@/contexts/common/domain";
|
||
|
|
import {
|
||
|
|
ISequelizeAdapter,
|
||
|
|
createSequelizeAdapter,
|
||
|
|
} from "@/contexts/common/infrastructure/sequelize";
|
||
|
|
|
||
|
|
export interface ISalesContext {
|
||
|
|
adapter: ISequelizeAdapter;
|
||
|
|
repositoryManager: IRepositoryManager;
|
||
|
|
//services: IApplicationService;
|
||
|
|
}
|
||
|
|
|
||
|
|
export class SalesContext {
|
||
|
|
private static instance: SalesContext | null = null;
|
||
|
|
|
||
|
|
public static getInstance(): ISalesContext {
|
||
|
|
if (!SalesContext.instance) {
|
||
|
|
SalesContext.instance = new SalesContext({
|
||
|
|
adapter: createSequelizeAdapter(),
|
||
|
|
repositoryManager: RepositoryManager.getInstance(),
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
return SalesContext.instance.context;
|
||
|
|
}
|
||
|
|
|
||
|
|
private context: ISalesContext;
|
||
|
|
|
||
|
|
private constructor(context: ISalesContext) {
|
||
|
|
this.context = context;
|
||
|
|
}
|
||
|
|
}
|