Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
ViaResto-website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aymeric Chaumont
ViaResto-website
Commits
620c514f
Commit
620c514f
authored
2 years ago
by
Aymeric Chaumont
Browse files
Options
Downloads
Patches
Plain Diff
move opening_hours routes to stats
parent
6dc5dcc2
Branches
Branches containing commit
No related tags found
2 merge requests
!29
Time dependence
,
!28
improve front
Pipeline
#43947
passed with warnings
2 years ago
Stage: build
Stage: test
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
backend/main.py
+1
-2
1 addition, 2 deletions
backend/main.py
backend/routers/opening_hours.py
+0
-29
0 additions, 29 deletions
backend/routers/opening_hours.py
backend/routers/stats.py
+20
-1
20 additions, 1 deletion
backend/routers/stats.py
with
21 additions
and
32 deletions
backend/main.py
+
1
−
2
View file @
620c514f
...
...
@@ -4,7 +4,7 @@ from dotenv import load_dotenv
import
os
from
db
import
database
,
models
from
routers
import
stats
,
comments
,
news
,
opening_hours
from
routers
import
stats
,
comments
,
news
app
=
FastAPI
(
docs_url
=
"
/api/docs
"
,
openapi_url
=
"
/api/openapi.json
"
)
...
...
@@ -34,7 +34,6 @@ def on_startup():
app
.
include_router
(
stats
.
router
)
app
.
include_router
(
comments
.
router
)
app
.
include_router
(
news
.
router
)
app
.
include_router
(
opening_hours
.
router
)
"""
...
...
This diff is collapsed.
Click to expand it.
backend/routers/opening_hours.py
deleted
100644 → 0
+
0
−
29
View file @
6dc5dcc2
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
,
page
:
int
=
1
,
db
:
Session
=
Depends
(
get_db
)):
return
crud
.
get_opening_hours
(
place
,
page
,
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
)
This diff is collapsed.
Click to expand it.
backend/routers/stats.py
+
20
−
1
View file @
620c514f
from
fastapi
import
APIRouter
,
Depends
from
sqlalchemy.orm
import
Session
from
db
import
crud
from
db
import
schemas
,
crud
from
db.database
import
get_db
...
...
@@ -21,3 +21,22 @@ async def stats(place: str, db: Session = Depends(get_db)):
@router.get
(
'
/{place}/stats/current_graph
'
,
response_model
=
list
)
async
def
stats
(
place
:
str
,
db
:
Session
=
Depends
(
get_db
)):
return
crud
.
get_current_graph
(
place
,
db
)
@router.get
(
'
/{place}/opening_hours
'
,
response_model
=
List
[
schemas
.
OpeningHours
])
async
def
get_opening_hours
(
place
:
str
,
page
:
int
=
1
,
db
:
Session
=
Depends
(
get_db
)):
return
crud
.
get_opening_hours
(
place
,
page
,
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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment