feat: Remove sales channels from pub keys (#6876)

**What**
- Add workflow + step for detaching sales channels from pub API keys
- Tweak linking error message to be more helpful
- Add `removeRemoteLink` step to delete API key workflow
This commit is contained in:
Oli Juhl
2024-03-29 16:01:10 +01:00
committed by GitHub
parent 8fd1488938
commit 1bcb13f892
16 changed files with 351 additions and 26 deletions

View File

@@ -11,10 +11,10 @@ export const PublishableApiKeySalesChannel: ModuleJoinerConfig = {
},
alias: [
{
name: "publishable_api_key_sales_channel",
},
{
name: "publishable_api_key_sales_channels",
name: [
"publishable_api_key_sales_channel",
"publishable_api_key_sales_channels",
],
},
],
primaryKeys: ["id", "publishable_key_id", "sales_channel_id"],
@@ -49,7 +49,7 @@ export const PublishableApiKeySalesChannel: ModuleJoinerConfig = {
{
serviceName: Modules.SALES_CHANNEL,
fieldAlias: {
api_keys: "api_keys_link.api_key",
publishable_api_keys: "api_keys_link.api_key",
},
relationship: {
serviceName: LINKS.PublishableApiKeySalesChannel,

View File

@@ -50,6 +50,18 @@ export const LINKS = {
Modules.STOCK_LOCATION,
"location_id"
),
PublishableApiKeySalesChannel: composeLinkName(
Modules.API_KEY,
"api_key_id",
Modules.SALES_CHANNEL,
"sales_channel_id"
),
ProductSalesChannel: composeLinkName(
Modules.PRODUCT,
"product_id",
Modules.SALES_CHANNEL,
"sales_channel_id"
),
// Internal services
ProductShippingProfile: composeLinkName(
@@ -58,22 +70,10 @@ export const LINKS = {
"shippingProfileService",
"profile_id"
),
ProductSalesChannel: composeLinkName(
Modules.PRODUCT,
"product_id",
Modules.SALES_CHANNEL,
"sales_channel_id"
),
OrderSalesChannel: composeLinkName(
"orderService",
"order_id",
Modules.SALES_CHANNEL,
"sales_channel_id"
),
PublishableApiKeySalesChannel: composeLinkName(
Modules.API_KEY,
"api_key_id",
Modules.SALES_CHANNEL,
"sales_channel_id"
),
}