From ea2166bdc733662e1d39336c1a0817dfd9078ee3 Mon Sep 17 00:00:00 2001 From: Jongmin Kim Date: Wed, 20 Nov 2024 20:41:15 +0900 Subject: [PATCH] refactor: refactor user group model Signed-off-by: Jongmin Kim --- src/spaceone/identity/model/user_group/database.py | 7 +++++-- src/spaceone/identity/model/user_group/response.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/spaceone/identity/model/user_group/database.py b/src/spaceone/identity/model/user_group/database.py index 968ab4c..e3717db 100644 --- a/src/spaceone/identity/model/user_group/database.py +++ b/src/spaceone/identity/model/user_group/database.py @@ -10,19 +10,22 @@ class UserGroup(MongoModel): tags = DictField(Default=None) workspace_id = StringField(max_length=40, required=True) domain_id = StringField(max_length=40) + created_at = DateTimeField(auto_now_add=True) meta = { "updatable_fields": ["name", "description", "users", "tags"], "minimal_fields": [ "user_group_id", "name", - "users", "workspace_id", "domain_id", ], - "ordering": ["name", "user_group_id"], + "change_query_keys": {"user_id": "users"}, + "ordering": ["name"], "indexes": [ "name", "workspace_id", + "domain_id", + "users", ], } diff --git a/src/spaceone/identity/model/user_group/response.py b/src/spaceone/identity/model/user_group/response.py index b051671..af43542 100644 --- a/src/spaceone/identity/model/user_group/response.py +++ b/src/spaceone/identity/model/user_group/response.py @@ -18,6 +18,7 @@ class UserGroupResponse(BaseModel): def dict(self, *args, **kwargs): data = super().dict(*args, **kwargs) data["created_at"] = utils.datetime_to_iso8601(data["created_at"]) + return data