Standardization of json responses

This commit is contained in:
2022-03-22 11:21:39 +01:00
parent bd5768527e
commit 40d3e3238d
8 changed files with 33 additions and 33 deletions

80
api/schema.py Normal file
View File

@@ -0,0 +1,80 @@
from apiflask import Schema
from apiflask.fields import Integer, String, Boolean, Field, Float
class BaseResponseSchema(Schema):
text = String()
status = Integer()
data = Field()
class UsersSchema(Schema):
admin = Boolean()
password = String()
telegram_name = String()
user_id = Integer()
username = String()
class AdminDataSchema(Schema):
username = String()
admin = Boolean()
class TokenSchema(Schema):
token = String()
class LoginDataSchema(Schema):
username = String()
password = String()
class DeleteUserSchema(Schema):
username = String()
class ChangePasswordSchema(Schema):
old_password = String()
new_password = String()
class ChangeUsernameSchema(Schema):
new_username = String()
class KeywordSchema(Schema):
keyword = String()
class KeywordResponseSchema(Schema):
keyword = String()
s_id = Integer()
user_id = Integer()
class SymbolSchema(Schema):
symbol = String()
class SymbolResponseSchema(Schema):
symbol = String()
s_id = Integer()
user_id = Integer()
class PortfolioShareResponseSchema(Schema):
count = Integer()
last_transaction = String()
class TransactionSchema(Schema):
user_id = Integer()
symbol = String()
time = String()
count = Integer()
price = Float()
class DeleteSuccessfulSchema(Schema):
pass