ソースを参照

add is_deleted to UserSchema

Guénaël Muller 6 年 前
コミット
f8f1091b6d

+ 4 - 0
backend/tracim_backend/models/context_models.py ファイルの表示

@@ -391,6 +391,10 @@ class UserInContext(object):
391 391
     def profile(self) -> Profile:
392 392
         return self.user.profile.name
393 393
 
394
+    @property
395
+    def is_deleted(self) -> bool:
396
+        return self.user.is_deleted
397
+
394 398
     # Context related
395 399
 
396 400
     @property

+ 2 - 0
backend/tracim_backend/tests/functional/test_user.py ファイルの表示

@@ -2533,6 +2533,7 @@ class TestUserEndpoint(FunctionalTest):
2533 2533
         assert res['email'] == 'test@test.test'
2534 2534
         assert res['public_name'] == 'bob'
2535 2535
         assert res['timezone'] == 'Europe/Paris'
2536
+        assert res['is_deleted'] is False
2536 2537
 
2537 2538
     def test_api__get_user__ok_200__user_itself(self):
2538 2539
         dbsession = get_tm_session(self.session_factory, transaction.manager)
@@ -2582,6 +2583,7 @@ class TestUserEndpoint(FunctionalTest):
2582 2583
         assert res['email'] == 'test@test.test'
2583 2584
         assert res['public_name'] == 'bob'
2584 2585
         assert res['timezone'] == 'Europe/Paris'
2586
+        assert res['is_deleted'] is False
2585 2587
 
2586 2588
     def test_api__get_user__err_403__other_normal_user(self):
2587 2589
         dbsession = get_tm_session(self.session_factory, transaction.manager)

+ 4 - 0
backend/tracim_backend/views/core_api/schemas.py ファイルの表示

@@ -74,6 +74,10 @@ class UserSchema(UserDigestSchema):
74 74
         example=True,
75 75
         description='Is user account activated ?'
76 76
     )
77
+    is_deleted = marshmallow.fields.Bool(
78
+        example=False,
79
+        description='Is user account deleted ?'
80
+    )
77 81
     # TODO - G.M - 17-04-2018 - Restrict timezone values
78 82
     timezone = marshmallow.fields.String(
79 83
         example="Europe/Paris",