feat: Bulk add team members in Team APIs (#1695)

This commit is contained in:
Sojan Jose
2021-01-29 12:34:52 +05:30
committed by GitHub
parent bf7915c8a3
commit f9c3b7f2f1
8 changed files with 58 additions and 18 deletions

View File

@@ -12,14 +12,26 @@
#
# Indexes
#
# index_teams_on_account_id (account_id)
# index_teams_on_account_id (account_id)
# index_teams_on_name_and_account_id (name,account_id) UNIQUE
#
# Foreign Keys
#
# fk_rails_... (account_id => accounts.id)
#
class Team < ApplicationRecord
include RegexHelper
belongs_to :account
has_many :team_members, dependent: :destroy
has_many :conversations, dependent: :nullify
validates :name,
presence: { message: 'must not be blank' },
format: { with: UNICODE_CHARACTER_NUMBER_HYPHEN_UNDERSCORE },
uniqueness: { scope: :account_id }
before_validation do
self.name = name.downcase if attribute_present?('name')
end
end

View File

@@ -10,8 +10,9 @@
#
# Indexes
#
# index_team_members_on_team_id (team_id)
# index_team_members_on_user_id (user_id)
# 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
#