Moved API models to separate file

This commit is contained in:
Ivan Golikov 2022-12-17 14:34:40 +01:00
parent 50e886f4d6
commit db72c2a6e4
2 changed files with 11 additions and 10 deletions

View file

@ -1,21 +1,12 @@
from fastapi import FastAPI
from pydantic import BaseModel
from rectes.models import Secret, SecretSaveResult
from rectes.redis_db import redis
from rectes.utils import get_new_key
app = FastAPI()
class Secret(BaseModel):
data: str
class SecretSaveResult(BaseModel):
status: str
retrieval_url: str
@app.post("/secret", response_model=SecretSaveResult)
async def set_secret(data: Secret):
new_key = await get_new_key()

10
src/rectes/models.py Normal file
View file

@ -0,0 +1,10 @@
from pydantic import BaseModel
class Secret(BaseModel):
data: str
class SecretSaveResult(BaseModel):
status: str
retrieval_url: str