瀏覽代碼

models to schemas

CJYen 3 年之前
父節點
當前提交
60f99b539c

+ 2 - 2
app/api/api_v1/endpoints/joyso.py

@@ -1,7 +1,7 @@
 import requests
 from random import randrange
 import json
-from app.api.api_v1.endpoints import models
+from app.schemas import joyso
 from fastapi import APIRouter
 import uuid
 
@@ -21,7 +21,7 @@ headers = {'Authorization': 'Basic %s' %
 
 # Mint
 @router.post("/mint")
-async def mint(userModel : models.joysoMint):
+async def mint(userModel : joyso.joysoMint):
     path = "erc1155/mint"
     txid = str(uuid.uuid4())
     to = userModel.toaddress

+ 4 - 4
app/api/api_v1/endpoints/line.py

@@ -15,7 +15,7 @@ import qrcode
 # from PIL import Image
 # import base64, io
 from random import randrange
-from app.api.api_v1.endpoints import models
+from app.schemas import line
 import datetime as dt
 from fastapi import APIRouter
 
@@ -217,7 +217,7 @@ def receive(userid):
 
 # send handler
 @router.post("/send")
-async def receive(userModel : models.TransactionNft):
+async def receive(userModel : line.TransactionNft):
     # db connect
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/arkcard?charset=utf8mb4')
     table = db['users']
@@ -291,7 +291,7 @@ def shop(userid):
     db.close()
 
 @router.post("/buy")
-async def buy(userModel: models.BuyNft):
+async def buy(userModel: line.BuyNft):
     # db connect
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/arkcard?charset=utf8mb4')
     table2 = db['nft']
@@ -321,7 +321,7 @@ async def buy(userModel: models.BuyNft):
     return "您已購買成功!"
 
 @router.post("/event")
-async def nftdrops(userModel : models.NftDrops):
+async def nftdrops(userModel : line.NftDrops):
     # db connect
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/arkcard?charset=utf8mb4')
     table3 = db['nftdrops']

+ 0 - 0
app/api/api_v1/endpoints/linepay.py


+ 5 - 0
app/schemas/joyso.py

@@ -0,0 +1,5 @@
+from pydantic import BaseModel
+
+class joysoMint(BaseModel):
+    toaddress: str
+    amount: int

+ 0 - 4
app/api/api_v1/endpoints/models.py → app/schemas/line.py

@@ -15,7 +15,3 @@ class NftDrops(BaseModel):
 class callBack(BaseModel):
     type: str
     data: dict
-
-class joysoMint(BaseModel):
-    toaddress: str
-    amount: int