import { BILLS } from '../domain/repository/index' ; import { Connection } from 'mongoose' ; import { BILL_MODEL , BillSchema } from './read-model/schema/bill.schema' ; import { BillEventStore } from './eventstore/bill.event-store' ; import { MEMBER_MODEL , MemberSchema , } from '../../member/infrastructure/read-model/schema/member.schema' ; import { TRANSACTIONS } from '../../transaction/domain/repository/index' ; import { TransactionEventStore } from '../../transaction/infrastructure/eventstore/transaction.event-store' ; import { CHECK_USER_IN_GROUP } from '../../member/domain/services/check-user-in-group.service' ; import { CheckUserInGroupFromReadModel } from '../../member/infrastructure/service/check-user-in-group.service' ; import { GROUPS } from '../../group/domain/repository/index' ; import { GroupEventStore } from '../../group/infrastructure/eventstore/groups.event-store' ; import { BillService , BILL_SERVICE } from './service/bill.service' ; export const BillProviders = [ { provide : BILL_MODEL , useFactory : ( connection ) => connection . model ( 'Bills' , BillSchema ) , inject : [ 'DATABASE_CONNECTION' ] , } , { provide : MEMBER_MODEL , useFactory : ( connection ) => connection . model ( 'Member' , MemberSchema ) , inject : [ 'DATABASE_CONNECTION' ] , } , { provide : TRANSACTIONS , useClass : TransactionEventStore , } , { provide : BILLS , useClass : BillEventStore , } , { provide : BILL_SERVICE , useValue : BillService , } , { provide : GROUPS , useClass : GroupEventStore , } , { provide : CHECK_USER_IN_GROUP , useClass : CheckUserInGroupFromReadModel , } , ] ;