Skip to content

Commit

Permalink
Merge pull request #2614 from flacial/2601-handle-already-flagged-exe…
Browse files Browse the repository at this point in the history
…rcises

Add `removed` column to the Exercise table
  • Loading branch information
flacial authored Dec 18, 2022
2 parents cd11572 + 0f3a8e4 commit bca6a74
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions __dummy__/getExercisesData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const getExercisesData: GetExercisesQuery = {
email: '[email protected]',
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".',
Expand All @@ -90,6 +91,7 @@ const getExercisesData: GetExercisesQuery = {
email: '[email protected]',
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`',
Expand All @@ -110,6 +112,7 @@ const getExercisesData: GetExercisesQuery = {
email: '[email protected]',
discordId: '8321'
},
removed: false,
description: '```\nlet a = 1\na -= 2\n// what is a?\n```',
answer: '-1',
explanation: null,
Expand Down
6 changes: 6 additions & 0 deletions graphql/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export type Exercise = {
flaggedById?: Maybe<Scalars['Int']>
id: Scalars['Int']
module: Module
removed?: Maybe<Scalars['Boolean']>
testStr?: Maybe<Scalars['String']>
}

Expand Down Expand Up @@ -1000,6 +1001,7 @@ export type GetExercisesQuery = {
exercises: Array<{
__typename?: 'Exercise'
id: number
removed?: boolean | null
description: string
answer: string
explanation?: string | null
Expand Down Expand Up @@ -1723,6 +1725,7 @@ export type ExerciseResolvers<
flaggedById?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>
id?: Resolver<ResolversTypes['Int'], ParentType, ContextType>
module?: Resolver<ResolversTypes['Module'], ParentType, ContextType>
removed?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>
testStr?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>
}>
Expand Down Expand Up @@ -4324,6 +4327,7 @@ export const GetExercisesDocument = gql`
slug
}
}
removed
description
answer
explanation
Expand Down Expand Up @@ -6427,6 +6431,7 @@ export type ExerciseKeySpecifier = (
| 'flaggedById'
| 'id'
| 'module'
| 'removed'
| 'testStr'
| ExerciseKeySpecifier
)[]
Expand All @@ -6441,6 +6446,7 @@ export type ExerciseFieldPolicy = {
flaggedById?: FieldPolicy<any> | FieldReadFunction<any>
id?: FieldPolicy<any> | FieldReadFunction<any>
module?: FieldPolicy<any> | FieldReadFunction<any>
removed?: FieldPolicy<any> | FieldReadFunction<any>
testStr?: FieldPolicy<any> | FieldReadFunction<any>
}
export type ExerciseCommentKeySpecifier = (
Expand Down
1 change: 1 addition & 0 deletions graphql/queries/getExercises.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const GET_EXERCISES = gql`
slug
}
}
removed
description
answer
explanation
Expand Down
1 change: 1 addition & 0 deletions graphql/typeDefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export default gql`
answer: String!
testStr: String
explanation: String
removed: Boolean
flaggedAt: String
flagReason: String
flaggedBy: User
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "exercises" ADD COLUMN "removed" BOOLEAN DEFAULT false;
2 changes: 1 addition & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ model Exercise {
answer String
testStr String?
explanation String?
removed Boolean? @default(false)
flagReason String?
flaggedAt DateTime?
flaggedById Int?
Expand Down Expand Up @@ -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")
}

1 comment on commit bca6a74

@vercel
Copy link

@vercel vercel bot commented on bca6a74 Dec 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.