diff --git a/__dummy__/getExercisesData.ts b/__dummy__/getExercisesData.ts index 1735c3393..065b8ed54 100644 --- a/__dummy__/getExercisesData.ts +++ b/__dummy__/getExercisesData.ts @@ -70,6 +70,7 @@ const getExercisesData: GetExercisesQuery = { email: 'noob@c0d3.com', discordId: '8321' }, + removed: false, description: '```\nlet a = 5\na = a + 10\n// what is a?\n```', answer: '15', explanation: 'You can reassign variables that were created with "let".', @@ -90,6 +91,7 @@ const getExercisesData: GetExercisesQuery = { email: 'noob@c0d3.com', discordId: '8321' }, + removed: false, description: '```\nlet a = 1\na += 2\n// what is a?\n```', answer: '3', explanation: '`a += 2` is a shorter way to write `a = a + 2`', @@ -110,6 +112,7 @@ const getExercisesData: GetExercisesQuery = { email: 'noob@c0d3.com', discordId: '8321' }, + removed: false, description: '```\nlet a = 1\na -= 2\n// what is a?\n```', answer: '-1', explanation: null, diff --git a/graphql/index.tsx b/graphql/index.tsx index 67edc4e65..979bf7b1e 100644 --- a/graphql/index.tsx +++ b/graphql/index.tsx @@ -85,6 +85,7 @@ export type Exercise = { flaggedById?: Maybe id: Scalars['Int'] module: Module + removed?: Maybe testStr?: Maybe } @@ -1000,6 +1001,7 @@ export type GetExercisesQuery = { exercises: Array<{ __typename?: 'Exercise' id: number + removed?: boolean | null description: string answer: string explanation?: string | null @@ -1723,6 +1725,7 @@ export type ExerciseResolvers< flaggedById?: Resolver, ParentType, ContextType> id?: Resolver module?: Resolver + removed?: Resolver, ParentType, ContextType> testStr?: Resolver, ParentType, ContextType> __isTypeOf?: IsTypeOfResolverFn }> @@ -4324,6 +4327,7 @@ export const GetExercisesDocument = gql` slug } } + removed description answer explanation @@ -6427,6 +6431,7 @@ export type ExerciseKeySpecifier = ( | 'flaggedById' | 'id' | 'module' + | 'removed' | 'testStr' | ExerciseKeySpecifier )[] @@ -6441,6 +6446,7 @@ export type ExerciseFieldPolicy = { flaggedById?: FieldPolicy | FieldReadFunction id?: FieldPolicy | FieldReadFunction module?: FieldPolicy | FieldReadFunction + removed?: FieldPolicy | FieldReadFunction testStr?: FieldPolicy | FieldReadFunction } export type ExerciseCommentKeySpecifier = ( diff --git a/graphql/queries/getExercises.ts b/graphql/queries/getExercises.ts index 4a73b1d33..6187ca990 100644 --- a/graphql/queries/getExercises.ts +++ b/graphql/queries/getExercises.ts @@ -28,6 +28,7 @@ const GET_EXERCISES = gql` slug } } + removed description answer explanation diff --git a/graphql/typeDefs.ts b/graphql/typeDefs.ts index 3eb66c47f..844e755e1 100644 --- a/graphql/typeDefs.ts +++ b/graphql/typeDefs.ts @@ -276,6 +276,7 @@ export default gql` answer: String! testStr: String explanation: String + removed: Boolean flaggedAt: String flagReason: String flaggedBy: User diff --git a/prisma/migrations/20221216150853_add_removed_column_to_exercise/migration.sql b/prisma/migrations/20221216150853_add_removed_column_to_exercise/migration.sql new file mode 100644 index 000000000..37ce3c0ce --- /dev/null +++ b/prisma/migrations/20221216150853_add_removed_column_to_exercise/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "exercises" ADD COLUMN "removed" BOOLEAN DEFAULT false; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index a4167003f..2e7d5ea1d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -187,6 +187,7 @@ model Exercise { answer String testStr String? explanation String? + removed Boolean? @default(false) flagReason String? flaggedAt DateTime? flaggedById Int? @@ -223,5 +224,4 @@ model ExerciseComment { author User @relation(fields: [authorId], references: [id], onDelete: SetNull) parent ExerciseComment? @relation("ExerciseCommentReplies", fields: [parentId], references: [id]) replies ExerciseComment[] @relation("ExerciseCommentReplies") - }