api is ready, start connect to imei checking
This commit is contained in:
parent
9462dd4465
commit
8161d77084
@ -7,6 +7,7 @@ authors = [
|
|||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fastapi[standard]>=0.115.7",
|
"fastapi[standard]>=0.115.7",
|
||||||
|
"pydantic>=2.10.5",
|
||||||
]
|
]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">= 3.12"
|
requires-python = ">= 3.12"
|
||||||
|
0
api/src/__init__.py
Normal file
0
api/src/__init__.py
Normal file
1
api/src/api/__init__.py
Normal file
1
api/src/api/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from .check_imei import checking_router as checking_router
|
15
api/src/api/check_imei.py
Normal file
15
api/src/api/check_imei.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from fastapi import APIRouter, status
|
||||||
|
|
||||||
|
from src.schemas import CheckingInput, CheckingOutput
|
||||||
|
|
||||||
|
|
||||||
|
checking_router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
@checking_router.post(
|
||||||
|
"/check-imei",
|
||||||
|
status_code=status.HTTP_200_OK,
|
||||||
|
response_model=CheckingOutput
|
||||||
|
)
|
||||||
|
async def check_imei(body: CheckingInput):
|
||||||
|
return CheckingOutput(result="OK")
|
@ -1,6 +1,8 @@
|
|||||||
from fastapi import APIRouter, FastAPI
|
from fastapi import APIRouter, FastAPI
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
|
from src.api import checking_router
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="hatiko-api",
|
title="hatiko-api",
|
||||||
)
|
)
|
||||||
@ -14,6 +16,9 @@ app.add_middleware(
|
|||||||
|
|
||||||
main_app_router = APIRouter(prefix="/api")
|
main_app_router = APIRouter(prefix="/api")
|
||||||
|
|
||||||
app.include_router(main_app_router)
|
main_app_router.include_router(checking_router, tags=["Check IMEI"])
|
||||||
|
|
||||||
|
|
||||||
|
app.include_router(checking_router)
|
||||||
|
|
||||||
|
|
||||||
|
2
api/src/schemas/__init__.py
Normal file
2
api/src/schemas/__init__.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
from .checking import CheckingInput as CheckingInput
|
||||||
|
from .checking import CheckingOutput as CheckingOutput
|
14
api/src/schemas/checking.py
Normal file
14
api/src/schemas/checking.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
from typing import Any
|
||||||
|
from pydantic import BaseModel, ConfigDict
|
||||||
|
|
||||||
|
class CheckingOutput(BaseModel):
|
||||||
|
model_config = ConfigDict(from_attributes=True)
|
||||||
|
|
||||||
|
result: Any
|
||||||
|
|
||||||
|
|
||||||
|
class CheckingInput(BaseModel):
|
||||||
|
model_config = ConfigDict(from_attributes=True)
|
||||||
|
|
||||||
|
imei: str
|
||||||
|
token: str
|
Loading…
x
Reference in New Issue
Block a user