key # activity_type :string(50) not null # body :text(65535) not null # deleted_at :datetime not null # dst_type :string(50) not null # read :boolean default(FALSE), not null # title :string(100) default(""), not null # created_at :datetime not null # updated_at :datetime not null # activity_id :bigint(8) not null # notifier_id :bigint(8) not null # receiver_id :bigint(8) not null NotificationMappings # id :bigint(8) not null, primary key # activity_type :string(50) not null # body :text(65535) not null # deleted_at :datetime # dst_type :string(50) not null # receiver_type :string(50) not null # title :string(100) default(""), not null # created_at :datetime not null # updated_at :datetime not null Activities # id :bigint(8) not null, primary key # activitiable_id :bigint(8) not null # activitiable_type :string(45) not null # activity_type :string(50) not null # deleted_at :datetime not null # created_at :datetime not null # updated_at :datetime not null # user_id :bigint(8) not null RegistrationTokens # id :bigint(8) not null, primary key # token :string(255) not null # created_at :datetime not null # updated_at :datetime not null # user_id :bigint(8) not null
< Api::V1::ApplicationController # POST /api/v1/stations/:station_id/tickets/:ticket_id/like def create station = Station.find(params[:station_id]) ticket = station.tickets.find(params[:ticket_id]) LikeContentService.execute(user: current_user, content: ticket, activity_type: 'tickets/likes.create', dst_type: 'tickets.show') head :created end end end end end
௨ઌͷొτʔΫϯऔಘ registration_tokens = @notification.receiver.registration_tokens return if registration_tokens.blank? registration_tokens.each do |registration_token| Notifications::PushNotificationWorker .perform(registration_token, message(registration_token.token).to_json) end rescue StandardError => e Rails.logger.error(e) false end