[Script][System] Added date as export format and added birthday as user attribute
This commit is contained in:
parent
04753e9a41
commit
1d36aa4033
|
@ -1,7 +1,7 @@
|
|||
import pkg_resources
|
||||
from flask import Flask, current_app
|
||||
from flask_cors import CORS
|
||||
from datetime import datetime
|
||||
from datetime import datetime, date
|
||||
from flask.json import JSONEncoder, jsonify
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
|
@ -19,7 +19,7 @@ class CustomJSONEncoder(JSONEncoder):
|
|||
except AttributeError:
|
||||
pass
|
||||
|
||||
if isinstance(o, datetime):
|
||||
if isinstance(o, datetime) or isinstance(o, date):
|
||||
return o.isoformat()
|
||||
|
||||
# Check if iterable
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
from datetime import date
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy.orm.collections import attribute_mapped_collection
|
||||
|
||||
from . import ModelSerializeMixin
|
||||
|
@ -42,14 +45,16 @@ class User(db.Model, ModelSerializeMixin):
|
|||
firstname: Firstname of the User
|
||||
lastname: Lastname of the User
|
||||
mail: mail address of the User
|
||||
birthday: Birthday of the user
|
||||
"""
|
||||
|
||||
__tablename__ = "user"
|
||||
userid: str = db.Column(db.String(30), nullable=False)
|
||||
display_name: str = db.Column(db.String(30))
|
||||
firstname: str = db.Column(db.String(50))
|
||||
lastname: str = db.Column(db.String(50))
|
||||
mail: str = db.Column(db.String(60))
|
||||
firstname: str = db.Column(db.String(50), nullable=False)
|
||||
lastname: str = db.Column(db.String(50), nullable=False)
|
||||
mail: str = db.Column(db.String(60), nullable=False)
|
||||
birthday: Optional[date] = db.Column(db.Date)
|
||||
roles: [str] = []
|
||||
|
||||
roles_: [Role] = db.relationship("Role", secondary=association_table, cascade="save-update, merge")
|
||||
|
|
|
@ -9,7 +9,7 @@ import pkg_resources
|
|||
class InterfaceGenerator:
|
||||
known = []
|
||||
classes = {}
|
||||
mapper = {"str": "string", "int": "number", "float": "number", "datetime": "Date", "NoneType": "null"}
|
||||
mapper = {"str": "string", "int": "number", "float": "number", "date": "Date", "datetime": "Date", "NoneType": "null"}
|
||||
|
||||
def __init__(self, namespace, filename):
|
||||
self.basename = ""
|
||||
|
|
Loading…
Reference in New Issue