Added the sqlite3 database
This commit is contained in:
19
backend/app/routers/dewar.py
Normal file
19
backend/app/routers/dewar.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from fastapi import APIRouter, HTTPException, status
|
||||
from typing import List, Optional
|
||||
import uuid
|
||||
from app.data.data import dewars, contacts, return_addresses
|
||||
from app.models import Dewar, ContactPerson, Address
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/", response_model=List[Dewar])
|
||||
async def get_dewars():
|
||||
return dewars
|
||||
|
||||
@router.post("/", response_model=Dewar, status_code=status.HTTP_201_CREATED)
|
||||
async def create_dewar(dewar: Dewar) -> Dewar:
|
||||
dewar_id = f'DEWAR-{uuid.uuid4().hex[:8].upper()}'
|
||||
dewar.id = dewar_id
|
||||
dewars.append(dewar)
|
||||
return dewar
|
||||
Reference in New Issue
Block a user