diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-02-09 11:32:10 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-02-13 12:13:00 +0100 |
commit | 9be4de87b7ba14adc6754f408d855b960ffeca25 (patch) | |
tree | a39db25f300b338ffb71a538485f22c646286d06 /cli/objects/center.py | |
parent | 499272fa2996fa0d1152645e190d8012b6b83a50 (diff) |
ogcli: add update command for folder, room and center
Expand of the update command to be able to modify the values of
previous folder, room and center configurations.
Diffstat (limited to 'cli/objects/center.py')
-rw-r--r-- | cli/objects/center.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cli/objects/center.py b/cli/objects/center.py index 0318a57..80e5e3e 100644 --- a/cli/objects/center.py +++ b/cli/objects/center.py @@ -26,6 +26,31 @@ class OgCenter(): rest.post('/center/add', payload=payload) @staticmethod + def update_center(rest, args): + parser = argparse.ArgumentParser(prog='ogcli update center') + parser.add_argument('--id', + type=int, + nargs='?', + required=True, + help='center id in database') + parser.add_argument('--name', + nargs='?', + required=True, + help='the new name for the center') + parser.add_argument('--comment', + nargs='?', + required=False, + help='the new comment for the center') + parsed_args = parser.parse_args(args) + payload = { + 'id': parsed_args.id, + 'name': parsed_args.name, + } + if parsed_args.comment: + payload['comment'] = parsed_args.comment + rest.post('/center/update', payload=payload) + + @staticmethod def delete_center(rest, args): parser = argparse.ArgumentParser(prog='ogcli delete center') parser.add_argument('--id', |