2022/1/22
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
from common.model import BaseModel, Column, String, Integer
|
||||
from pydantic import BaseModel as PModel
|
||||
|
||||
|
||||
class User(BaseModel):
|
||||
__tablename__ = 'admin_user'
|
||||
id = Column(Integer, primary_key=True, autoincrement=True, comment='用户ID')
|
||||
username = Column(String(20), comment='用户名')
|
||||
|
||||
|
||||
class Userschema(PModel):
|
||||
id: int
|
||||
username: str
|
||||
class Config:
|
||||
orm_mode = True
|
||||
@@ -1,13 +0,0 @@
|
||||
from common.view import Resource,Namespace
|
||||
|
||||
userns = Namespace('aa', ordered=True)
|
||||
|
||||
|
||||
@userns.route('/a')
|
||||
class MyResource(Resource):
|
||||
def get(self):
|
||||
return {}
|
||||
|
||||
@userns.response(403, 'Not Authorized')
|
||||
def post(self):
|
||||
userns.abort(403)
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import List
|
||||
|
||||
from common.view import Blueprint,View
|
||||
from flask import jsonify
|
||||
|
||||
from pydantic import BaseModel, ValidationError, constr, parse_obj_as
|
||||
|
||||
from modules.sys.models.user import User, Userschema
|
||||
|
||||
user = Blueprint('sys', __name__, url_prefix='/user')
|
||||
|
||||
|
||||
@user.route('/')
|
||||
class UserView(View):
|
||||
def get(self):
|
||||
u = User.query.all()
|
||||
# m = parse_obj_as(List[User], u)
|
||||
|
||||
return '1'
|
||||
Reference in New Issue
Block a user