|
@@ -1,5 +1,8 @@
|
1
|
1
|
# coding=utf-8
|
2
|
2
|
import marshmallow
|
|
3
|
+from marshmallow import post_load
|
|
4
|
+
|
|
5
|
+from tracim.models.context_models import LoginCredentials, UserInContext
|
3
|
6
|
|
4
|
7
|
|
5
|
8
|
class ProfileSchema(marshmallow.Schema):
|
|
@@ -8,6 +11,7 @@ class ProfileSchema(marshmallow.Schema):
|
8
|
11
|
|
9
|
12
|
|
10
|
13
|
class UserSchema(marshmallow.Schema):
|
|
14
|
+
|
11
|
15
|
user_id = marshmallow.fields.Int(dump_only=True)
|
12
|
16
|
email = marshmallow.fields.Email(required=True)
|
13
|
17
|
display_name = marshmallow.fields.String()
|
|
@@ -29,9 +33,14 @@ class UserSchema(marshmallow.Schema):
|
29
|
33
|
|
30
|
34
|
|
31
|
35
|
class BasicAuthSchema(marshmallow.Schema):
|
|
36
|
+
|
32
|
37
|
email = marshmallow.fields.Email(required=True)
|
33
|
38
|
password = marshmallow.fields.String(required=True, load_only=True)
|
34
|
39
|
|
|
40
|
+ @post_load
|
|
41
|
+ def make_login(self, data):
|
|
42
|
+ return LoginCredentials(**data)
|
|
43
|
+
|
35
|
44
|
|
36
|
45
|
class LoginOutputHeaders(marshmallow.Schema):
|
37
|
46
|
expire_after = marshmallow.fields.String()
|