...
This commit is contained in:
22
services/users/project/api/models.py
Normal file
22
services/users/project/api/models.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from sqlalchemy import func
|
||||
|
||||
from project import db
|
||||
|
||||
|
||||
class User(db.Model):
|
||||
|
||||
__tablename__ = 'users'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
username = db.Column(db.String, nullable=False)
|
||||
email = db.Column(db.String, nullable=False)
|
||||
active = db.Column(db.Boolean, default=True, nullable=False)
|
||||
created_date = db.Column(db.DateTime, default=func.now(), nullable=False)
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
'id': self.id,
|
||||
'username': self.username,
|
||||
'email': self.email,
|
||||
'active': self.active,
|
||||
}
|
||||
Reference in New Issue
Block a user