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
4f75f520
Commit
4f75f520
authored
Sep 17, 2021
by
Hansi rathnayaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API modification
parent
9ecdd57a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
11 deletions
+24
-11
models/availability.py
models/availability.py
+5
-0
models/doctor.py
models/doctor.py
+6
-2
routes/doctor.py
routes/doctor.py
+3
-3
schemas/availability.py
schemas/availability.py
+4
-4
schemas/doctor.py
schemas/doctor.py
+6
-2
No files found.
models/
isAvailable
.py
→
models/
availability
.py
View file @
4f75f520
from
pydantic
import
BaseModel
class
IsAvailable
(
BaseModel
):
class
Availability
(
BaseModel
):
day
:
str
availability
:
str
\ No newline at end of file
availableTime
:
str
\ No newline at end of file
models/doctor.py
View file @
4f75f520
from
pydantic
import
BaseModel
from
typing
import
List
from
typing
import
Optional
from
models.
isAvailable
import
IsAvailable
from
models.
availability
import
Availability
class
Doctor
(
BaseModel
):
id
:
str
title
:
str
name
:
str
phone
:
str
isAvailable
:
Optional
[
List
[
IsAvailable
]]
=
[]
\ No newline at end of file
email
:
str
permitNo
:
str
address
:
str
availability
:
Optional
[
List
[
Availability
]]
=
[]
\ No newline at end of file
routes/doctor.py
View file @
4f75f520
from
typing
import
List
from
models.
isAvailable
import
IsAvailable
from
models.
availability
import
Availability
from
re
import
A
import
re
from
os
import
error
from
bson.objectid
import
ObjectId
from
schemas.doctor
import
doctorEntity
,
doctorsEntity
from
schemas.availability
import
availab
leEntity
,
availabl
esEntity
from
schemas.availability
import
availab
ilityEntity
,
availabiliti
esEntity
from
fastapi
import
APIRouter
from
models.doctor
import
Doctor
from
config.db
import
conn
...
...
@@ -53,7 +53,7 @@ async def delete_doctor(id):
@
doctor
.
put
(
'/api/availability/{id}'
)
async
def
update_availability
(
id
,
availabilities
:
List
[
IsAvailable
]):
async
def
update_availability
(
id
,
availabilities
:
List
[
Availability
]):
try
:
available_dic
=
dict
()
for
available
in
availabilities
:
...
...
schemas/availability.py
View file @
4f75f520
def
availab
le
Entity
(
item
)
->
dict
:
def
availab
ility
Entity
(
item
)
->
dict
:
return
{
"day"
:
item
[
"day"
],
"availab
ility"
:
item
[
"availability
"
]
"availab
leTime"
:
item
[
"availableTime
"
]
}
def
availab
l
esEntity
(
entity
)
->
list
:
def
availab
iliti
esEntity
(
entity
)
->
list
:
print
(
entity
)
return
[
availab
le
Entity
(
item
)
for
item
in
entity
]
return
[
availab
ility
Entity
(
item
)
for
item
in
entity
]
\ No newline at end of file
schemas/doctor.py
View file @
4f75f520
def
doctorEntity
(
item
)
->
dict
:
return
{
"id"
:
str
(
item
[
"id"
]),
"id"
:
item
[
"id"
],
"title"
:
item
[
"title"
],
"name"
:
item
[
"name"
],
"phone"
:
item
[
"phone"
],
"isAvailable"
:
item
[
"isAvailable"
]
"email"
:
item
[
"email"
],
"permitNo"
:
item
[
"permitNo"
],
"address"
:
item
[
"address"
],
"availability"
:
item
[
"availability"
]
}
def
doctorsEntity
(
entity
)
->
list
:
return
[
doctorEntity
(
item
)
for
item
in
entity
]
\ 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