mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
* Prepare image uploads in chat * files instead of images * Fix file type and query * Add dummy data to resolver * fix graphql types * Fix file upload, remove unncessary code * Re-add fetch * Fix room order after sent message * Update backend/src/graphql/queries/messageQuery.ts * Move room to top of list when a message is received * working prototype chat file upload * remove console * allow to upload all kinds of files * multiple images * revert changes in S3 Images * tag mimetype * accept any file * lint fix * remove snapshot flakyness * remove whitelist test * fix messages spec * fix query * more query fixes * fix seed * made message resolver tests independent * lint * started specc for attachments * more tests & fixes * fix empty room error * remove console logs * fix tests * fix createRoom last Messsage error properly * lint fixes * reduce changeset * simplify config check * reduce changeset * missing change * allow speech capture * Fix file download * Implement proper download --------- Co-authored-by: Maximilian Harz <maxharz@gmail.com>
113 lines
1.8 KiB
JavaScript
113 lines
1.8 KiB
JavaScript
import gql from 'graphql-tag'
|
|
|
|
export const createMessageMutation = () => {
|
|
return gql`
|
|
mutation ($roomId: ID!, $content: String, $files: [FileInput]) {
|
|
CreateMessage(roomId: $roomId, content: $content, files: $files) {
|
|
#_id
|
|
id
|
|
indexId
|
|
content
|
|
senderId
|
|
author {
|
|
id
|
|
}
|
|
username
|
|
avatar
|
|
date
|
|
room {
|
|
id
|
|
}
|
|
saved
|
|
distributed
|
|
seen
|
|
files {
|
|
url
|
|
name
|
|
#size
|
|
type
|
|
#preview
|
|
}
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const messageQuery = () => {
|
|
return gql`
|
|
query ($roomId: ID!, $first: Int, $offset: Int) {
|
|
Message(roomId: $roomId, first: $first, offset: $offset, orderBy: indexId_desc) {
|
|
_id
|
|
id
|
|
indexId
|
|
content
|
|
senderId
|
|
author {
|
|
id
|
|
}
|
|
username
|
|
avatar
|
|
date
|
|
room {
|
|
id
|
|
}
|
|
saved
|
|
distributed
|
|
seen
|
|
files {
|
|
url
|
|
name
|
|
#size
|
|
type
|
|
#audio
|
|
#duration
|
|
#preview
|
|
}
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const chatMessageAdded = () => {
|
|
return gql`
|
|
subscription chatMessageAdded {
|
|
chatMessageAdded {
|
|
_id
|
|
id
|
|
indexId
|
|
content
|
|
senderId
|
|
author {
|
|
id
|
|
}
|
|
username
|
|
avatar
|
|
date
|
|
room {
|
|
id
|
|
}
|
|
saved
|
|
distributed
|
|
seen
|
|
files {
|
|
url
|
|
name
|
|
#size
|
|
type
|
|
#audio
|
|
#duration
|
|
#preview
|
|
}
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const markMessagesAsSeen = () => {
|
|
return gql`
|
|
mutation ($messageIds: [String!]) {
|
|
MarkMessagesAsSeen(messageIds: $messageIds)
|
|
}
|
|
`
|
|
}
|