''wip(semantic):调整序列化返回结果

This commit is contained in:
zhengxinonly
2021-09-15 00:45:35 +08:00
parent 550f99e468
commit 316ebc2441
21 changed files with 200 additions and 164 deletions
+18 -2
View File
@@ -1,3 +1,5 @@
from flask_restful import fields
from applications.extensions import db
from ..base import BaseModel
@@ -7,9 +9,23 @@ class RightsRole(db.Model, BaseModel):
id = db.Column(db.Integer, primary_key=True, comment='角色ID')
name = db.Column(db.String(255), comment='角色名称')
code = db.Column(db.String(255), comment='角色标识')
enable = db.Column(db.Integer, comment='是否启用')
remark = db.Column(db.String(255), comment='备注')
enable = db.Column(db.Boolean, comment='是否启用')
comment = db.Column(db.String(255), comment='备注')
details = db.Column(db.String(255), comment='详情')
sort = db.Column(db.Integer, comment='排序')
power = db.relationship('RightsPower', secondary="rt_role_power", backref=db.backref('role'))
@staticmethod
def fields():
return {
'id': fields.Integer,
'roleName': fields.String(attribute="name"),
'roleCode': fields.String(attribute="code"),
'enable': fields.Boolean,
'comment': fields.String,
'details': fields.String,
'sort': fields.Integer,
'create_at': fields.DateTime,
'update_at': fields.DateTime,
}