spree_cm_commissioner 2.5.13.pre.patch3 → 2.5.13.pre.patch4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/spree/admin/exports_controller.rb +7 -1
- data/app/controllers/spree/api/v2/operator/guest_json_gzips_controller.rb +11 -4
- data/app/controllers/spree/api/v2/operator/guests_controller.rb +6 -0
- data/app/models/spree_cm_commissioner/exports/operator_guest_json_gzip.rb +20 -3
- data/app/serializers/spree_cm_commissioner/v2/operator/export_serializer.rb +2 -0
- data/app/services/spree_cm_commissioner/operator_guest_json_gzips/create.rb +4 -4
- data/app/views/spree/admin/exports/_form.html.erb +1 -7
- data/app/views/spree/admin/exports/index.html.erb +4 -4
- data/app/views/spree/admin/exports/show.html.erb +132 -0
- data/config/routes.rb +1 -1
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0490748ea10626aebe6ebe48862a792f00c14ccc994923a20a8c47cd3b69c868'
|
|
4
|
+
data.tar.gz: 01655e182fa6a3b2fef4a7d86464cc3e70ef3d11676a5671a27242552a8ebc4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c01ab4f2d158ab227147086d2da8689b7a5c10504760c5ffe2865ad8ad7382f5d45a4b3f60599afcf68c0b8a131621248f521a5a7b24c3b24ed600c15aad79b8
|
|
7
|
+
data.tar.gz: 60493b89228813004a8ec359ce05d5ad184e85361d44a2e252982913a360e4984f8c073c6efdb413075ccdb242709a6ba240865d1165a0df2f3173a12eb2c2f2
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
module Spree
|
|
2
2
|
module Admin
|
|
3
3
|
class ExportsController < Spree::Admin::ResourceController
|
|
4
|
-
|
|
4
|
+
include ActiveStorage::SetCurrent
|
|
5
|
+
|
|
6
|
+
before_action :load_export, only: %i[show destroy]
|
|
5
7
|
|
|
6
8
|
def index
|
|
7
9
|
@exports = SpreeCmCommissioner::Export
|
|
@@ -10,6 +12,10 @@ module Spree
|
|
|
10
12
|
.per(params[:per_page] || 25)
|
|
11
13
|
end
|
|
12
14
|
|
|
15
|
+
def show
|
|
16
|
+
# @export is loaded by before_action
|
|
17
|
+
end
|
|
18
|
+
|
|
13
19
|
def new
|
|
14
20
|
@export = SpreeCmCommissioner::Export.new
|
|
15
21
|
end
|
|
@@ -19,8 +19,6 @@ module Spree
|
|
|
19
19
|
|
|
20
20
|
# POST /api/v2/operator/guest_json_gzips
|
|
21
21
|
# - taxon_id=1
|
|
22
|
-
# - resource_includes[]=[check_ins,check_ins.check_in_by]
|
|
23
|
-
# - force_create=true (optional, to bypass recent export check)
|
|
24
22
|
def create
|
|
25
23
|
spree_authorize! :create, SpreeCmCommissioner::Exports::OperatorGuestJsonGzip
|
|
26
24
|
|
|
@@ -28,8 +26,17 @@ module Spree
|
|
|
28
26
|
|
|
29
27
|
result = SpreeCmCommissioner::OperatorGuestJsonGzips::Create.call(
|
|
30
28
|
exportable: exportable,
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
force_create: false,
|
|
30
|
+
options: {
|
|
31
|
+
created_by_id: spree_current_user.id.to_s,
|
|
32
|
+
created_by_login: spree_current_user.login,
|
|
33
|
+
ip_address: request.remote_ip,
|
|
34
|
+
user_agent: request.user_agent,
|
|
35
|
+
request_id: request.request_id,
|
|
36
|
+
client_version: request.headers['X-Cm-App-Version'],
|
|
37
|
+
client_os: request.headers['X-Cm-OperatingSystem'],
|
|
38
|
+
client_platform: request.headers['X-Cm-App-Platform']
|
|
39
|
+
}
|
|
33
40
|
)
|
|
34
41
|
|
|
35
42
|
if result.success?
|
|
@@ -15,6 +15,12 @@ module Spree
|
|
|
15
15
|
SpreeCmCommissioner::GuestSearcherQuery.new(params).call
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
# override
|
|
19
|
+
# use same includes as export for consistent response.
|
|
20
|
+
def resource_includes
|
|
21
|
+
SpreeCmCommissioner::Exports::OperatorGuestJsonGzip::RESOURCE_INCLUDES
|
|
22
|
+
end
|
|
23
|
+
|
|
18
24
|
private
|
|
19
25
|
|
|
20
26
|
def model_class
|
|
@@ -6,9 +6,26 @@ module SpreeCmCommissioner
|
|
|
6
6
|
{ check_ins: %i[check_in_by check_in_session], line_item: [:variant, { order: :bill_address }] }
|
|
7
7
|
].freeze
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
RESOURCE_INCLUDES = [
|
|
10
|
+
'user',
|
|
11
|
+
'check_ins',
|
|
12
|
+
'check_ins.check_in_by',
|
|
13
|
+
'check_ins.check_in_session',
|
|
14
|
+
'line_item',
|
|
15
|
+
'line_item.order',
|
|
16
|
+
'line_item.order.billing_address',
|
|
17
|
+
'line_item.variant'
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
11
20
|
store_public_metadata :guests_count, :integer, default: 0
|
|
21
|
+
store_public_metadata :created_by_id, :string
|
|
22
|
+
store_public_metadata :created_by_login, :string
|
|
23
|
+
store_public_metadata :ip_address, :string
|
|
24
|
+
store_public_metadata :user_agent, :string
|
|
25
|
+
store_public_metadata :request_id, :string
|
|
26
|
+
store_public_metadata :client_version, :string
|
|
27
|
+
store_public_metadata :client_os, :string
|
|
28
|
+
store_public_metadata :client_platform, :string
|
|
12
29
|
|
|
13
30
|
store_private_metadata :track_processed_messages, :array, default: []
|
|
14
31
|
|
|
@@ -71,7 +88,7 @@ module SpreeCmCommissioner
|
|
|
71
88
|
# Serialize to JSON:API format
|
|
72
89
|
# Note: This loads entire batch hash into memory (~10-50MB per batch depending on associations)
|
|
73
90
|
data = SpreeCmCommissioner::V2::Operator::GuestSerializer.new(
|
|
74
|
-
guests, { include:
|
|
91
|
+
guests, { include: RESOURCE_INCLUDES }
|
|
75
92
|
).serializable_hash
|
|
76
93
|
|
|
77
94
|
# Write each guest to guests_file: guest1,guest2,guest3
|
|
@@ -5,13 +5,13 @@ module SpreeCmCommissioner
|
|
|
5
5
|
class Create
|
|
6
6
|
prepend ::Spree::ServiceModule::Base
|
|
7
7
|
|
|
8
|
-
def call(exportable:,
|
|
8
|
+
def call(exportable:, force_create: false, options: {})
|
|
9
9
|
unless force_create
|
|
10
10
|
recent_export = find_recent_export(exportable)
|
|
11
11
|
return success(recent_export) if recent_export
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
export = build_export(exportable,
|
|
14
|
+
export = build_export(exportable, options)
|
|
15
15
|
if export.save
|
|
16
16
|
success(export)
|
|
17
17
|
else
|
|
@@ -36,10 +36,10 @@ module SpreeCmCommissioner
|
|
|
36
36
|
.first
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def build_export(exportable,
|
|
39
|
+
def build_export(exportable, options)
|
|
40
40
|
SpreeCmCommissioner::Exports::OperatorGuestJsonGzip.new(
|
|
41
41
|
exportable: exportable,
|
|
42
|
-
|
|
42
|
+
**options
|
|
43
43
|
)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
<div data-hook="admin_export_form_fields">
|
|
2
2
|
<div class="alert alert-info">
|
|
3
3
|
<strong>Developer Mode:</strong> This form accepts raw JSON attributes for STI models.
|
|
4
|
-
<br>
|
|
5
|
-
<strong>Public Metadata Example:</strong>
|
|
6
|
-
<pre class="mt-2 mb-0"><code>{
|
|
7
|
-
"resource_includes": ["check_ins", "line_item"],
|
|
8
|
-
"guests_count": 100
|
|
9
|
-
}</code></pre>
|
|
10
4
|
</div>
|
|
11
5
|
|
|
12
6
|
<div class="row">
|
|
@@ -49,7 +43,7 @@
|
|
|
49
43
|
name="spree_cm_commissioner_export[public_metadata]"
|
|
50
44
|
class="form-control"
|
|
51
45
|
rows="6"
|
|
52
|
-
placeholder=
|
|
46
|
+
placeholder="{}"></textarea>
|
|
53
47
|
<small class="form-text text-muted">
|
|
54
48
|
Public metadata fields (e.g., resource_includes, guests_count, etc.)
|
|
55
49
|
</small>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<% end %>
|
|
8
8
|
|
|
9
9
|
<% if @exports.any? %>
|
|
10
|
-
<div class="
|
|
10
|
+
<div class="mb-3 bg-white border rounded table-responsive">
|
|
11
11
|
<table class="table" id="listing_exports" data-hook>
|
|
12
12
|
<thead class="text-muted">
|
|
13
13
|
<tr data-hook="admin_exports_index_headers">
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<tbody>
|
|
27
27
|
<% @exports.each do |export| %>
|
|
28
28
|
<tr id="<%= spree_dom_id export %>" data-hook="admin_exports_index_rows">
|
|
29
|
-
<td><%= export.id %></td>
|
|
29
|
+
<td><%= link_to export.id, admin_export_path(export), class: 'btn btn-sm btn-link p-0' %></td>
|
|
30
30
|
<td><code style="font-size: 0.75rem;"><%= export.uuid&.truncate(8, omission: '...') %></code></td>
|
|
31
31
|
<td><code style="font-size: 0.75rem;"><%= export.type&.split('::')&.last %></code></td>
|
|
32
32
|
<td>
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
<% if export.public_metadata.present? && export.public_metadata.any? %>
|
|
51
51
|
<details>
|
|
52
52
|
<summary class="btn btn-sm btn-outline-secondary">View (<%= export.public_metadata.keys.count %>)</summary>
|
|
53
|
-
<pre class="
|
|
53
|
+
<pre class="p-2 mt-2 border rounded bg-light" style="font-size: 0.7rem; max-width: 300px; max-height: 200px; overflow: auto;"><%= JSON.pretty_generate(export.public_metadata) %></pre>
|
|
54
54
|
</details>
|
|
55
55
|
<% else %>
|
|
56
56
|
<span class="text-muted">-</span>
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
<% if export.private_metadata.present? && export.private_metadata.any? %>
|
|
61
61
|
<details>
|
|
62
62
|
<summary class="btn btn-sm btn-outline-secondary">View (<%= export.private_metadata.keys.count %>)</summary>
|
|
63
|
-
<pre class="
|
|
63
|
+
<pre class="p-2 mt-2 border rounded bg-light" style="font-size: 0.7rem; max-width: 300px; max-height: 200px; overflow: auto;"><%= JSON.pretty_generate(export.private_metadata) %></pre>
|
|
64
64
|
</details>
|
|
65
65
|
<% else %>
|
|
66
66
|
<span class="text-muted">-</span>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<% content_for :page_title do %>
|
|
2
|
+
<%= link_to 'Exports', admin_exports_path %> / <%= "Export ##{@export.id}" %>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<% content_for :page_actions do %>
|
|
6
|
+
<%= link_to_delete @export, url: admin_export_path(@export) if can?(:destroy, @export) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<div class="row">
|
|
10
|
+
<div class="col-md-8">
|
|
11
|
+
<div class="mb-4 card">
|
|
12
|
+
<div class="card-header">
|
|
13
|
+
<h5 class="mb-0">Export Details</h5>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="card-body">
|
|
16
|
+
<table class="table table-borderless">
|
|
17
|
+
<tbody>
|
|
18
|
+
<tr>
|
|
19
|
+
<th scope="row" style="width: 200px;">ID</th>
|
|
20
|
+
<td><%= @export.id %></td>
|
|
21
|
+
</tr>
|
|
22
|
+
<tr>
|
|
23
|
+
<th scope="row">UUID</th>
|
|
24
|
+
<td><code><%= @export.uuid %></code></td>
|
|
25
|
+
</tr>
|
|
26
|
+
<tr>
|
|
27
|
+
<th scope="row">Type</th>
|
|
28
|
+
<td><code><%= @export.type %></code></td>
|
|
29
|
+
</tr>
|
|
30
|
+
<tr>
|
|
31
|
+
<th scope="row">Status</th>
|
|
32
|
+
<td>
|
|
33
|
+
<% badge_class = case @export.status
|
|
34
|
+
when 'done' then 'badge-success'
|
|
35
|
+
when 'progress' then 'badge-info'
|
|
36
|
+
when 'queue' then 'badge-warning'
|
|
37
|
+
when 'failed' then 'badge-danger'
|
|
38
|
+
else 'badge-secondary'
|
|
39
|
+
end %>
|
|
40
|
+
<span class="badge <%= badge_class %> badge-lg"><%= @export.status %></span>
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<th scope="row">Exportable</th>
|
|
45
|
+
<td>
|
|
46
|
+
<% if @export.exportable.present? %>
|
|
47
|
+
<%= @export.exportable_type %> #<%= @export.exportable_id %>
|
|
48
|
+
<% else %>
|
|
49
|
+
<span class="text-muted">None</span>
|
|
50
|
+
<% end %>
|
|
51
|
+
</td>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<th scope="row">Created At</th>
|
|
55
|
+
<td><%= l(@export.created_at, format: :long) %></td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<th scope="row">Updated At</th>
|
|
59
|
+
<td><%= l(@export.updated_at, format: :long) %></td>
|
|
60
|
+
</tr>
|
|
61
|
+
</tbody>
|
|
62
|
+
</table>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<% if @export.exported_file.attached? %>
|
|
67
|
+
<div class="mb-4 card">
|
|
68
|
+
<div class="card-header">
|
|
69
|
+
<h5 class="mb-0">Exported File</h5>
|
|
70
|
+
</div>
|
|
71
|
+
<div class="card-body">
|
|
72
|
+
<table class="table table-borderless">
|
|
73
|
+
<tbody>
|
|
74
|
+
<tr>
|
|
75
|
+
<th scope="row" style="width: 200px;">Filename</th>
|
|
76
|
+
<td><%= @export.exported_file_name %></td>
|
|
77
|
+
</tr>
|
|
78
|
+
<tr>
|
|
79
|
+
<th scope="row">File Size</th>
|
|
80
|
+
<td><%= number_to_human_size(@export.file_size_bytes) %></td>
|
|
81
|
+
</tr>
|
|
82
|
+
<tr>
|
|
83
|
+
<th scope="row">Content Type</th>
|
|
84
|
+
<td><code><%= @export.exported_file.content_type %></code></td>
|
|
85
|
+
</tr>
|
|
86
|
+
<tr>
|
|
87
|
+
<th scope="row">Download</th>
|
|
88
|
+
<td>
|
|
89
|
+
<%= link_to 'Download File', @export.exported_file_url, target: '_blank', class: 'btn btn-sm btn-primary' %>
|
|
90
|
+
</td>
|
|
91
|
+
</tr>
|
|
92
|
+
</tbody>
|
|
93
|
+
</table>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<% else %>
|
|
97
|
+
<div class="alert alert-info">
|
|
98
|
+
<i class="fa fa-info-circle"></i> No file attached to this export yet.
|
|
99
|
+
</div>
|
|
100
|
+
<% end %>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<div class="col-md-4">
|
|
104
|
+
<% if @export.public_metadata.present? && @export.public_metadata.any? %>
|
|
105
|
+
<div class="mb-4 card">
|
|
106
|
+
<div class="card-header">
|
|
107
|
+
<h6 class="mb-0">Public Metadata</h6>
|
|
108
|
+
</div>
|
|
109
|
+
<div class="card-body">
|
|
110
|
+
<pre class="p-3 rounded bg-light" style="font-size: 0.85rem; max-height: 400px; overflow: auto;"><%= JSON.pretty_generate(@export.public_metadata) %></pre>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
<% end %>
|
|
114
|
+
|
|
115
|
+
<% if @export.private_metadata.present? && @export.private_metadata.any? %>
|
|
116
|
+
<div class="mb-4 card">
|
|
117
|
+
<div class="card-header">
|
|
118
|
+
<h6 class="mb-0">Private Metadata</h6>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="card-body">
|
|
121
|
+
<pre class="p-3 rounded bg-light" style="font-size: 0.85rem; max-height: 400px; overflow: auto;"><%= JSON.pretty_generate(@export.private_metadata) %></pre>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
<% end %>
|
|
125
|
+
|
|
126
|
+
<% if @export.public_metadata.blank? && @export.private_metadata.blank? %>
|
|
127
|
+
<div class="alert alert-secondary">
|
|
128
|
+
No metadata available for this export.
|
|
129
|
+
</div>
|
|
130
|
+
<% end %>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
data/config/routes.rb
CHANGED
|
@@ -100,7 +100,7 @@ Spree::Core::Engine.add_routes do
|
|
|
100
100
|
|
|
101
101
|
resources :s3_presigned_urls, only: %i[create new]
|
|
102
102
|
resources :guest_qr_codes, only: %i[index]
|
|
103
|
-
resources :exports, only: %i[index new create destroy]
|
|
103
|
+
resources :exports, only: %i[index show new create destroy]
|
|
104
104
|
resources :inventory_monitorings, only: [:index] do
|
|
105
105
|
member do
|
|
106
106
|
post :reset
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_cm_commissioner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.5.13.pre.
|
|
4
|
+
version: 2.5.13.pre.patch4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: spree
|
|
@@ -2157,6 +2157,7 @@ files:
|
|
|
2157
2157
|
- app/views/spree/admin/exports/_form.html.erb
|
|
2158
2158
|
- app/views/spree/admin/exports/index.html.erb
|
|
2159
2159
|
- app/views/spree/admin/exports/new.html.erb
|
|
2160
|
+
- app/views/spree/admin/exports/show.html.erb
|
|
2160
2161
|
- app/views/spree/admin/feature_images/_form.html.erb
|
|
2161
2162
|
- app/views/spree/admin/feature_images/edit.html.erb
|
|
2162
2163
|
- app/views/spree/admin/feature_images/index.html.erb
|