-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Channel aware Assets #677
Comments
What do you mean by this? Assets that are available by default in all Channels without needing to be explicitly assigned? |
I was thinking about assets that are assigned to multiple channels, which seems like a must have now that I think about it. |
Yes, they should work just like any of the ChannelAware entities:
|
|
Good questions:
I think we need to provide a choice to the user. Here's the current deletion API: deleteAsset(id: ID!, force: Boolean): DeletionResponse!
type DeletionResponse {
message: String
result: DeletionResult!
}
enum DeletionResult {
"The entity was successfully deleted"
DELETED
"Deletion did not take place, reason given in message"
NOT_DELETED
} We make use of the "force" variable e.g. if attempting to delete an Asset which is set as the featuredAsset of a Product. The call to {
"result": "NOT_DELETED",
"message": "The selected Asset is featured by 1 Product"
} and only setting "force" to true actually deletes it. We could do something similar with channels, but we probably would then want a "AssetDeletionOptions" input something like: input AssetDeletionOptions {
force: Boolean
deleteFromAllChannels: Boolean
}
No, I don't think this is necessary. It would be overly-complex and I can't easily think of a scenario where the focal point changes depending on what channel it is in. If you have some use-case in mind, let me know. |
I can't think of any use-case on having channel aware focalpoints, so focalpoints will always be global. The solution of having |
I was thinking that Oh, another complication here - we need to take into account whether the current user actually has permissions to delete from other channels! You can't allow "Shop B Admin" who only has permissions on "Shop B Channel" to delete things from the default channel. |
That's why I was thinking about throwing an error, but that might be unexpected behavior when you have permission to all channels. |
Yes exactly. There will be cases where a superadmin-type account is doing work in a sub-channel and would want to be able to just delete assets without switching to the default channel, finding the asset again and then deleting. |
More questions:
type Mutation {
assignAssetsToChannel(input: AssignAssetsToChannelInput!): [Asset!]!
deleteAsset(input: DeleteAssetInput!): DeletionResult!
deleteAssets(input: DeleteAssetsInput!): DeletionResult!
}
input AssignAssetsToChannelInput {
assetIds: [ID!]!
channelId: ID!
}
input DeleteAssetInput {
assetId: ID!
force: Boolean
deleteFromAllChannels: Boolean
}
input DeleteAssetsInput {
assetIds: [ID!]!
force: Boolean
deleteFromAllChannels: Boolean
} |
|
Relates to vendure-ecommerce#677 BREAKING CHANGE: New DB relation Asset to Channel. Mutations deleteAsset and deleteAssets changed
Relates to #677 BREAKING CHANGE: New DB relation Asset to Channel, requiring a migration. The Admin API mutations `deleteAsset` and `deleteAssets` have changed their argument signature.
Currently, assets are shared between channels. If an asset is uploaded to channel1and the user switches to channel2, it will see the same set of assets. To fully support multi-channel shops, it's desirable to have assets that are channel aware.
Describe the solution you'd like
Assets that are uploaded in the context of the current channel should only be available in the current channel.
deleteFromAllChannels
boolean fordeleteAsset
mutation to delete asset from all channelsConsidered out of scope for now: Assigning assets to multiple channels via the Admin UI.
Question Should there be something like global assets?I am currently working on this feature.
The text was updated successfully, but these errors were encountered: