2020-05-01 09:23:43 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: notification_subscriptions
|
|
|
|
#
|
|
|
|
# id :bigint not null, primary key
|
2020-05-05 18:40:56 +00:00
|
|
|
# identifier :string
|
2020-05-01 09:23:43 +00:00
|
|
|
# subscription_attributes :jsonb not null
|
|
|
|
# subscription_type :integer not null
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
|
|
|
# user_id :bigint not null
|
|
|
|
#
|
|
|
|
# Indexes
|
|
|
|
#
|
2020-05-05 18:40:56 +00:00
|
|
|
# index_notification_subscriptions_on_identifier (identifier) UNIQUE
|
|
|
|
# index_notification_subscriptions_on_user_id (user_id)
|
2020-05-01 09:23:43 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
class NotificationSubscription < ApplicationRecord
|
|
|
|
belongs_to :user
|
2020-05-05 18:40:56 +00:00
|
|
|
validates :identifier, presence: true
|
2020-05-01 09:23:43 +00:00
|
|
|
|
|
|
|
SUBSCRIPTION_TYPES = {
|
|
|
|
browser_push: 1,
|
|
|
|
gcm: 2
|
|
|
|
}.freeze
|
|
|
|
|
|
|
|
enum subscription_type: SUBSCRIPTION_TYPES
|
|
|
|
end
|