Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add removed column to the Exercise table #2614

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")

}