Browse Source

add is_deleted to UserSchema

Guénaël Muller 6 years ago
parent
commit
f8f1091b6d

+ 4 - 0
backend/tracim_backend/models/context_models.py View File

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

+ 2 - 0
backend/tracim_backend/tests/functional/test_user.py View File

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

+ 4 - 0
backend/tracim_backend/views/core_api/schemas.py View File

74
         example=True,
74
         example=True,
75
         description='Is user account activated ?'
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
     # TODO - G.M - 17-04-2018 - Restrict timezone values
81
     # TODO - G.M - 17-04-2018 - Restrict timezone values
78
     timezone = marshmallow.fields.String(
82
     timezone = marshmallow.fields.String(
79
         example="Europe/Paris",
83
         example="Europe/Paris",