chore: Add Contact Note APIs (#3266)
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class Note < ApplicationRecord
|
||||
before_validation :ensure_account_id
|
||||
validates :content, presence: true
|
||||
validates :account_id, presence: true
|
||||
validates :contact_id, presence: true
|
||||
@@ -31,4 +32,10 @@ class Note < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :contact
|
||||
belongs_to :user
|
||||
|
||||
private
|
||||
|
||||
def ensure_account_id
|
||||
self.account_id = contact&.account_id
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user