summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2020-11-05 11:42:40 +0100
committerSanto Cariotti <santo@dcariotti.me>2020-11-05 11:42:40 +0100
commit5e0980e88ad9659a3176567d3fb041a890ab1436 (patch)
treec5de3ff730b6f0e4ca6ef9f99acc97ec0ca9bcdf
parenta8f3ee3bbd28517ac535923ce7a2180811e81f69 (diff)
fix: user serialized
AREA AFFECTED: User serialized on extend model ROOT CAUSE: Missed as_json method FIX: Add as_json for User model
-rw-r--r--frest/auth/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/frest/auth/models.py b/frest/auth/models.py
index da7f22c..6c0d6f3 100644
--- a/frest/auth/models.py
+++ b/frest/auth/models.py
@@ -33,6 +33,16 @@ class User(db.Model):
def __repr__(self):
return f"<User '{self.userId}'>"
+ def as_json(self):
+ _d = {
+ "userId": self.userId,
+ "email": self.email,
+ "is_admin": self.is_admin,
+ "name": self.name,
+ "created_at": self.created_at,
+ }
+ return _d
+
class Token(db.Model):
tokenId = db.Column(db.Integer, primary_key=True)