Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Documented the draft version check on publishing, discarding and reverting

Damian Legawiecac86b6cf1cb6
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yaml
index ad1067a77f..f49dc070f4 100644
--- a/docs/api-reference/admin.yaml
+++ b/docs/api-reference/admin.yaml
@@ -7793,6 +7793,13 @@ paths:
description: A language code, or `any` (the default)
schema:
type: string
+ - name: lock_version
+ in: query
+ required: false
+ description: The draft's `lock_version` as last seen; a draft saved since
+ is refused with 409
+ schema:
+ type: integer
responses:
'200':
description: email template reverted
@@ -8031,6 +8038,13 @@ paths:
description: A language code, or `any` (the default)
schema:
type: string
+ - name: lock_version
+ in: query
+ required: false
+ description: The draft's `lock_version` as last seen; a draft saved since
+ is refused with 409
+ schema:
+ type: integer
responses:
'200':
description: draft discarded
@@ -8190,6 +8204,10 @@ paths:
language:
type: string
example: any
+ lock_version:
+ type: integer
+ description: The draft's `lock_version` as reviewed; a draft saved
+ since is refused with 409
"/api/v3/admin/email_templates/{email_template_id}/preview":
parameters:
- name: email_template_id
diff --git a/spree/api/spec/integration/spree/api/v3/admin/email_templates_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/email_templates_spec.rb
index b2c97a72ed..36c3bbbaee 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/email_templates_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/email_templates_spec.rb
@@ -107,6 +107,8 @@ RSpec.describe 'Admin Email Templates API', type: :request, swagger_doc: 'api-re
include_context 'with admin auth parameters'
parameter name: :language, in: :query, type: :string, required: false,
description: 'A language code, or `any` (the default)'
+ parameter name: :lock_version, in: :query, type: :integer, required: false,
+ description: 'The draft\'s `lock_version` as last seen; a draft saved since is refused with 409'
response '200', 'email template reverted' do
schema '$ref' => '#/components/schemas/EmailTemplate'
@@ -187,6 +189,8 @@ RSpec.describe 'Admin Email Templates API', type: :request, swagger_doc: 'api-re
include_context 'with admin auth parameters'
parameter name: :language, in: :query, type: :string, required: false,
description: 'A language code, or `any` (the default)'
+ parameter name: :lock_version, in: :query, type: :integer, required: false,
+ description: 'The draft\'s `lock_version` as last seen; a draft saved since is refused with 409'
response '200', 'draft discarded' do
schema '$ref' => '#/components/schemas/EmailTemplate'
@@ -222,7 +226,10 @@ RSpec.describe 'Admin Email Templates API', type: :request, swagger_doc: 'api-re
include_context 'with admin auth parameters'
parameter name: :body, in: :body, required: false, schema: {
type: :object,
- properties: { language: { type: :string, example: 'any' } }
+ properties: {
+ language: { type: :string, example: 'any' },
+ lock_version: { type: :integer, description: "The draft's `lock_version` as reviewed; a draft saved since is refused with 409" }
+ }
}
response '201', 'draft published' do