Esto eliminará la página "UpdateAddressList". Por favor, asegúrate de que es lo que quieres.
create or replace function api."UpdateAddressList"(
_address_list uuid -- id of the address list
, _action capitalshorttext -- "REPLACE" will add new phone numbers and delete unused ones
, _name shorttext default null -- Optional: will change existing address list name
, _mobiles mobile[] default null -- Optional : full list of all phone numbers in the list
)
It takes in four parameters: an ID of the address list (_address_list), an action (_action) that indicates whether to replace existing phone numbers with new ones or not, an optional name for the address list (_name), and an array of mobile numbers (_mobiles).
The function begins by calling a set_info function (h.set_info) that sets a message about contacts that have already received SMS or email not being deleted from the list. Then, it checks if the _name parameter is not null, and if so, updates the name of the address list in the forms.address_lists table.
Next, if the _mobiles parameter is not null, it inserts the mobile numbers into the forms.address_lists_entries table, using the ON CONFLICT DO NOTHING clause to prevent duplicates. Finally, the function returns a table with the updated address list, its name, and a JSONB object containing all the mobile numbers in the list.
Esto eliminará la página "UpdateAddressList". Por favor, asegúrate de que es lo que quieres.