Fix: Added the backend validation for name (#3878)
- Added the backend validation for name - Add message size constraint
This commit is contained in:
@@ -33,6 +33,7 @@ class Account < ApplicationRecord
|
||||
|
||||
validates :name, presence: true
|
||||
validates :auto_resolve_duration, numericality: { greater_than_or_equal_to: 1, less_than_or_equal_to: 999, allow_nil: true }
|
||||
validates :name, length: { maximum: 255 }
|
||||
|
||||
has_many :account_users, dependent: :destroy_async
|
||||
has_many :agent_bot_inboxes, dependent: :destroy_async
|
||||
|
||||
@@ -36,6 +36,7 @@ class Contact < ApplicationRecord
|
||||
validates :phone_number,
|
||||
allow_blank: true, uniqueness: { scope: [:account_id] },
|
||||
format: { with: /\+[1-9]\d{1,14}\z/, message: 'should be in e164 format' }
|
||||
validates :name, length: { maximum: 255 }
|
||||
|
||||
belongs_to :account
|
||||
has_many :conversations, dependent: :destroy_async
|
||||
|
||||
@@ -39,6 +39,7 @@ class Message < ApplicationRecord
|
||||
validates :conversation_id, presence: true
|
||||
validates_with ContentAttributeValidator
|
||||
validates :content_type, presence: true
|
||||
validates :content, length: { maximum: 150_000 }
|
||||
|
||||
# when you have a temperory id in your frontend and want it echoed back via action cable
|
||||
attr_accessor :echo_id
|
||||
|
||||
@@ -68,7 +68,7 @@ class User < ApplicationRecord
|
||||
# validates_uniqueness_of :email, scope: :account_id
|
||||
|
||||
validates :email, :name, presence: true
|
||||
validates_length_of :name, minimum: 1
|
||||
validates_length_of :name, minimum: 1, maximum: 255
|
||||
|
||||
has_many :account_users, dependent: :destroy_async
|
||||
has_many :accounts, through: :account_users
|
||||
|
||||
Reference in New Issue
Block a user