feat: Add last_name and first name in widget end point

This commit is contained in:
Muhsin Keloth
2024-01-29 21:17:39 +05:30
parent d88d195e73
commit 66a7c2e84f
5 changed files with 21 additions and 4 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ class ContactIdentifyAction
pattr_initialize [:contact!, :params!, { retain_original_contact_name: false, discard_invalid_attrs: false }]
def perform
@attributes_to_update = [:identifier, :name, :email, :phone_number]
@attributes_to_update = [:identifier, :name, :email, :phone_number, :middle_name, :last_name]
ActiveRecord::Base.transaction do
merge_if_existing_identified_contact
@@ -70,7 +70,7 @@ class Api::V1::Widget::ContactsController < Api::V1::Widget::BaseController
end
def permitted_params
params.permit(:website_token, :identifier, :identifier_hash, :email, :name, :avatar_url, :phone_number, custom_attributes: {},
additional_attributes: {})
params.permit(:website_token, :identifier, :identifier_hash, :email, :name, :middle_name, :last_name, :avatar_url, :phone_number, custom_attributes: {},
additional_attributes: {})
end
end
@@ -3,3 +3,5 @@ json.name @contact.name
json.email @contact.email
json.phone_number @contact.phone_number
json.identifier @contact.identifier
json.middle_name @contact.middle_name
json.last_name @contact.last_name
@@ -2,3 +2,5 @@ json.id @contact.id
json.name @contact.name
json.email @contact.email
json.phone_number @contact.phone_number
json.middle_name @contact.middle_name
json.last_name @contact.last_name