mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-03-01 12:44:37 +00:00
refactor(backend): update apollo (#9292)
This commit is contained in:
parent
ad1cc13650
commit
9decd998cc
@ -15,6 +15,7 @@ module.exports = {
|
||||
'!**/build/**',
|
||||
'!**/src/**/?(*.)+(spec|test).ts?(x)',
|
||||
'!**/src/db/**',
|
||||
'!eslint.config.ts',
|
||||
],
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
|
||||
@ -35,8 +35,7 @@
|
||||
"@aws-sdk/lib-storage": "^3.990.0",
|
||||
"@sentry/node": "^5.30.0",
|
||||
"@types/mime-types": "^3.0.1",
|
||||
"apollo-server": "~2.14.2",
|
||||
"apollo-server-express": "^2.14.2",
|
||||
"@apollo/server": "^4.11.3",
|
||||
"bcryptjs": "~3.0.3",
|
||||
"body-parser": "^1.20.3",
|
||||
"cheerio": "~1.2.0",
|
||||
@ -44,13 +43,13 @@
|
||||
"dotenv": "~17.0.1",
|
||||
"email-templates": "^13.0.1",
|
||||
"express": "^4.22.1",
|
||||
"graphql": "^14.6.0",
|
||||
"graphql": "^16.11.0",
|
||||
"graphql-ws": "^5.16.2",
|
||||
"graphql-middleware": "~6.1.35",
|
||||
"graphql-middleware-sentry": "^3.2.1",
|
||||
"graphql-redis-subscriptions": "^2.7.0",
|
||||
"graphql-shield": "~7.2.2",
|
||||
"graphql-subscriptions": "^1.1.0",
|
||||
"graphql-tag": "~2.10.3",
|
||||
"graphql-shield": "^7.6.5",
|
||||
"graphql-subscriptions": "^2.0.0",
|
||||
"graphql-tag": "^2.12.6",
|
||||
"graphql-upload": "^13.0.0",
|
||||
"helmet": "~8.1.0",
|
||||
"ioredis": "^5.9.3",
|
||||
@ -59,7 +58,8 @@
|
||||
"linkify-html": "^4.3.2",
|
||||
"linkifyjs": "^4.3.2",
|
||||
"lodash": "~4.17.23",
|
||||
"merge-graphql-schemas": "^1.7.8",
|
||||
"@graphql-tools/load-files": "^7.0.0",
|
||||
"@graphql-tools/merge": "^9.0.0",
|
||||
"metascraper": "^5.49.19",
|
||||
"metascraper-author": "^5.49.19",
|
||||
"metascraper-date": "^5.49.19",
|
||||
@ -92,6 +92,8 @@
|
||||
"tslog": "^4.10.2",
|
||||
"uuid": "~9.0.1",
|
||||
"validator": "^13.15.26",
|
||||
"subscriptions-transport-ws": "^0.11.0",
|
||||
"ws": "^8.18.2",
|
||||
"xregexp": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -104,7 +106,7 @@
|
||||
"@types/request": "^2.48.13",
|
||||
"@types/slug": "^5.0.9",
|
||||
"@types/uuid": "~9.0.1",
|
||||
"apollo-server-testing": "~2.11.0",
|
||||
"@types/ws": "^8.18.1",
|
||||
"eslint": "^9.27.0",
|
||||
"eslint-config-it4c": "^0.12.0",
|
||||
"jest": "^30.2.0",
|
||||
@ -125,7 +127,9 @@
|
||||
"**/string-width": "4.2.0",
|
||||
"**/wrap-ansi": "7.0.0",
|
||||
"**/jwa": "^2.0.1",
|
||||
"**/@types/express": "4.17.25"
|
||||
"**/@types/express": "4.17.25",
|
||||
"neo4j-graphql-js/graphql": "^16.11.0",
|
||||
"graphql-upload/graphql": "^16.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.12.1"
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
|
||||
import databaseContext from '@context/database'
|
||||
import pubsubContext from '@context/pubsub'
|
||||
import CONFIG from '@src/config'
|
||||
@ -7,8 +5,6 @@ import { decode } from '@src/jwt/decode'
|
||||
import ocelotLogger from '@src/logger'
|
||||
|
||||
import type { DecodedUser } from '@src/jwt/decode'
|
||||
import type OcelotLogger from '@src/logger'
|
||||
import type { ApolloServerExpressConfig } from 'apollo-server-express'
|
||||
|
||||
const serverDatabase = databaseContext()
|
||||
const serverPubsub = pubsubContext()
|
||||
@ -18,7 +14,7 @@ export const getContext =
|
||||
database?: ReturnType<typeof databaseContext>
|
||||
pubsub?: ReturnType<typeof pubsubContext>
|
||||
authenticatedUser: DecodedUser | null | undefined
|
||||
logger?: typeof OcelotLogger
|
||||
logger?: typeof ocelotLogger
|
||||
config: typeof CONFIG
|
||||
}) =>
|
||||
async (req: { headers: { authorization?: string } }) => {
|
||||
@ -50,12 +46,4 @@ export const getContext =
|
||||
return result
|
||||
}
|
||||
|
||||
export const context: ApolloServerExpressConfig['context'] = async (options) => {
|
||||
const { connection, req } = options
|
||||
if (connection) {
|
||||
return connection.context
|
||||
} else {
|
||||
return getContext()(req)
|
||||
}
|
||||
}
|
||||
export type Context = Awaited<ReturnType<ReturnType<typeof getContext>>>
|
||||
|
||||
@ -42,7 +42,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
authenticatedUser,
|
||||
config: CONFIG,
|
||||
})
|
||||
const apolloSetup = createApolloTestSetup({ context })
|
||||
const apolloSetup = await createApolloTestSetup({ context })
|
||||
const { mutate, server, database } = apolloSetup
|
||||
const { neode } = database
|
||||
|
||||
|
||||
19
backend/src/graphql/errors.ts
Normal file
19
backend/src/graphql/errors.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { GraphQLError } from 'graphql'
|
||||
|
||||
export class UserInputError extends GraphQLError {
|
||||
constructor(message: string) {
|
||||
super(message, { extensions: { code: 'BAD_USER_INPUT' } })
|
||||
}
|
||||
}
|
||||
|
||||
export class AuthenticationError extends GraphQLError {
|
||||
constructor(message: string) {
|
||||
super(message, { extensions: { code: 'UNAUTHENTICATED' } })
|
||||
}
|
||||
}
|
||||
|
||||
export class ForbiddenError extends GraphQLError {
|
||||
constructor(message: string) {
|
||||
super(message, { extensions: { code: 'FORBIDDEN' } })
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const AddEmailAddress = gql`
|
||||
mutation ($email: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const AddPostEmotions = gql`
|
||||
mutation ($to: _PostInput!, $data: _EMOTEDInput!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const Category = gql`
|
||||
query {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const ChangeGroupMemberRole = gql`
|
||||
mutation ($groupId: ID!, $userId: ID!, $roleInGroup: GroupMemberRole!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const CreateComment = gql`
|
||||
mutation ($id: ID, $postId: ID!, $content: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const CreateGroup = gql`
|
||||
mutation (
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const CreateMessage = gql`
|
||||
mutation ($roomId: ID!, $content: String!, $files: [FileInput]) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const CreatePost = gql`
|
||||
mutation (
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const CreateRoom = gql`
|
||||
mutation ($userId: ID!) {
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const CreateSocialMedia = gql`
|
||||
mutation ($url: String!) {
|
||||
CreateSocialMedia(url: $url) {
|
||||
id
|
||||
url
|
||||
url
|
||||
ownedBy {
|
||||
name
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const DeleteComment = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const DeletePost = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const DeleteSocialMedia = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const DeleteUser = gql`
|
||||
mutation ($id: ID!, $resource: [Deletable]) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const Donations = gql`
|
||||
query {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const Group = gql`
|
||||
query Group($isMember: Boolean, $id: ID, $slug: String) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const GroupMembers = gql`
|
||||
query GroupMembers($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const JoinGroup = gql`
|
||||
mutation ($groupId: ID!, $userId: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const LeaveGroup = gql`
|
||||
mutation ($groupId: ID!, $userId: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const MarkMessagesAsSeen = gql`
|
||||
mutation ($messageIds: [String!]) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const Message = gql`
|
||||
query ($roomId: ID!, $first: Int, $offset: Int) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const Post = gql`
|
||||
query ($id: ID, $filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const PostsEmotionsByCurrentUser = gql`
|
||||
query ($postId: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const PostsEmotionsCountByEmotion = gql`
|
||||
query ($postId: ID!, $data: _EMOTEDInput!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const RemovePostEmotions = gql`
|
||||
mutation ($to: _PostInput!, $data: _EMOTEDInput!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const RemoveUserFromGroup = gql`
|
||||
mutation ($groupId: ID!, $userId: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const Room = gql`
|
||||
query Room($first: Int, $offset: Int, $id: ID) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const Signup = gql`
|
||||
mutation ($email: String!, $locale: String!, $inviteCode: String) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const SignupVerification = gql`
|
||||
mutation (
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const UnreadRooms = gql`
|
||||
query {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const UpdateComment = gql`
|
||||
mutation ($content: String!, $id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const UpdateDonations = gql`
|
||||
mutation ($showDonations: Boolean, $goal: Int, $progress: Int) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const UpdateGroup = gql`
|
||||
mutation (
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const UpdatePost = gql`
|
||||
mutation (
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const UpdateSocialMedia = gql`
|
||||
mutation ($id: ID!, $url: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const UpdateUser = gql`
|
||||
mutation (
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const User = gql`
|
||||
query ($id: ID, $name: String, $email: String) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const VerifyEmailAddress = gql`
|
||||
mutation ($email: String!, $nonce: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const VerifyNonce = gql`
|
||||
query ($email: String!, $nonce: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const availableRoles = gql`
|
||||
query {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const blockUser = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const blockedUsers = gql`
|
||||
query {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const changePassword = gql`
|
||||
mutation ($oldPassword: String!, $newPassword: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const currentUser = gql`
|
||||
query currentUser {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const embed = gql`
|
||||
query ($url: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const fileReport = gql`
|
||||
mutation ($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const followUser = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const generateGroupInviteCode = gql`
|
||||
mutation generateGroupInviteCode($groupId: ID!, $expiresAt: String, $comment: String) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const generatePersonalInviteCode = gql`
|
||||
mutation generatePersonalInviteCode($expiresAt: String, $comment: String) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const invalidateInviteCode = gql`
|
||||
mutation invalidateInviteCode($code: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const login = gql`
|
||||
mutation ($email: String!, $password: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const markAllAsRead = gql`
|
||||
mutation {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const markAsRead = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const markTeaserAsViewed = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const muteGroup = gql`
|
||||
mutation ($groupId: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const muteUser = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const mutedUsers = gql`
|
||||
query {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const notifications = gql`
|
||||
query ($read: Boolean, $orderBy: NotificationOrdering) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const pinGroupPost = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const pinPost = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const profilePagePosts = gql`
|
||||
query profilePagePosts(
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const pushPost = gql`
|
||||
mutation pushPost($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const queryLocations = gql`
|
||||
query ($place: String!, $lang: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const redeemInviteCode = gql`
|
||||
mutation redeemInviteCode($code: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const reports = gql`
|
||||
query (
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const requestPasswordReset = gql`
|
||||
mutation ($email: String!, $locale: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const resetPassword = gql`
|
||||
mutation ($nonce: String!, $email: String!, $newPassword: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const resetTrophyBadgesSelected = gql`
|
||||
mutation {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const review = gql`
|
||||
mutation ($resourceId: ID!, $disable: Boolean, $closed: Boolean) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const revokeBadge = gql`
|
||||
mutation ($badgeId: ID!, $userId: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const rewardTrophyBadge = gql`
|
||||
mutation rewardTrophyBadge($badgeId: ID!, $userId: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const saveCategorySettings = gql`
|
||||
mutation ($activeCategories: [String]) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const searchPosts = gql`
|
||||
query ($query: String!, $firstPosts: Int, $postsOffset: Int) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const searchResults = gql`
|
||||
query ($query: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const setTrophyBadgeSelected = gql`
|
||||
mutation setTrophyBadgeSelected($slot: Int!, $badgeId: ID) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const setVerificationBadge = gql`
|
||||
mutation ($badgeId: ID!, $userId: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const shout = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const statistics = gql`
|
||||
query statistics {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const switchUserRole = gql`
|
||||
mutation ($role: UserRole!, $id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const toggleObservePost = gql`
|
||||
mutation ($id: ID!, $value: Boolean!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const unblockUser = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const unfollowUser = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const unmuteGroup = gql`
|
||||
mutation ($groupId: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const unmuteUser = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const unpinGroupPost = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const unpinPost = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const unpushPost = gql`
|
||||
mutation unpushPost($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const unshout = gql`
|
||||
mutation ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const updateOnlineStatus = gql`
|
||||
mutation ($status: OnlineStatus!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const userData = gql`
|
||||
query ($id: ID!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const unauthenticatedValidateInviteCode = gql`
|
||||
query validateInviteCode($code: String!) {
|
||||
|
||||
@ -8,9 +8,9 @@ import { Readable } from 'node:stream'
|
||||
|
||||
import { S3Client } from '@aws-sdk/client-s3'
|
||||
import { Upload } from '@aws-sdk/lib-storage'
|
||||
import { UserInputError } from 'apollo-server'
|
||||
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { UserInputError } from '@graphql/errors'
|
||||
import { CreateMessage } from '@graphql/queries/CreateMessage'
|
||||
import { CreateRoom } from '@graphql/queries/CreateRoom'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
@ -21,6 +21,7 @@ import type { FileInput } from './attachments'
|
||||
import type File from '@db/models/File'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { S3Config } from '@src/config'
|
||||
import type { Context } from '@src/context'
|
||||
import type { ReadStream } from 'node:fs'
|
||||
|
||||
const s3SendMock = jest.fn()
|
||||
@ -48,7 +49,7 @@ const config: S3Config = {
|
||||
IMAGOR_PUBLIC_URL: 'IMAGOR_PUBLIC_URL',
|
||||
}
|
||||
|
||||
let authenticatedUser
|
||||
let authenticatedUser: Context['user']
|
||||
const context = () => ({ authenticatedUser, config })
|
||||
let mutate: ApolloTestSetup['mutate']
|
||||
let database: ApolloTestSetup['database']
|
||||
@ -57,7 +58,7 @@ let server: ApolloTestSetup['server']
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const apolloSetup = createApolloTestSetup({ context })
|
||||
const apolloSetup = await createApolloTestSetup({ context })
|
||||
mutate = apolloSetup.mutate
|
||||
database = apolloSetup.database
|
||||
server = apolloSetup.server
|
||||
@ -81,8 +82,8 @@ afterEach(async () => {
|
||||
describe('delete Attachment', () => {
|
||||
const { del: deleteAttachment } = attachments(config)
|
||||
describe('given a resource with an attachment', () => {
|
||||
let user: { id: string }
|
||||
let chatPartner: { id: string }
|
||||
let user
|
||||
let chatPartner
|
||||
let file: { id: string }
|
||||
let message: { id: string }
|
||||
beforeEach(async () => {
|
||||
@ -115,7 +116,7 @@ describe('delete Attachment', () => {
|
||||
},
|
||||
})
|
||||
|
||||
message = (m.data as any).CreateMessage // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
message = m.data.CreateMessage
|
||||
|
||||
await database.write({
|
||||
query: `
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import path from 'node:path'
|
||||
|
||||
import { UserInputError } from 'apollo-server-express'
|
||||
import slug from 'slugify'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
import { UserInputError } from '@graphql/errors'
|
||||
import { s3Service } from '@src/uploads/s3Service'
|
||||
|
||||
import type { S3Config } from '@config/index'
|
||||
|
||||
@ -25,7 +25,7 @@ let server: ApolloTestSetup['server']
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
const apolloSetup = createApolloTestSetup({ context })
|
||||
const apolloSetup = await createApolloTestSetup({ context })
|
||||
mutate = apolloSetup.mutate
|
||||
query = apolloSetup.query
|
||||
database = apolloSetup.database
|
||||
|
||||
@ -20,7 +20,7 @@ let server: ApolloTestSetup['server']
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
const apolloSetup = createApolloTestSetup({ context })
|
||||
const apolloSetup = await createApolloTestSetup({ context })
|
||||
mutate = apolloSetup.mutate
|
||||
database = apolloSetup.database
|
||||
server = apolloSetup.server
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user