fixes to react and tested
This commit is contained in:
parent
60351f7cdb
commit
8704ad0e70
6 changed files with 26 additions and 11 deletions
|
|
@ -1,2 +1,2 @@
|
|||
from .react import create
|
||||
from .reacttosomething import reacttosomething
|
||||
from .listbyparent import listbyparent
|
||||
|
|
|
|||
1
src/trustcafeapiwrapper/wrappers/reaction/__init__.py
Normal file
1
src/trustcafeapiwrapper/wrappers/reaction/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from .react import react
|
||||
|
|
@ -23,25 +23,29 @@ def react(reaction_type: str, parent_path: str, item_path: str):
|
|||
|
||||
|
||||
'''
|
||||
|
||||
slug = item_path.split('/')[-1]
|
||||
if item_path.startswith('/post'):
|
||||
# It's a reaction on a post
|
||||
top_level_parent_pk = get_parent_pksk_from_path(parent_path)
|
||||
item_pksk = get_post_pksk(top_level_parent_pk, item_path)
|
||||
entity = 'post'
|
||||
else:
|
||||
# It's a reaction on a comment
|
||||
item_pksk = {
|
||||
'pk': make_post_sk(parent_path),
|
||||
'sk': make_comment_sk(item_path)
|
||||
}
|
||||
entity = 'comment'
|
||||
|
||||
return {
|
||||
"job_function": "reaction.react",
|
||||
"job_function": "reaction.reacttosomething",
|
||||
"payload": {
|
||||
"reaction": reaction_type,
|
||||
"parent": {
|
||||
"pk": item_pksk.get('pk', None),
|
||||
"sk": item_pksk.get('sk', None),
|
||||
"entity": entity,
|
||||
"slug": slug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue