diff --git a/graphql/index.tsx b/graphql/index.tsx index 1c95ba9a7..fc859aa0a 100644 --- a/graphql/index.tsx +++ b/graphql/index.tsx @@ -20,9 +20,9 @@ export type MakeOptional = Omit & { export type MakeMaybe = Omit & { [SubKey in K]: Maybe } -export type RequireFields = { - [X in Exclude]?: T[X] -} & { [P in K]-?: NonNullable } +export type RequireFields = Omit & { + [P in K]-?: NonNullable +} const defaultOptions = {} as const /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { @@ -110,6 +110,7 @@ export type Mutation = { createChallenge?: Maybe>> createLesson: Array createSubmission?: Maybe + deleteComment?: Maybe deleteModule?: Maybe login?: Maybe logout?: Maybe @@ -184,6 +185,10 @@ export type MutationCreateSubmissionArgs = { lessonId: Scalars['Int'] } +export type MutationDeleteCommentArgs = { + id: Scalars['Int'] +} + export type MutationDeleteModuleArgs = { id: Scalars['Int'] } @@ -364,15 +369,12 @@ export type AcceptSubmissionMutationVariables = Exact<{ export type AcceptSubmissionMutation = { __typename?: 'Mutation' - acceptSubmission?: - | { - __typename?: 'Submission' - id: number - comment?: string | null | undefined - status: SubmissionStatus - } - | null - | undefined + acceptSubmission?: { + __typename?: 'Submission' + id: number + comment?: string | null + status: SubmissionStatus + } | null } export type AddAlertMutationVariables = Exact<{ @@ -384,21 +386,14 @@ export type AddAlertMutationVariables = Exact<{ export type AddAlertMutation = { __typename?: 'Mutation' - addAlert?: - | Array< - | { - __typename?: 'Alert' - id: number - text?: string | null | undefined - type?: string | null | undefined - url?: string | null | undefined - urlCaption?: string | null | undefined - } - | null - | undefined - > - | null - | undefined + addAlert?: Array<{ + __typename?: 'Alert' + id: number + text?: string | null + type?: string | null + url?: string | null + urlCaption?: string | null + } | null> | null } export type AddCommentMutationVariables = Exact<{ @@ -410,29 +405,22 @@ export type AddCommentMutationVariables = Exact<{ export type AddCommentMutation = { __typename?: 'Mutation' - addComment?: { __typename?: 'Comment'; id: number } | null | undefined + addComment?: { __typename?: 'Comment'; id: number } | null } export type UsersQueryVariables = Exact<{ [key: string]: never }> export type UsersQuery = { __typename?: 'Query' - allUsers?: - | Array< - | { - __typename?: 'User' - id: number - username: string - name: string - isAdmin: boolean - email: string - cliToken?: string | null | undefined - } - | null - | undefined - > - | null - | undefined + allUsers?: Array<{ + __typename?: 'User' + id: number + username: string + name: string + isAdmin: boolean + email: string + cliToken?: string | null + } | null> | null } export type ChangeAdminRightsMutationVariables = Exact<{ @@ -442,10 +430,10 @@ export type ChangeAdminRightsMutationVariables = Exact<{ export type ChangeAdminRightsMutation = { __typename?: 'Mutation' - changeAdminRights?: - | { __typename?: 'SuccessResponse'; success?: boolean | null | undefined } - | null - | undefined + changeAdminRights?: { + __typename?: 'SuccessResponse' + success?: boolean | null + } | null } export type CreateChallengeMutationVariables = Exact<{ @@ -457,32 +445,25 @@ export type CreateChallengeMutationVariables = Exact<{ export type CreateChallengeMutation = { __typename?: 'Mutation' - createChallenge?: - | Array< - | { - __typename?: 'Lesson' - id: number - docUrl?: string | null | undefined - githubUrl?: string | null | undefined - videoUrl?: string | null | undefined - chatUrl?: string | null | undefined - order: number - description: string - title: string - challenges: Array<{ - __typename?: 'Challenge' - id: number - description: string - lessonId: number - title: string - order: number - }> - } - | null - | undefined - > - | null - | undefined + createChallenge?: Array<{ + __typename?: 'Lesson' + id: number + docUrl?: string | null + githubUrl?: string | null + videoUrl?: string | null + chatUrl?: string | null + order: number + description: string + title: string + challenges: Array<{ + __typename?: 'Challenge' + id: number + description: string + lessonId: number + title: string + order: number + }> + } | null> | null } export type CreateLessonMutationVariables = Exact<{ @@ -501,10 +482,10 @@ export type CreateLessonMutation = { createLesson: Array<{ __typename?: 'Lesson' id: number - docUrl?: string | null | undefined - githubUrl?: string | null | undefined - videoUrl?: string | null | undefined - chatUrl?: string | null | undefined + docUrl?: string | null + githubUrl?: string | null + videoUrl?: string | null + chatUrl?: string | null order: number slug: string description: string @@ -529,14 +510,11 @@ export type CreateSubmissionMutationVariables = Exact<{ export type CreateSubmissionMutation = { __typename?: 'Mutation' - createSubmission?: - | { - __typename?: 'Submission' - id: number - diff?: string | null | undefined - } - | null - | undefined + createSubmission?: { + __typename?: 'Submission' + id: number + diff?: string | null + } | null } export type GetAppQueryVariables = Exact<{ [key: string]: never }> @@ -548,12 +526,12 @@ export type GetAppQuery = { id: number title: string description: string - docUrl?: string | null | undefined - githubUrl?: string | null | undefined - videoUrl?: string | null | undefined + docUrl?: string | null + githubUrl?: string | null + videoUrl?: string | null order: number slug: string - chatUrl?: string | null | undefined + chatUrl?: string | null challenges: Array<{ __typename?: 'Challenge' id: number @@ -564,69 +542,54 @@ export type GetAppQuery = { }> session: { __typename?: 'Session' - user?: - | { - __typename?: 'User' - id: number - username: string - name: string - isAdmin: boolean - isConnectedToDiscord: boolean - } - | null - | undefined - submissions?: - | Array<{ - __typename?: 'Submission' - id: number - status: SubmissionStatus - mrUrl?: string | null | undefined - diff?: string | null | undefined - viewCount?: number | null | undefined - comment?: string | null | undefined - order?: number | null | undefined - challengeId: number - lessonId: number - createdAt?: string | null | undefined - updatedAt: string - reviewer?: - | { __typename?: 'User'; id: number; username: string } - | null - | undefined - user: { __typename?: 'User'; id: number } - comments?: - | Array<{ - __typename?: 'Comment' - content: string - submissionId: number - createdAt: string - authorId: number - line?: number | null | undefined - fileName?: string | null | undefined - author?: - | { __typename?: 'User'; username: string; name: string } - | null - | undefined - }> - | null - | undefined - }> - | null - | undefined + user?: { + __typename?: 'User' + id: number + username: string + name: string + isAdmin: boolean + isConnectedToDiscord: boolean + } | null + submissions?: Array<{ + __typename?: 'Submission' + id: number + status: SubmissionStatus + mrUrl?: string | null + diff?: string | null + viewCount?: number | null + comment?: string | null + order?: number | null + challengeId: number + lessonId: number + createdAt?: string | null + updatedAt: string + reviewer?: { __typename?: 'User'; id: number; username: string } | null + user: { __typename?: 'User'; id: number } + comments?: Array<{ + __typename?: 'Comment' + content: string + submissionId: number + createdAt: string + authorId: number + line?: number | null + fileName?: string | null + author?: { __typename?: 'User'; username: string; name: string } | null + }> | null + }> | null lessonStatus: Array<{ __typename?: 'UserLesson' lessonId: number - passedAt?: string | null | undefined - starGiven?: string | null | undefined + passedAt?: string | null + starGiven?: string | null }> } alerts: Array<{ __typename?: 'Alert' id: number - text?: string | null | undefined - type?: string | null | undefined - url?: string | null | undefined - urlCaption?: string | null | undefined + text?: string | null + type?: string | null + url?: string | null + urlCaption?: string | null }> } @@ -636,14 +599,12 @@ export type LessonMentorsQueryVariables = Exact<{ export type LessonMentorsQuery = { __typename?: 'Query' - getLessonMentors?: - | Array< - | { __typename?: 'User'; username: string; name: string; id: number } - | null - | undefined - > - | null - | undefined + getLessonMentors?: Array<{ + __typename?: 'User' + username: string + name: string + id: number + } | null> | null } export type GetLessonsQueryVariables = Exact<{ [key: string]: never }> @@ -656,11 +617,11 @@ export type GetLessonsQuery = { title: string slug: string description: string - docUrl?: string | null | undefined - githubUrl?: string | null | undefined - videoUrl?: string | null | undefined + docUrl?: string | null + githubUrl?: string | null + videoUrl?: string | null order: number - chatUrl?: string | null | undefined + chatUrl?: string | null challenges: Array<{ __typename?: 'Challenge' id: number @@ -678,46 +639,35 @@ export type GetPreviousSubmissionsQueryVariables = Exact<{ export type GetPreviousSubmissionsQuery = { __typename?: 'Query' - getPreviousSubmissions?: - | Array<{ - __typename?: 'Submission' - id: number - status: SubmissionStatus - diff?: string | null | undefined - comment?: string | null | undefined - challengeId: number - lessonId: number - createdAt?: string | null | undefined - updatedAt: string - challenge: { - __typename?: 'Challenge' - title: string - description: string - } - user: { __typename?: 'User'; id: number; username: string } - reviewer?: - | { __typename?: 'User'; id: number; username: string; name: string } - | null - | undefined - comments?: - | Array<{ - __typename?: 'Comment' - content: string - submissionId: number - createdAt: string - authorId: number - line?: number | null | undefined - fileName?: string | null | undefined - author?: - | { __typename?: 'User'; username: string; name: string } - | null - | undefined - }> - | null - | undefined - }> - | null - | undefined + getPreviousSubmissions?: Array<{ + __typename?: 'Submission' + id: number + status: SubmissionStatus + diff?: string | null + comment?: string | null + challengeId: number + lessonId: number + createdAt?: string | null + updatedAt: string + challenge: { __typename?: 'Challenge'; title: string; description: string } + user: { __typename?: 'User'; id: number; username: string } + reviewer?: { + __typename?: 'User' + id: number + username: string + name: string + } | null + comments?: Array<{ + __typename?: 'Comment' + content: string + submissionId: number + createdAt: string + authorId: number + line?: number | null + fileName?: string | null + author?: { __typename?: 'User'; username: string; name: string } | null + }> | null + }> | null } export type GetSessionQueryVariables = Exact<{ [key: string]: never }> @@ -726,43 +676,34 @@ export type GetSessionQuery = { __typename?: 'Query' session: { __typename?: 'Session' - user?: - | { - __typename?: 'User' - id: number - username: string - name: string - isAdmin: boolean - isConnectedToDiscord: boolean - } - | null - | undefined - submissions?: - | Array<{ - __typename?: 'Submission' - id: number - status: SubmissionStatus - mrUrl?: string | null | undefined - diff?: string | null | undefined - viewCount?: number | null | undefined - comment?: string | null | undefined - order?: number | null | undefined - challengeId: number - lessonId: number - createdAt?: string | null | undefined - updatedAt: string - reviewer?: - | { __typename?: 'User'; id: number; username: string } - | null - | undefined - }> - | null - | undefined + user?: { + __typename?: 'User' + id: number + username: string + name: string + isAdmin: boolean + isConnectedToDiscord: boolean + } | null + submissions?: Array<{ + __typename?: 'Submission' + id: number + status: SubmissionStatus + mrUrl?: string | null + diff?: string | null + viewCount?: number | null + comment?: string | null + order?: number | null + challengeId: number + lessonId: number + createdAt?: string | null + updatedAt: string + reviewer?: { __typename?: 'User'; id: number; username: string } | null + }> | null lessonStatus: Array<{ __typename?: 'UserLesson' lessonId: number - passedAt?: string | null | undefined - starGiven?: string | null | undefined + passedAt?: string | null + starGiven?: string | null }> } } @@ -773,46 +714,35 @@ export type SubmissionsQueryVariables = Exact<{ export type SubmissionsQuery = { __typename?: 'Query' - submissions?: - | Array<{ - __typename?: 'Submission' - id: number - status: SubmissionStatus - diff?: string | null | undefined - comment?: string | null | undefined - challengeId: number - lessonId: number - createdAt?: string | null | undefined - updatedAt: string - challenge: { - __typename?: 'Challenge' - title: string - description: string - } - user: { __typename?: 'User'; id: number; username: string } - reviewer?: - | { __typename?: 'User'; id: number; username: string; name: string } - | null - | undefined - comments?: - | Array<{ - __typename?: 'Comment' - content: string - submissionId: number - createdAt: string - authorId: number - line?: number | null | undefined - fileName?: string | null | undefined - author?: - | { __typename?: 'User'; username: string; name: string } - | null - | undefined - }> - | null - | undefined - }> - | null - | undefined + submissions?: Array<{ + __typename?: 'Submission' + id: number + status: SubmissionStatus + diff?: string | null + comment?: string | null + challengeId: number + lessonId: number + createdAt?: string | null + updatedAt: string + challenge: { __typename?: 'Challenge'; title: string; description: string } + user: { __typename?: 'User'; id: number; username: string } + reviewer?: { + __typename?: 'User' + id: number + username: string + name: string + } | null + comments?: Array<{ + __typename?: 'Comment' + content: string + submissionId: number + createdAt: string + authorId: number + line?: number | null + fileName?: string | null + author?: { __typename?: 'User'; username: string; name: string } | null + }> | null + }> | null } export type LoginMutationVariables = Exact<{ @@ -822,31 +752,25 @@ export type LoginMutationVariables = Exact<{ export type LoginMutation = { __typename?: 'Mutation' - login?: - | { - __typename?: 'AuthResponse' - success?: boolean | null | undefined - username?: string | null | undefined - cliToken?: string | null | undefined - error?: string | null | undefined - } - | null - | undefined + login?: { + __typename?: 'AuthResponse' + success?: boolean | null + username?: string | null + cliToken?: string | null + error?: string | null + } | null } export type LogoutMutationVariables = Exact<{ [key: string]: never }> export type LogoutMutation = { __typename?: 'Mutation' - logout?: - | { - __typename?: 'AuthResponse' - success?: boolean | null | undefined - username?: string | null | undefined - error?: string | null | undefined - } - | null - | undefined + logout?: { + __typename?: 'AuthResponse' + success?: boolean | null + username?: string | null + error?: string | null + } | null } export type RejectSubmissionMutationVariables = Exact<{ @@ -857,15 +781,12 @@ export type RejectSubmissionMutationVariables = Exact<{ export type RejectSubmissionMutation = { __typename?: 'Mutation' - rejectSubmission?: - | { - __typename?: 'Submission' - id: number - comment?: string | null | undefined - status: SubmissionStatus - } - | null - | undefined + rejectSubmission?: { + __typename?: 'Submission' + id: number + comment?: string | null + status: SubmissionStatus + } | null } export type RemoveAlertMutationVariables = Exact<{ @@ -874,10 +795,10 @@ export type RemoveAlertMutationVariables = Exact<{ export type RemoveAlertMutation = { __typename?: 'Mutation' - removeAlert?: - | { __typename?: 'SuccessResponse'; success?: boolean | null | undefined } - | null - | undefined + removeAlert?: { + __typename?: 'SuccessResponse' + success?: boolean | null + } | null } export type ReqPwResetMutationVariables = Exact<{ @@ -886,10 +807,7 @@ export type ReqPwResetMutationVariables = Exact<{ export type ReqPwResetMutation = { __typename?: 'Mutation' - reqPwReset: { - __typename?: 'SuccessResponse' - success?: boolean | null | undefined - } + reqPwReset: { __typename?: 'SuccessResponse'; success?: boolean | null } } export type SetStarMutationVariables = Exact<{ @@ -900,10 +818,7 @@ export type SetStarMutationVariables = Exact<{ export type SetStarMutation = { __typename?: 'Mutation' - setStar: { - __typename?: 'SuccessResponse' - success?: boolean | null | undefined - } + setStar: { __typename?: 'SuccessResponse'; success?: boolean | null } } export type SignupMutationVariables = Exact<{ @@ -915,16 +830,13 @@ export type SignupMutationVariables = Exact<{ export type SignupMutation = { __typename?: 'Mutation' - signup?: - | { - __typename?: 'AuthResponse' - success?: boolean | null | undefined - username?: string | null | undefined - error?: string | null | undefined - cliToken?: string | null | undefined - } - | null - | undefined + signup?: { + __typename?: 'AuthResponse' + success?: boolean | null + username?: string | null + error?: string | null + cliToken?: string | null + } | null } export type UpdateChallengeMutationVariables = Exact<{ @@ -937,32 +849,25 @@ export type UpdateChallengeMutationVariables = Exact<{ export type UpdateChallengeMutation = { __typename?: 'Mutation' - updateChallenge?: - | Array< - | { - __typename?: 'Lesson' - id: number - docUrl?: string | null | undefined - githubUrl?: string | null | undefined - videoUrl?: string | null | undefined - chatUrl?: string | null | undefined - order: number - description: string - title: string - challenges: Array<{ - __typename?: 'Challenge' - id: number - description: string - lessonId: number - title: string - order: number - }> - } - | null - | undefined - > - | null - | undefined + updateChallenge?: Array<{ + __typename?: 'Lesson' + id: number + docUrl?: string | null + githubUrl?: string | null + videoUrl?: string | null + chatUrl?: string | null + order: number + description: string + title: string + challenges: Array<{ + __typename?: 'Challenge' + id: number + description: string + lessonId: number + title: string + order: number + }> + } | null> | null } export type UpdateLessonMutationVariables = Exact<{ @@ -982,10 +887,10 @@ export type UpdateLessonMutation = { updateLesson: Array<{ __typename?: 'Lesson' id: number - docUrl?: string | null | undefined - githubUrl?: string | null | undefined - videoUrl?: string | null | undefined - chatUrl?: string | null | undefined + docUrl?: string | null + githubUrl?: string | null + videoUrl?: string | null + chatUrl?: string | null order: number slug: string description: string @@ -1008,10 +913,7 @@ export type ChangePwMutationVariables = Exact<{ export type ChangePwMutation = { __typename?: 'Mutation' - changePw?: - | { __typename?: 'AuthResponse'; success?: boolean | null | undefined } - | null - | undefined + changePw?: { __typename?: 'AuthResponse'; success?: boolean | null } | null } export type UserInfoQueryVariables = Exact<{ @@ -1025,11 +927,11 @@ export type UserInfoQuery = { id: number title: string description: string - docUrl?: string | null | undefined - githubUrl?: string | null | undefined - videoUrl?: string | null | undefined + docUrl?: string | null + githubUrl?: string | null + videoUrl?: string | null order: number - chatUrl?: string | null | undefined + chatUrl?: string | null challenges: Array<{ __typename?: 'Challenge' id: number @@ -1038,72 +940,45 @@ export type UserInfoQuery = { order: number }> }> - userInfo?: - | { - __typename?: 'Session' - user?: - | { - __typename?: 'User' - id: number - username: string - name: string - discordUserId: string - discordUsername: string - discordAvatarUrl: string - } - | null - | undefined - submissions?: - | Array<{ - __typename?: 'Submission' - id: number - status: SubmissionStatus - mrUrl?: string | null | undefined - diff?: string | null | undefined - viewCount?: number | null | undefined - comment?: string | null | undefined - order?: number | null | undefined - challengeId: number - lessonId: number - createdAt?: string | null | undefined - updatedAt: string - reviewer?: - | { __typename?: 'User'; id: number; username: string } - | null - | undefined - }> - | null - | undefined - lessonStatus: Array<{ - __typename?: 'UserLesson' - lessonId: number - passedAt?: string | null | undefined - starsReceived?: - | Array< - | { - __typename?: 'Star' - lessonId: number - comment?: string | null | undefined - student: { - __typename?: 'User' - username: string - name: string - } - lesson: { - __typename?: 'Lesson' - title: string - order: number - } - } - | null - | undefined - > - | null - | undefined - }> - } - | null - | undefined + userInfo?: { + __typename?: 'Session' + user?: { + __typename?: 'User' + id: number + username: string + name: string + discordUserId: string + discordUsername: string + discordAvatarUrl: string + } | null + submissions?: Array<{ + __typename?: 'Submission' + id: number + status: SubmissionStatus + mrUrl?: string | null + diff?: string | null + viewCount?: number | null + comment?: string | null + order?: number | null + challengeId: number + lessonId: number + createdAt?: string | null + updatedAt: string + reviewer?: { __typename?: 'User'; id: number; username: string } | null + }> | null + lessonStatus: Array<{ + __typename?: 'UserLesson' + lessonId: number + passedAt?: string | null + starsReceived?: Array<{ + __typename?: 'Star' + lessonId: number + comment?: string | null + student: { __typename?: 'User'; username: string; name: string } + lesson: { __typename?: 'Lesson'; title: string; order: number } + } | null> | null + }> + } | null } export type WithIndex = TObject & Record @@ -1429,6 +1304,12 @@ export type MutationResolvers< 'challengeId' | 'cliToken' | 'diff' | 'lessonId' > > + deleteComment?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + > deleteModule?: Resolver< Maybe, ParentType, @@ -4302,6 +4183,7 @@ export type MutationKeySpecifier = ( | 'createChallenge' | 'createLesson' | 'createSubmission' + | 'deleteComment' | 'deleteModule' | 'login' | 'logout' @@ -4324,6 +4206,7 @@ export type MutationFieldPolicy = { createChallenge?: FieldPolicy | FieldReadFunction createLesson?: FieldPolicy | FieldReadFunction createSubmission?: FieldPolicy | FieldReadFunction + deleteComment?: FieldPolicy | FieldReadFunction deleteModule?: FieldPolicy | FieldReadFunction login?: FieldPolicy | FieldReadFunction logout?: FieldPolicy | FieldReadFunction diff --git a/graphql/queryResolvers/deleteComment.test.js b/graphql/queryResolvers/deleteComment.test.js new file mode 100644 index 000000000..a5a733b90 --- /dev/null +++ b/graphql/queryResolvers/deleteComment.test.js @@ -0,0 +1,57 @@ +/** + * @jest-environment node + */ + +import prismaMock from '../../__tests__/utils/prismaMock' +import { deleteComment } from './deleteComment' + +describe('Delete comment resolver', () => { + test('should invoke prismaMock delete', async () => { + prismaMock.comment.delete.mockResolvedValue({ + id: 2, + authorId: 1 + }) + prismaMock.comment.findUnique.mockResolvedValue({ + authorId: 1 + }) + await expect( + deleteComment( + {}, + { + id: 2 + }, + + { req: { user: { id: 1 } } } + ) + ).resolves.toEqual({ + authorId: 1, + id: 2 + }) + }) + + test('should throw error if no user.id in context', async () => { + await expect( + deleteComment( + {}, + { + id: 2 + }, + + { req: {} } + ) + ).rejects.toThrow('No authorId field') + }) + + test('should throw error if user.id not equal to the comment authorId', async () => { + await expect( + deleteComment( + {}, + { + authorId: 2 + }, + + { req: { user: { id: 1 } } } + ) + ).rejects.toThrow('Comment is not by the user') + }) +}) diff --git a/graphql/queryResolvers/deleteComment.ts b/graphql/queryResolvers/deleteComment.ts new file mode 100644 index 000000000..17d620d96 --- /dev/null +++ b/graphql/queryResolvers/deleteComment.ts @@ -0,0 +1,29 @@ +import prisma from '../../prisma' +import { MutationDeleteCommentArgs } from '../../graphql' +import { Context } from '../../@types/helpers' + +export const deleteComment = async ( + _parent: void, + arg: MutationDeleteCommentArgs, + ctx: Context +) => { + const { id } = arg + + const authorId = ctx.req.user?.id + if (!authorId) throw new Error('No authorId field') + + const comment = await prisma.comment.findUnique({ + where: { + id + } + }) + + if (comment?.authorId !== authorId) + throw new Error('Comment is not by the user') + + return prisma.comment.delete({ + where: { + id + } + }) +} diff --git a/graphql/resolvers.ts b/graphql/resolvers.ts index dad4ec4e3..0abddbf22 100644 --- a/graphql/resolvers.ts +++ b/graphql/resolvers.ts @@ -30,6 +30,7 @@ import { updateLesson } from '../helpers/controllers/lessonsController' import { getPreviousSubmissions } from './queryResolvers/getPreviousSubmissions' +import { deleteComment } from './queryResolvers/deleteComment' export default { Query: { @@ -61,6 +62,7 @@ export default { reqPwReset, createChallenge, updateChallenge, - addComment + addComment, + deleteComment } } diff --git a/graphql/typeDefs.ts b/graphql/typeDefs.ts index 51bedee7b..228d0df36 100644 --- a/graphql/typeDefs.ts +++ b/graphql/typeDefs.ts @@ -54,6 +54,7 @@ export default gql` submissionId: Int! content: String! ): Comment + deleteComment(id: Int!): Comment addModule( authorId: Int! lessonId: Int!