pushed-wip
This commit is contained in:
parent
96e4150e07
commit
77d8e2f2fd
|
@ -201,11 +201,10 @@ async def delete_reaction(_, info, rid):
|
||||||
|
|
||||||
|
|
||||||
def map_result_item(result_item):
|
def map_result_item(result_item):
|
||||||
[user, shout, reaction] = result_item
|
[reaction, user, shout] = result_item
|
||||||
print(reaction)
|
print(reaction)
|
||||||
reaction.createdBy = user
|
reaction.createdBy = user
|
||||||
reaction.shout = shout
|
reaction.shout = shout
|
||||||
reaction.replyTo = reaction
|
|
||||||
return reaction
|
return reaction
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,15 +228,12 @@ async def load_reactions_by(_, _info, by, limit=50, offset=0):
|
||||||
|
|
||||||
CreatedByUser = aliased(User)
|
CreatedByUser = aliased(User)
|
||||||
ReactedShout = aliased(Shout)
|
ReactedShout = aliased(Shout)
|
||||||
RepliedReaction = aliased(Reaction)
|
|
||||||
q = select(
|
q = select(
|
||||||
Reaction, CreatedByUser, ReactedShout, RepliedReaction
|
Reaction, CreatedByUser, ReactedShout
|
||||||
).join(
|
).join(
|
||||||
CreatedByUser, Reaction.createdBy == CreatedByUser.slug
|
CreatedByUser, Reaction.createdBy == CreatedByUser.slug
|
||||||
).join(
|
).join(
|
||||||
ReactedShout, Reaction.shout == ReactedShout.slug
|
ReactedShout, Reaction.shout == ReactedShout.slug
|
||||||
).join(
|
|
||||||
RepliedReaction, Reaction.replyTo == RepliedReaction.id
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if by.get("shout"):
|
if by.get("shout"):
|
||||||
|
@ -268,10 +264,10 @@ async def load_reactions_by(_, _info, by, limit=50, offset=0):
|
||||||
reactions = []
|
reactions = []
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
for [
|
for [
|
||||||
[reaction, rating, commented, reacted], shout, reply
|
[reaction, rating, commented, reacted], user, shout
|
||||||
] in list(map(map_result_item, session.execute(q))):
|
] in list(map(map_result_item, session.execute(q))):
|
||||||
|
reaction.createdBy = user
|
||||||
reaction.shout = shout
|
reaction.shout = shout
|
||||||
reaction.replyTo = reply
|
|
||||||
reaction.stat = {
|
reaction.stat = {
|
||||||
"rating": rating,
|
"rating": rating,
|
||||||
"commented": commented,
|
"commented": commented,
|
||||||
|
|
|
@ -152,7 +152,7 @@ type Mutation {
|
||||||
updateChat(chat: ChatInput!): Result!
|
updateChat(chat: ChatInput!): Result!
|
||||||
deleteChat(chatId: String!): Result!
|
deleteChat(chatId: String!): Result!
|
||||||
|
|
||||||
createMessage(chat: String!, body: String!, replyTo: String): Result!
|
createMessage(chat: String!, body: String!, replyTo: Int): Result!
|
||||||
updateMessage(chatId: String!, id: Int!, body: String!): Result!
|
updateMessage(chatId: String!, id: Int!, body: String!): Result!
|
||||||
deleteMessage(chatId: String!, id: Int!): Result!
|
deleteMessage(chatId: String!, id: Int!): Result!
|
||||||
markAsRead(chatId: String!, ids: [Int]!): Result!
|
markAsRead(chatId: String!, ids: [Int]!): Result!
|
||||||
|
@ -410,7 +410,7 @@ type Reaction {
|
||||||
range: String # full / 0:2340
|
range: String # full / 0:2340
|
||||||
kind: ReactionKind!
|
kind: ReactionKind!
|
||||||
body: String
|
body: String
|
||||||
replyTo: Reaction
|
replyTo: Int
|
||||||
stat: Stat
|
stat: Stat
|
||||||
old_id: String
|
old_id: String
|
||||||
old_thread: String
|
old_thread: String
|
||||||
|
|
Loading…
Reference in New Issue
Block a user