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 required fields to getExercises query #2433

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
18 changes: 12 additions & 6 deletions __dummy__/getExercisesData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ const getExercisesData: GetExercisesQuery = {
id: 1,
username: 'noob',
email: 'noob@c0d3.com',
discordUsername: 'noobOnDiscord'
discordId: '8321'
},
description: '```\nlet a = 5\na = a + 10\n// what is a?\n```',
answer: '15',
explanation: 'You can reassign variables that were created with "let".'
explanation: 'You can reassign variables that were created with "let".',
flaggedAt: null,
flagReason: null
},
{
id: 2,
Expand All @@ -86,11 +88,13 @@ const getExercisesData: GetExercisesQuery = {
id: 1,
username: 'noob',
email: 'noob@c0d3.com',
discordUsername: 'noobOnDiscord'
discordId: '8321'
},
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`'
explanation: '`a += 2` is a shorter way to write `a = a + 2`',
flaggedAt: null,
flagReason: null
},
{
id: 3,
Expand All @@ -104,11 +108,13 @@ const getExercisesData: GetExercisesQuery = {
id: 1,
username: 'noob',
email: 'noob@c0d3.com',
discordUsername: 'noobOnDiscord'
discordId: '8321'
},
description: '```\nlet a = 1\na -= 2\n// what is a?\n```',
answer: '-1',
explanation: null
explanation: null,
flaggedAt: null,
flagReason: null
}
],
exerciseSubmissions: [{ exerciseId: 1, userAnswer: '15' }]
Expand Down
12 changes: 10 additions & 2 deletions graphql/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ export type User = {
__typename?: 'User'
cliToken?: Maybe<Scalars['String']>
discordAvatarUrl: Scalars['String']
discordId?: Maybe<Scalars['String']>
discordUserId: Scalars['String']
discordUsername: Scalars['String']
email: Scalars['String']
Expand Down Expand Up @@ -865,12 +866,14 @@ export type GetExercisesQuery = {
description: string
answer: string
explanation?: string | null
flaggedAt?: string | null
flagReason?: string | null
author: {
__typename?: 'User'
id: number
username: string
email: string
discordUsername: string
discordId?: string | null
}
module: {
__typename?: 'Module'
Expand Down Expand Up @@ -1979,6 +1982,7 @@ export type UserResolvers<
> = ResolversObject<{
cliToken?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>
discordAvatarUrl?: Resolver<ResolversTypes['String'], ParentType, ContextType>
discordId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>
discordUserId?: Resolver<ResolversTypes['String'], ParentType, ContextType>
discordUsername?: Resolver<ResolversTypes['String'], ParentType, ContextType>
email?: Resolver<ResolversTypes['String'], ParentType, ContextType>
Expand Down Expand Up @@ -3693,7 +3697,7 @@ export const GetExercisesDocument = gql`
id
username
email
discordUsername
discordId
}
module {
name
Expand All @@ -3704,6 +3708,8 @@ export const GetExercisesDocument = gql`
description
answer
explanation
flaggedAt
flagReason
}
exerciseSubmissions {
exerciseId
Expand Down Expand Up @@ -5968,6 +5974,7 @@ export type TokenResponseFieldPolicy = {
export type UserKeySpecifier = (
| 'cliToken'
| 'discordAvatarUrl'
| 'discordId'
| 'discordUserId'
| 'discordUsername'
| 'email'
Expand All @@ -5982,6 +5989,7 @@ export type UserKeySpecifier = (
export type UserFieldPolicy = {
cliToken?: FieldPolicy<any> | FieldReadFunction<any>
discordAvatarUrl?: FieldPolicy<any> | FieldReadFunction<any>
discordId?: FieldPolicy<any> | FieldReadFunction<any>
discordUserId?: FieldPolicy<any> | FieldReadFunction<any>
discordUsername?: FieldPolicy<any> | FieldReadFunction<any>
email?: FieldPolicy<any> | FieldReadFunction<any>
Expand Down
4 changes: 3 additions & 1 deletion graphql/queries/getExercises.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const GET_EXERCISES = gql`
id
username
email
discordUsername
discordId
}
module {
name
Expand All @@ -31,6 +31,8 @@ const GET_EXERCISES = gql`
description
answer
explanation
flaggedAt
flagReason
}
exerciseSubmissions {
exerciseId
Expand Down
1 change: 1 addition & 0 deletions graphql/typeDefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export default gql`
isAdmin: Boolean!
isConnectedToDiscord: Boolean!
cliToken: String
discordId: String
discordUserId: String!
discordUsername: String!
discordAvatarUrl: String!
Expand Down