thecore_backend_commons 3.3.2 → 3.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e00a3c03a4daf89d782a5756fd238226916057be1155e6b7d42e91679c3c260e
4
- data.tar.gz: '071180898e2d45c251ed464db1c2a2d958838212cb889b99c5473ac44e6a197a'
3
+ metadata.gz: e7db8739006ce3d17f311656e5e475aacd9a216f9bbaca6a1b863c67b6076c25
4
+ data.tar.gz: bacadaf2fc6496435e66e15655b2968368973b2550eed642e993c6be76b6928c
5
5
  SHA512:
6
- metadata.gz: d551e4b09fcd54925c9d2e341865366bc360aeb6f648162dad3b150cea5a32e24f3677ae2fc7d81944c434792aa2d5b5653ad149d621f615716889b62169219c
7
- data.tar.gz: 10359bf2075f139311268edde06116c036d72e85deef3ae479f99259bbdb4a599ca6affc2203f55ee74ac91372c08677df0a2f3c0bd4b6f3985cbaf496b48a85
6
+ metadata.gz: 96ca054fe828e25f053dc4d213ccc0856e4fe52fbc7ee8a4b525c3252087b661f69a3baec6b01c96ba9bccf740fed489b0886c65b6db65c5567ef3d667e740a3
7
+ data.tar.gz: 979ce14b47d8eaa36a7cf721f0b1771d74c0f20d5ffbbb9686bd35ed136c077224a240fd796dddc3070d6ac577fb5a3b6fcf604a66104746bc1e7e326a14e1a1
@@ -0,0 +1,10 @@
1
+ class PushDispatchJob < ApplicationJob
2
+ queue_as :"#{ENV.fetch('COMPOSE_PROJECT_NAME', 'default')}_default"
3
+
4
+ def perform(push_message_id)
5
+ message = PushMessage.find_by(id: push_message_id)
6
+ return unless message
7
+
8
+ ThecoreBackendCommons::PushNotificationService.dispatch(message.push_subscriber, message)
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class AddMessageTypeToPushMessages < ActiveRecord::Migration[7.2]
2
+ def change
3
+ add_column :push_messages, :message_type, :string, null: false, default: "communication"
4
+ end
5
+ end
@@ -36,7 +36,15 @@ module ThecoreBackendCommons
36
36
  end
37
37
 
38
38
  def payload
39
- { title: @message.title, body: @message.body, url: @message.url, icon: @message.icon }.compact
39
+ {
40
+ id: @message.id,
41
+ title: @message.title,
42
+ body: @message.body,
43
+ sent_at: @message.created_at.iso8601,
44
+ type: @message.message_type,
45
+ url: @message.url,
46
+ icon: @message.icon
47
+ }.compact
40
48
  end
41
49
 
42
50
  def vapid_options
@@ -1,3 +1,3 @@
1
1
  module ThecoreBackendCommons
2
- VERSION = "3.3.2".freeze
2
+ VERSION = "3.4.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_backend_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
@@ -203,6 +203,7 @@ files:
203
203
  - Rakefile
204
204
  - app/channels/activity_log_channel.rb
205
205
  - app/channels/push_notification_channel.rb
206
+ - app/jobs/push_dispatch_job.rb
206
207
  - app/mailers/concerns/smtp_deliverable.rb
207
208
  - app/models/push_message.rb
208
209
  - app/models/push_subscriber.rb
@@ -223,6 +224,7 @@ files:
223
224
  - db/migrate/20260616000001_create_push_subscribers.rb
224
225
  - db/migrate/20260616000002_create_push_messages.rb
225
226
  - db/migrate/20260625000001_add_sender_user_id_to_push_messages.rb
227
+ - db/migrate/20260629000001_add_message_type_to_push_messages.rb
226
228
  - db/seeds.rb
227
229
  - lib/tasks/thecore_backend_commons_tasks.rake
228
230
  - lib/thecore_backend_commons.rb