Merged
Conversation
Drop the standalone Device model and consolidate push-token registration onto ApplicationPushDevice (subclass of ActionPushNative::Device) so deliver_by :action_push_native actually fires for tokens registered via POST /api/v1/shopkeeper/devices. - Drop devices table; rebuild action_push_native_devices with UUID primary key + UUID polymorphic owner + bundle_id / last_active_at columns + unique (platform, token) index - Move validations / active scope / last_active_at touching from Device onto ApplicationPushDevice - Shopkeeper has_many :application_push_devices, as: :owner - DevicesController now manages ApplicationPushDevice; JSONAPI type stays "device" via set_type :device on the new serializer - API contract change (pre-mobile-client): device.platform enum is now [apple, google] (matches Action Push Native's APNs/FCM convention). PRs #3-5 (iOS/Android substrate clients) will register with apple or google. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the gap noted in #59: tokens registered via
POST /api/v1/shopkeeper/devicesnow flow intoApplicationPushDevice, soItemTagNotifier'sdeliver_by :action_push_nativeactually has devices to push to.Devicemodel added in Add push notifications scaffolding via noticed v2 #59. Drop thedevicestable.action_push_native_deviceswith UUID primary key + UUID polymorphic owner +bundle_id/last_active_atcolumns + unique(platform, token)index (the gem's default migration uses bigint and a barebones schema).last_active_attouching fromDeviceontoApplicationPushDevice.Shopkeeper has_many :application_push_devices, as: :ownerreplaceshas_many :devices.Api::Shopkeeper::DevicePolicy→Api::Shopkeeper::ApplicationPushDevicePolicy;DeviceSerializer→ApplicationPushDeviceSerializer(JSONAPItypestaysdeviceviaset_type :device).DevicesControllerroute + path unchanged.API contract change
device.platformenum is now[apple, google](matches Action Push Native's APNs/FCM service convention) instead of[ios, android]. Done now because the mobile substrate clients haven't been built yet — PRs #3-5 (iOS/Android registration clients) will register withappleorgoogle. Avoids needing a translation layer in the model just to fight the gem's enum.Test plan
bin/rubocop— 243 files, 0 offensesbin/brakeman— 0 warningsbin/rails test— 419 runs, 870 assertions, 0 failures🤖 Generated with Claude Code