Skip to content

Commit

Permalink
Merge pull request #2433 from flacial/3/1990-dojoadmin-manage-exercis…
Browse files Browse the repository at this point in the history
…es-tab

Add required fields to `getExercises` query
  • Loading branch information
flacial authored Oct 18, 2022
2 parents 45e4cc1 + efbafca commit 5ce925f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
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

1 comment on commit 5ce925f

@vercel
Copy link

@vercel vercel bot commented on 5ce925f Oct 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.