Chatwoot/app/models/team_member.rb
Sojan Jose 009abc1948
chore: API improvements (#3637)
- Unique validations for Inbox members and Team member objects
- Move notification processing to Async
2021-12-21 22:48:01 +05:30

26 lines
744 B
Ruby

# == Schema Information
#
# Table name: team_members
#
# id :bigint not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# team_id :bigint not null
# user_id :bigint not null
#
# Indexes
#
# index_team_members_on_team_id (team_id)
# index_team_members_on_team_id_and_user_id (team_id,user_id) UNIQUE
# index_team_members_on_user_id (user_id)
#
# Foreign Keys
#
# fk_rails_... (team_id => teams.id) ON DELETE => cascade
# fk_rails_... (user_id => users.id) ON DELETE => cascade
#
class TeamMember < ApplicationRecord
belongs_to :user
belongs_to :team
validates :user_id, uniqueness: { scope: :team_id }
end