Skip to content
Snippets Groups Projects
Commit 77b14e5e authored by Aymeric Chaumont's avatar Aymeric Chaumont
Browse files

Merge branch 'restaurants-route' of...

Merge branch 'restaurants-route' of gitlab.viarezo.fr:raptornythorink/eatfast-website into restaurants-route
parents 0cb409ba 341b75f1
Branches
No related tags found
2 merge requests!30Restaurants route,!28improve front
Pipeline #43955 passed
This commit is part of merge request !28. Comments created here will be created in the context of that merge request.
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from typing import List
from db import schemas, crud
from db.database import get_db
router = APIRouter(prefix="/api", tags=["opening_hours"])
@router.get('/{place}/opening_hours', response_model=List[schemas.OpeningHours])
async def get_opening_hours(place: str, db: Session = Depends(get_db)):
return crud.get_opening_hours(place, db)
@router.get('/{place}/opening_hours/{day}/{timeslot}', response_model=List[schemas.OpeningHours])
async def get_timeslot(place: str, day: int, timeslot: bool, db: Session = Depends(get_db)):
return crud.get_timeslot(place, day, timeslot, db)
@router.post('/opening_hours', response_model=schemas.OpeningHours)
async def create_opening_hours(opening_hours: schemas.OpeningHoursBase, db: Session = Depends(get_db)):
return crud.create_opening_hours(opening_hours, db)
@router.delete('/opening_hours/{id}', response_model=None)
async def delete_opening_hours(id: int, db: Session = Depends(get_db)):
return crud.delete_opening_hours(id, db)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment