Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
Shoppe
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
mongo101
Shoppe
Commits
67fa4b13
Commit
67fa4b13
authored
Sep 07, 2019
by
Ahmad Anvari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add order class
parent
b260177b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
order.py
db/order.py
+11
-5
No files found.
db/order.py
View file @
67fa4b13
...
@@ -2,19 +2,25 @@ from db.mongo import Model
...
@@ -2,19 +2,25 @@ from db.mongo import Model
class
Order
(
Model
):
class
Order
(
Model
):
def
__init__
(
self
):
def
__init__
(
self
,
user_id
,
product_id
):
pass
self
.
__id
=
None
self
.
__user_id
=
user_id
self
.
__product_id
=
product_id
def
store
(
self
):
def
store
(
self
):
pass
res
=
Order
.
get_collection
()
.
insert_one
(
self
.
to_dict
())
return
res
.
inserted_id
@
staticmethod
@
staticmethod
def
get_collection
():
def
get_collection
():
pass
return
Model
.
get_db
()
.
get_collection
(
"orders"
)
@
staticmethod
@
staticmethod
def
dict_to_object
(
dictionary
):
def
dict_to_object
(
dictionary
):
pass
pass
def
to_dict
(
self
):
def
to_dict
(
self
):
pass
return
{
"user_id"
:
self
.
__user_id
,
"product_id"
:
self
.
__product_id
}
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