build: switch from yarn to npm to manage js dependencies and move js contents to root
yarn v1 is being deprecated and starts to have some issues Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
166
src/graphql/conversations.ts
Normal file
166
src/graphql/conversations.ts
Normal file
@@ -0,0 +1,166 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
import { COMMENT_FIELDS_FRAGMENT } from "./comment";
|
||||
|
||||
export const CONVERSATION_QUERY_FRAGMENT = gql`
|
||||
fragment ConversationQuery on Conversation {
|
||||
id
|
||||
conversationParticipantId
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
lastComment {
|
||||
...CommentFields
|
||||
}
|
||||
participants {
|
||||
...ActorFragment
|
||||
}
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
picture {
|
||||
id
|
||||
url
|
||||
name
|
||||
metadata {
|
||||
width
|
||||
height
|
||||
blurhash
|
||||
}
|
||||
}
|
||||
}
|
||||
unread
|
||||
insertedAt
|
||||
updatedAt
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
${COMMENT_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CONVERSATIONS_QUERY_FRAGMENT = gql`
|
||||
fragment ConversationsQuery on PaginatedConversationList {
|
||||
total
|
||||
elements {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const SEND_EVENT_PRIVATE_MESSAGE_MUTATION = gql`
|
||||
mutation SendEventPrivateMessageMutation(
|
||||
$text: String!
|
||||
$actorId: ID!
|
||||
$eventId: ID!
|
||||
$roles: [ParticipantRoleEnum]
|
||||
$attributedToId: ID
|
||||
$language: String
|
||||
) {
|
||||
sendEventPrivateMessage(
|
||||
text: $text
|
||||
actorId: $actorId
|
||||
eventId: $eventId
|
||||
roles: $roles
|
||||
attributedToId: $attributedToId
|
||||
language: $language
|
||||
) {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GET_CONVERSATION = gql`
|
||||
query GetConversation($id: ID!, $page: Int, $limit: Int) {
|
||||
conversation(id: $id) {
|
||||
...ConversationQuery
|
||||
comments(page: $page, limit: $limit) @connection(key: "comments") {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
text
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
deletedAt
|
||||
publishedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const POST_PRIVATE_MESSAGE_MUTATION = gql`
|
||||
mutation PostPrivateMessageMutation(
|
||||
$text: String!
|
||||
$actorId: ID!
|
||||
$language: String
|
||||
$mentions: [String]
|
||||
) {
|
||||
postPrivateMessage(
|
||||
text: $text
|
||||
actorId: $actorId
|
||||
language: $language
|
||||
mentions: $mentions
|
||||
) {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const REPLY_TO_PRIVATE_MESSAGE_MUTATION = gql`
|
||||
mutation ReplyToPrivateMessageMutation(
|
||||
$text: String!
|
||||
$actorId: ID!
|
||||
$attributedToId: ID
|
||||
$language: String
|
||||
$conversationId: ID!
|
||||
$mentions: [String]
|
||||
) {
|
||||
postPrivateMessage(
|
||||
text: $text
|
||||
actorId: $actorId
|
||||
attributedToId: $attributedToId
|
||||
language: $language
|
||||
conversationId: $conversationId
|
||||
mentions: $mentions
|
||||
) {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CONVERSATION_COMMENT_CHANGED = gql`
|
||||
subscription ConversationCommentChanged($id: ID!) {
|
||||
conversationCommentChanged(id: $id) {
|
||||
id
|
||||
lastComment {
|
||||
id
|
||||
text
|
||||
updatedAt
|
||||
insertedAt
|
||||
deletedAt
|
||||
publishedAt
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const MARK_CONVERSATION_AS_READ = gql`
|
||||
mutation MarkConversationAsRead($id: ID!, $read: Boolean!) {
|
||||
updateConversation(conversationId: $id, read: $read) {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
Reference in New Issue
Block a user