Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Skin disease Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Skin disease
Skin disease Server
Commits
ae38eee7
Commit
ae38eee7
authored
Sep 21, 2021
by
Kavindu Randika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disease API
parent
7db21ddf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
9 deletions
+32
-9
index.py
index.py
+2
-1
models/disease.py
models/disease.py
+5
-0
requirements.txt
requirements.txt
+0
-0
routes/disease.py
routes/disease.py
+16
-0
schemas/disease.py
schemas/disease.py
+9
-0
schemas/doctor.py
schemas/doctor.py
+0
-8
No files found.
index.py
View file @
ae38eee7
from
fastapi
import
FastAPI
from
fastapi
import
FastAPI
from
routes.disease
import
disease
app
=
FastAPI
()
app
=
FastAPI
()
app
.
include_router
(
disease
)
models/disease.py
0 → 100644
View file @
ae38eee7
from
pydantic
import
BaseModel
class
Disease
(
BaseModel
):
name
:
str
description
:
str
\ No newline at end of file
requirements.txt
View file @
ae38eee7
B
asgiref
==3.4.1
B
asgiref
==3.4.1
...
...
routes/disease.py
0 → 100644
View file @
ae38eee7
from
fastapi
import
APIRouter
from
config.db
import
conn
from
os
import
error
from
models.disease
import
Disease
from
schemas.disease
import
diseaseEntity
,
diseasesEntity
disease
=
APIRouter
()
@
disease
.
post
(
'/api/disease'
)
async
def
create_disease
(
disease
:
Disease
):
try
:
conn
.
skinDiseaseDB
.
disease
.
insert_one
(
dict
(
disease
))
return
{
"success"
:
True
}
except
error
:
return
{
"success"
:
False
,
"msg"
:
error
}
schemas/disease.py
0 → 100644
View file @
ae38eee7
def
diseaseEntity
(
item
)
->
dict
:
return
{
"id"
:
str
(
item
[
"id"
]),
"name"
:
item
[
"name"
],
"description"
:
item
[
"description"
],
}
def
diseasesEntity
(
entity
)
->
list
:
return
[
diseaseEntity
(
item
)
for
item
in
entity
]
\ No newline at end of file
schemas/doctor.py
View file @
ae38eee7
from
pydantic
import
BaseModel
from
typing
import
List
from
models.isAvailable
import
IsAvailable
class
Doctor
(
BaseModel
):
name
:
str
phone
:
str
IsAvailable
:
List
[
IsAvailable
]
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment