Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
StorageLeaf
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
ProjectLeaf
StorageLeaf
Commits
e01249c3
Commit
e01249c3
authored
4 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
improved response schema for version route
parent
a92ebe26
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/StorageLeaf.py
+4
-3
4 additions, 3 deletions
src/StorageLeaf.py
src/logic/databaseNew/Schemas.py
+17
-0
17 additions, 0 deletions
src/logic/databaseNew/Schemas.py
with
21 additions
and
3 deletions
src/
main
.py
→
src/
StorageLeaf
.py
+
4
−
3
View file @
e01249c3
...
...
@@ -7,7 +7,7 @@ from starlette.responses import RedirectResponse, JSONResponse
from
Settings
import
SETTINGS
from
logic
import
Constants
from
logic.databaseNew
import
Models
from
logic.databaseNew
import
Models
,
Schemas
from
logic.databaseNew.Database
import
engine
from
routers
import
DeviceRouter
,
SensorRouter
,
MeasurementRouter
...
...
@@ -32,9 +32,10 @@ async def root():
@app.get
(
'
/version
'
,
summary
=
'
Gets information about the server version
'
,
tags
=
[
'
general
'
])
tags
=
[
'
general
'
],
response_model
=
Schemas
.
Version
)
async
def
version
():
return
JSONResponse
(
content
=
VERSION
)
return
Schemas
.
Version
(
**
VERSION
)
app
.
include_router
(
DeviceRouter
.
router
)
...
...
This diff is collapsed.
Click to expand it.
src/logic/databaseNew/Schemas.py
+
17
−
0
View file @
e01249c3
...
...
@@ -3,10 +3,27 @@ from typing import List
from
pydantic
import
BaseModel
# ===== special =====
class
Status
(
BaseModel
):
message
:
str
class
Version
(
BaseModel
):
name
:
str
code
:
int
date
:
str
class
Config
:
schema_extra
=
{
'
example
'
:
{
'
name
'
:
'
v1.0.0
'
,
'
code
'
:
1
,
'
date
'
:
'
28.12.20
'
,
}
}
class
MinMax
(
BaseModel
):
min
:
float
or
None
max
:
float
or
None
...
...
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