Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
bd18c400
Commit
bd18c400
authored
May 12, 2020
by
Vladislav Rykov
Browse files
notification_queue dao added
parent
c0688580
Changes
3
Show whitespace changes
Inline
Side-by-side
app/app/dao/notification/notification.py
View file @
bd18c400
...
...
@@ -37,12 +37,12 @@ def get(cur, appkey, nid):
app_key = %s
"""
cur
.
execute
(
query
,
(
nid
,
appkey
))
app
=
cur
.
fetchone
()
nf
=
cur
.
fetchone
()
if
app
is
None
:
if
nf
is
None
:
return
(
False
,
'Notification with appkey {} and id {} does not exist'
.
format
(
appkey
,
nid
))
else
:
return
(
True
,
app
)
return
(
True
,
nf
)
@
with_psql
...
...
app/app/dao/notification_queue/__init__.py
0 → 100644
View file @
bd18c400
app/app/dao/notification_queue/notification_queue.py
0 → 100644
View file @
bd18c400
from
app.helpers.misc
import
with_psql
@
with_psql
def
create
(
cur
,
nid
,
appkey
,
devid
):
query
=
"""
INSERT INTO
notifications_queue
VALUES
(%s, %s, %s)
"""
cur
.
execute
(
query
,
(
nid
,
appkey
,
devid
))
return
(
True
,)
@
with_psql
def
delete
(
cur
,
appkey
,
nid
):
query
=
"""
DELETE FROM
notifications_queue
WHERE
nf_id = %s
AND
app_key = %s
"""
cur
.
execute
(
query
,
(
nid
,
appkey
))
return
(
True
,)
@
with_psql
def
get
(
cur
,
appkey
,
nid
):
query
=
"""
SELECT * FROM
notifications_queue
WHERE
nf_id = %s
AND
app_key = %s
"""
cur
.
execute
(
query
,
(
nid
,
appkey
))
nf
=
cur
.
fetchone
()
if
nf
is
None
:
return
(
False
,
'Queued notification with appkey {} and id {} does not exist'
.
format
(
appkey
,
nid
))
else
:
return
(
True
,
nf
)
@
with_psql
def
get_all
(
cur
):
query
=
"""
SELECT * FROM
notificationis_queue
"""
cur
.
execute
(
query
)
return
(
True
,
cur
.
fetchall
())
@
with_psql
def
get_count
(
cur
):
query
=
"""
SELECT COUNT(*) FROM
notifications_queue
"""
cur
.
execute
(
query
,
())
return
(
True
,
cur
.
fetchone
())
Write
Preview
Supports
Markdown
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