feat: Add skeleton for Store module (#6506)

This commit is contained in:
Stevche Radevski
2024-02-26 12:00:48 +00:00
committed by GitHub
parent 8ea37d03c9
commit 63be07031b
30 changed files with 428 additions and 0 deletions
@@ -0,0 +1,5 @@
describe("noop", function () {
it("should run", function () {
expect(true).toBe(true)
})
})
+1
View File
@@ -0,0 +1 @@
export { default as StoreModuleService } from "./store-module-service"
@@ -0,0 +1,47 @@
import {
DAL,
InternalModuleDeclaration,
ModuleJoinerConfig,
ModulesSdkTypes,
IStoreModuleService,
StoreTypes,
} from "@medusajs/types"
import { ModulesSdkUtils } from "@medusajs/utils"
import { Store } from "@models"
import { entityNameToLinkableKeysMap, joinerConfig } from "../joiner-config"
const generateMethodForModels = []
type InjectedDependencies = {
baseRepository: DAL.RepositoryService
storeService: ModulesSdkTypes.InternalModuleService<any>
}
export default class StoreModuleService<TEntity extends Store = Store>
extends ModulesSdkUtils.abstractModuleServiceFactory<
InjectedDependencies,
StoreTypes.StoreDTO,
{
Store: { dto: StoreTypes.StoreDTO }
}
>(Store, generateMethodForModels, entityNameToLinkableKeysMap)
implements IStoreModuleService
{
protected baseRepository_: DAL.RepositoryService
protected readonly storeService_: ModulesSdkTypes.InternalModuleService<TEntity>
constructor(
{ baseRepository, storeService }: InjectedDependencies,
protected readonly moduleDeclaration: InternalModuleDeclaration
) {
// @ts-ignore
super(...arguments)
this.baseRepository_ = baseRepository
this.storeService_ = storeService
}
__joinerConfig(): ModuleJoinerConfig {
return joinerConfig
}
}