diff --git a/README.md b/README.md index 601bbc91..1324843b 100644 --- a/README.md +++ b/README.md @@ -870,6 +870,7 @@ If success, 200 with the list of aliases. Each alias has the following fields: - id - email +- name - enabled - creation_timestamp - note @@ -896,6 +897,7 @@ Here's an example: "creation_date": "2020-04-06 17:57:14+00:00", "creation_timestamp": 1586195834, "email": "prefix1.cat@sl.local", + "name": "A Name", "enabled": true, "id": 3, "mailbox": { @@ -920,6 +922,7 @@ Here's an example: "creation_date": "2020-04-06 17:57:14+00:00", "creation_timestamp": 1586195834, "email": "prefix0.hey@sl.local", + "name": null, "enabled": true, "id": 2, "mailbox": { @@ -1046,6 +1049,7 @@ Input: - `alias_id` in url. - (optional) `note` in request body - (optional) `mailbox_id` in request body +- (optional) `name` in request body Output: If success, return 200 diff --git a/app/api/serializer.py b/app/api/serializer.py index edd0dfc2..58d44d5a 100644 --- a/app/api/serializer.py +++ b/app/api/serializer.py @@ -47,6 +47,7 @@ def serialize_alias_info_v2(alias_info: AliasInfo) -> dict: "creation_timestamp": alias_info.alias.created_at.timestamp, "enabled": alias_info.alias.enabled, "note": alias_info.alias.note, + "name": alias_info.alias.name, # activity "nb_forward": alias_info.nb_forward, "nb_block": alias_info.nb_blocked, diff --git a/app/api/views/alias.py b/app/api/views/alias.py index b407d57d..a75d8b38 100644 --- a/app/api/views/alias.py +++ b/app/api/views/alias.py @@ -253,6 +253,7 @@ def update_alias(alias_id): Input: alias_id: in url note: in body + name: in body Output: 200 """ @@ -281,6 +282,11 @@ def update_alias(alias_id): alias.mailbox_id = mailbox_id changed = True + if "name" in data: + new_name = data.get("name") + alias.name = new_name + changed = True + if changed: db.session.commit() diff --git a/app/dashboard/templates/dashboard/index.html b/app/dashboard/templates/dashboard/index.html index 0f9344c0..64b1db0a 100644 --- a/app/dashboard/templates/dashboard/index.html +++ b/app/dashboard/templates/dashboard/index.html @@ -212,10 +212,16 @@ -