Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cake-bot
Overview
Overview
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
Oleksandr Barabash
cake-bot
Commits
08edd5dc
Commit
08edd5dc
authored
Jan 29, 2023
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small fixes and minor updates on ttl
parent
bf949ed1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
messaging_extension_action_preview_bot.py
bots/messaging_extension_action_preview_bot.py
+15
-0
content_ttl.py
entities/json/content_ttl.py
+2
-0
notification.py
entities/json/notification.py
+3
-3
pa_message.py
entities/json/pa_message.py
+1
-1
No files found.
bots/messaging_extension_action_preview_bot.py
View file @
08edd5dc
...
...
@@ -4,6 +4,7 @@ import sys
import
time
import
uuid
from
asyncio
import
Future
from
datetime
import
datetime
from
typing
import
Optional
,
Dict
,
Union
,
List
from
urllib.parse
import
urlparse
,
parse_qsl
,
urlencode
,
unquote
...
...
@@ -104,6 +105,12 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
future
=
Future
()
card
=
pa_message
.
card
if
pa_message
.
content_t_t_l
.
ttl
is
not
None
:
pa_message
.
content_t_t_l
.
expires
=
(
int
(
datetime
.
utcnow
()
.
timestamp
()
*
1000
)
+
pa_message
.
content_t_t_l
.
ttl
*
1000
)
async
def
routine
():
""" async routine """
try
:
...
...
@@ -161,6 +168,14 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
# reset parameters
notification
.
id
=
uuid
.
uuid4
()
.
__str__
()
notification
.
tenant_id
=
AppConfig
.
TENANT_ID
notification
.
content_t_t_l
.
expired
=
None
notification
.
content_t_t_l
.
expires
=
None
if
notification
.
content_t_t_l
.
ttl
is
not
None
:
notification
.
content_t_t_l
.
expires
=
(
int
(
datetime
.
utcnow
()
.
timestamp
()
*
1000
)
+
notification
.
content_t_t_l
.
ttl
)
async
def
routine
():
""" async routine """
...
...
entities/json/
ttl_record
.py
→
entities/json/
content_ttl
.py
View file @
08edd5dc
...
...
@@ -10,3 +10,5 @@ class ContentTTL(CamelCaseMixin):
""" Notification TTL """
ttl
:
Optional
[
int
]
=
field
(
default
=
None
)
content
:
Optional
[
Any
]
=
field
(
default
=
None
)
expired
:
int
=
field
(
default
=
None
)
expires
:
Optional
[
int
]
=
field
(
default
=
None
)
entities/json/notification.py
View file @
08edd5dc
...
...
@@ -3,7 +3,7 @@ from dataclasses import dataclass, field
from
typing
import
Optional
from
entities.json.camel_case_mixin
import
CamelCaseMixin
,
timestamp_factory
from
entities.json.
ttl_record
import
ContentTTL
from
entities.json.
content_ttl
import
ContentTTL
@dataclass
...
...
@@ -23,7 +23,7 @@ class Notification(CamelCaseMixin):
title
:
Optional
[
str
]
=
field
(
default
=
None
)
url
:
Optional
[
NotificationUrl
]
=
field
(
default_factory
=
NotificationUrl
)
acknowledge
:
Optional
[
bool
]
=
field
(
default
=
False
)
content
TTL
:
Optional
[
ContentTTL
]
=
field
(
default
=
None
)
content
_t_t_l
:
Optional
[
ContentTTL
]
=
field
(
default
=
None
)
def
to_db
(
self
)
->
"NotificationCosmos"
:
""" Create NotificationCosmos """
...
...
@@ -34,7 +34,7 @@ class Notification(CamelCaseMixin):
title
=
self
.
title
,
url
=
self
.
url
,
acknowledge
=
self
.
acknowledge
,
content
TTL
=
self
.
contentTTL
)
content
_t_t_l
=
self
.
content_t_t_l
)
# noinspection PyDataclass
...
...
entities/json/pa_message.py
View file @
08edd5dc
...
...
@@ -3,7 +3,7 @@ from dataclasses import dataclass, field
from
typing
import
Optional
,
Union
,
List
,
Dict
,
Any
from
entities.json.camel_case_mixin
import
CamelCaseMixin
,
uuid_factory
from
entities.json.
ttl_record
import
ContentTTL
from
entities.json.
content_ttl
import
ContentTTL
@dataclass
...
...
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