Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
fast-food
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Мырзабеков Бекайдар
fast-food
Commits
22ac274b
Commit
22ac274b
authored
Nov 28, 2023
by
Мырзабеков Бекайдар
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added get order status
parent
889a6da3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
ctrl.py
src/app/api/order/ctrl.py
+7
-0
routes.py
src/app/api/order/routes.py
+8
-0
services.py
src/app/api/order/services.py
+4
-0
No files found.
src/app/api/order/ctrl.py
View file @
22ac274b
...
...
@@ -26,3 +26,10 @@ class OrderController(BaseController):
except
common_exc
.
UpdateException
as
e
:
raise
http_exc
.
HTTPBadRequestException
(
detail
=
str
(
e
))
async
def
get_order_status
(
self
,
id
:
UUID
):
try
:
return
await
self
.
order_service
.
get_order_status
(
id
)
except
common_exc
.
NotFoundException
as
e
:
raise
http_exc
.
HTTPNotFoundException
(
detail
=
str
(
e
))
src/app/api/order/routes.py
View file @
22ac274b
from
uuid
import
UUID
import
fastapi
as
fa
from
.ctrl
import
OrderController
...
...
@@ -17,3 +19,9 @@ async def create_order(body: OrderPostSchema):
async
def
accepted_order
(
body
:
OrderIdSchema
):
order
=
await
ctrl
.
accepted_order
(
**
body
.
model_dump
(
exclude_none
=
True
))
return
OrderStatusSchema
.
model_validate
(
order
)
@
router
.
get
(
'/{id}/status'
)
async
def
get_order_status
(
id
:
UUID
):
order
=
await
ctrl
.
get_order_status
(
id
)
return
OrderStatusSchema
.
model_validate
(
order
)
src/app/api/order/services.py
View file @
22ac274b
...
...
@@ -53,3 +53,7 @@ class OrderService:
await
order
.
save
()
return
{
'id'
:
order
.
id
,
'status'
:
order
.
status
}
async
def
get_order_status
(
self
,
id
:
UUID
):
order
=
await
self
.
order_repository
.
get
(
id
)
return
{
'id'
:
order
.
id
,
'status'
:
order
.
status
}
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