-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(medusa, stock-location, inventory): Allow modules to integrate w…
…ith core (#2997) * feat: module shared resources
- Loading branch information
1 parent
b3e4be7
commit 9dbccd9
Showing
24 changed files
with
573 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@medusajs/inventory": patch | ||
"@medusajs/medusa": patch | ||
"@medusajs/stock-location": patch | ||
--- | ||
|
||
feat(medusa, stock-location, inventory): Allow modules to integrate with core |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import ConnectionLoader from "./loaders/connection" | ||
import InventoryService from "./services/inventory" | ||
import * as InventoryModels from "./models" | ||
import * as SchemaMigration from "./migrations/schema-migrations/1665748086258-inventory_setup" | ||
import { ModuleExports } from "@medusajs/medusa" | ||
|
||
const service = InventoryService | ||
const migrations = [SchemaMigration] | ||
const loaders = [ConnectionLoader] | ||
const models = Object.values(InventoryModels) | ||
|
||
const moduleDefinition: ModuleExports = { | ||
service, | ||
migrations, | ||
loaders, | ||
models, | ||
} | ||
|
||
export default moduleDefinition |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,6 @@ | ||
import { ConfigModule } from "@medusajs/medusa" | ||
import { ConnectionOptions, createConnection } from "typeorm" | ||
import { CONNECTION_NAME } from "../config" | ||
import { ConfigurableModuleDeclaration, LoaderOptions } from "@medusajs/medusa" | ||
|
||
import { ReservationItem, InventoryItem, InventoryLevel } from "../models" | ||
|
||
export default async ({ | ||
configModule, | ||
}: { | ||
configModule: ConfigModule | ||
}): Promise<void> => { | ||
await createConnection({ | ||
name: CONNECTION_NAME, | ||
type: configModule.projectConfig.database_type, | ||
url: configModule.projectConfig.database_url, | ||
database: configModule.projectConfig.database_database, | ||
schema: configModule.projectConfig.database_schema, | ||
extra: configModule.projectConfig.database_extra || {}, | ||
entities: [ReservationItem, InventoryLevel, InventoryItem], | ||
logging: configModule.projectConfig.database_logging || false, | ||
} as ConnectionOptions) | ||
} | ||
export default async ( | ||
{ configModule }: LoaderOptions, | ||
moduleDeclaration?: ConfigurableModuleDeclaration | ||
): Promise<void> => {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.