验证码
邮件,依赖
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
|
||||
from common.model import BaseModel, Column, Integer, String, Text, DateTime
|
||||
from common.model import BaseModel, Column, Integer, String, Text, DateTime, SQLAlchemyAutoSchema
|
||||
|
||||
|
||||
class Dept(BaseModel):
|
||||
@@ -16,4 +16,11 @@ class Dept(BaseModel):
|
||||
remark = Column(Text, comment="备注")
|
||||
address = Column(String(255), comment="详细地址")
|
||||
create_at = Column(DateTime, default=datetime.datetime.now, comment='创建时间')
|
||||
update_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='创建时间')
|
||||
update_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='创建时间')
|
||||
|
||||
|
||||
class DeptSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Dept
|
||||
include_fk = True
|
||||
load_instance = True
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
|
||||
from common.model import BaseModel, Column, Integer, String, DateTime
|
||||
from common.model import BaseModel, Column, Integer, String, DateTime, SQLAlchemyAutoSchema
|
||||
|
||||
|
||||
class DictType(BaseModel):
|
||||
@@ -14,6 +14,13 @@ class DictType(BaseModel):
|
||||
update_time = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间')
|
||||
|
||||
|
||||
class DictTypeSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = DictType
|
||||
include_fk = True
|
||||
load_instance = True
|
||||
|
||||
|
||||
class DictData(BaseModel):
|
||||
__tablename__ = 'sys_dict_data'
|
||||
id = Column(Integer, primary_key=True)
|
||||
@@ -25,3 +32,10 @@ class DictData(BaseModel):
|
||||
remark = Column(String(255), comment='备注')
|
||||
create_time = Column(DateTime, default=datetime.datetime.now, comment='创建时间')
|
||||
update_time = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间')
|
||||
|
||||
|
||||
class DictDataSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = DictData
|
||||
include_fk = True
|
||||
load_instance = True
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
|
||||
from common.model import BaseModel, Column, Integer, String, Text, DateTime
|
||||
from common.model import BaseModel, Column, Integer, String, Text, DateTime, SQLAlchemyAutoSchema
|
||||
|
||||
|
||||
class AdminLog(BaseModel):
|
||||
@@ -13,4 +13,11 @@ class AdminLog(BaseModel):
|
||||
ip = Column(String(255))
|
||||
success = Column(Integer)
|
||||
user_agent = Column(Text)
|
||||
create_time = Column(DateTime, default=datetime.datetime.now)
|
||||
create_time = Column(DateTime, default=datetime.datetime.now)
|
||||
|
||||
|
||||
class AdminLogSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = AdminLog
|
||||
include_fk = True
|
||||
load_instance = True
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
|
||||
from common.model import BaseModel, Integer, Column, String, CHAR, DateTime
|
||||
from common.model import BaseModel, Integer, Column, String, CHAR, DateTime, SQLAlchemyAutoSchema
|
||||
|
||||
|
||||
class Photo(BaseModel):
|
||||
@@ -10,4 +10,11 @@ class Photo(BaseModel):
|
||||
href = Column(String(255))
|
||||
mime = Column(CHAR(50), nullable=False)
|
||||
size = Column(CHAR(30), nullable=False)
|
||||
create_time = Column(DateTime, default=datetime.datetime.now)
|
||||
create_time = Column(DateTime, default=datetime.datetime.now)
|
||||
|
||||
|
||||
class AdminLogSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Photo
|
||||
include_fk = True
|
||||
load_instance = True
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
|
||||
from common.model import BaseModel, Column, Integer, String, DateTime
|
||||
from common.model import BaseModel, Column, Integer, String, DateTime, SQLAlchemyAutoSchema
|
||||
|
||||
|
||||
class Power(BaseModel):
|
||||
@@ -17,3 +17,10 @@ class Power(BaseModel):
|
||||
create_time = Column(DateTime, default=datetime.datetime.now, comment='创建时间')
|
||||
update_time = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间')
|
||||
enable = Column(Integer, comment='是否开启')
|
||||
|
||||
|
||||
class PowerSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Power
|
||||
include_fk = True
|
||||
load_instance = True
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import datetime
|
||||
from common.model import BaseModel, Column, String, Integer, DateTime,relationship
|
||||
from common.model import BaseModel, Column, String, Integer, DateTime, relationship, SQLAlchemyAutoSchema
|
||||
|
||||
|
||||
class Role(BaseModel):
|
||||
@@ -14,3 +14,9 @@ class Role(BaseModel):
|
||||
create_time = Column(DateTime, default=datetime.datetime.now, comment='创建时间')
|
||||
update_time = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间')
|
||||
power = relationship('Power', secondary="admin_role_power", backref=backref('role'))
|
||||
|
||||
class RoleSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Role
|
||||
include_fk = True
|
||||
load_instance = True
|
||||
@@ -2,7 +2,7 @@ import datetime
|
||||
from flask_login import UserMixin
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
|
||||
from common.model import BaseModel, Column, Integer, String, DateTime, relationship
|
||||
from common.model import BaseModel, Column, Integer, String, DateTime, relationship, SQLAlchemyAutoSchema, backref
|
||||
|
||||
|
||||
class User(BaseModel, UserMixin):
|
||||
@@ -24,3 +24,12 @@ class User(BaseModel, UserMixin):
|
||||
|
||||
def validate_password(self, password):
|
||||
return check_password_hash(self.password_hash, password)
|
||||
|
||||
|
||||
# 如果要全换全部字段,就不要声明fields或exclude字段即可
|
||||
class UserRoleSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = User
|
||||
include_fk = True
|
||||
load_instance = True
|
||||
exclude = ['password_hash']
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
from typing import List
|
||||
|
||||
from common.view import Blueprint, View
|
||||
from flask import jsonify
|
||||
|
||||
from pydantic import BaseModel, ValidationError, constr, parse_obj_as
|
||||
|
||||
from entrance.extend.orm import db
|
||||
|
||||
user = Blueprint('sys', __name__, url_prefix='/user')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user