docs: updates to use DML and other changes (#7834)
- Change existing data model guides and add new ones for DML - Change module's docs around service factory + remove guides that are now necessary - Hide/remove all mentions of module relationships, or label them as coming soon. - Change all data model creation snippets to use DML - use `property` instead of `field` when referring to a data model's properties. - Fix all snippets in commerce module guides to use new method suffix (no more main model methods) - Rework recipes, removing/hiding a lot of sections as a lot of recipes are incomplete with the current state of DML. ### Other changes - Highlight fixes in some guides - Remove feature flags guide - Fix code block styles when there are no line numbers. ### Upcoming changes in other PRs - Re-generate commerce module references (for the updates in the method names) - Ensure that the data model references are generated correctly for models using DML. - (probably at a very later point) revisit recipes
This commit is contained in:
@@ -25,11 +25,12 @@ In this document, you’ll find common examples of how you can use the Stock Loc
|
||||
const stockLocationModuleService: IStockLocationService =
|
||||
request.scope.resolve(ModuleRegistrationName.STOCK_LOCATION)
|
||||
|
||||
const stockLocation = await stockLocationModuleService.create(
|
||||
{
|
||||
name: "Warehouse 1",
|
||||
}
|
||||
)
|
||||
const stockLocation = await stockLocationModuleService
|
||||
.createStockLocations(
|
||||
{
|
||||
name: "Warehouse 1",
|
||||
}
|
||||
)
|
||||
|
||||
res.json({
|
||||
stock_location: stockLocation,
|
||||
@@ -51,11 +52,12 @@ In this document, you’ll find common examples of how you can use the Stock Loc
|
||||
const stockLocationModuleService =
|
||||
await initializeStockLocationModule({})
|
||||
|
||||
const stockLocation = await stockLocationModuleService.create(
|
||||
{
|
||||
name: "Warehouse 1",
|
||||
}
|
||||
)
|
||||
const stockLocation = await stockLocationModuleService
|
||||
.createStockLocations(
|
||||
{
|
||||
name: "Warehouse 1",
|
||||
}
|
||||
)
|
||||
|
||||
return NextResponse.json({ stock_location: stockLocation })
|
||||
}
|
||||
@@ -84,7 +86,8 @@ In this document, you’ll find common examples of how you can use the Stock Loc
|
||||
request.scope.resolve(ModuleRegistrationName.STOCK_LOCATION)
|
||||
|
||||
res.json({
|
||||
stock_locations: await stockLocationModuleService.list({}),
|
||||
stock_locations: await stockLocationModuleService
|
||||
.listStockLocations({}),
|
||||
})
|
||||
}
|
||||
```
|
||||
@@ -104,7 +107,8 @@ In this document, you’ll find common examples of how you can use the Stock Loc
|
||||
await initializeStockLocationModule({})
|
||||
|
||||
return NextResponse.json({
|
||||
stock_locations: await stockLocationModuleService.list({}),
|
||||
stock_locations: await stockLocationModuleService
|
||||
.listStockLocations({}),
|
||||
})
|
||||
}
|
||||
```
|
||||
@@ -131,15 +135,16 @@ In this document, you’ll find common examples of how you can use the Stock Loc
|
||||
const stockLocationModuleService: IStockLocationService =
|
||||
request.scope.resolve(ModuleRegistrationName.STOCK_LOCATION)
|
||||
|
||||
const stockLocation = await stockLocationModuleService.update({
|
||||
id: "sloc_123",
|
||||
address: {
|
||||
country_code: "US",
|
||||
city: "New York City",
|
||||
address_1: "52 Stone St",
|
||||
postal_code: "10004",
|
||||
},
|
||||
})
|
||||
const stockLocation = await stockLocationModuleService
|
||||
.updateStockLocations({
|
||||
id: "sloc_123",
|
||||
address: {
|
||||
country_code: "US",
|
||||
city: "New York City",
|
||||
address_1: "52 Stone St",
|
||||
postal_code: "10004",
|
||||
},
|
||||
})
|
||||
|
||||
res.json({
|
||||
stock_location: stockLocation,
|
||||
@@ -163,15 +168,16 @@ In this document, you’ll find common examples of how you can use the Stock Loc
|
||||
const stockLocationModuleService =
|
||||
await initializeStockLocationModule({})
|
||||
|
||||
const stockLocation = await stockLocationModuleService.update({
|
||||
id: "sloc_123",
|
||||
address: {
|
||||
country_code: "us",
|
||||
city: "New York City",
|
||||
address_1: "52 Stone St",
|
||||
postal_code: "10004",
|
||||
},
|
||||
})
|
||||
const stockLocation = await stockLocationModuleService
|
||||
.updateStockLocations({
|
||||
id: "sloc_123",
|
||||
address: {
|
||||
country_code: "us",
|
||||
city: "New York City",
|
||||
address_1: "52 Stone St",
|
||||
postal_code: "10004",
|
||||
},
|
||||
})
|
||||
|
||||
return NextResponse.json({
|
||||
stock_location: stockLocation,
|
||||
@@ -201,7 +207,9 @@ In this document, you’ll find common examples of how you can use the Stock Loc
|
||||
const stockLocationModuleService: IStockLocationService =
|
||||
request.scope.resolve(ModuleRegistrationName.STOCK_LOCATION)
|
||||
|
||||
await stockLocationModuleService.delete("sloc_123")
|
||||
await stockLocationModuleService.deleteStockLocations(
|
||||
"sloc_123"
|
||||
)
|
||||
|
||||
res.status(200)
|
||||
}
|
||||
@@ -223,7 +231,9 @@ In this document, you’ll find common examples of how you can use the Stock Loc
|
||||
const stockLocationModuleService =
|
||||
await initializeStockLocationModule({})
|
||||
|
||||
await stockLocationModuleService.delete("sloc_123")
|
||||
await stockLocationModuleService.deleteStockLocations(
|
||||
"sloc_123"
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user