Skip to content

Commit

Permalink
wip: update graphql types to be consistent with updated database schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sjschlapbach committed Oct 30, 2024
1 parent 227112f commit ac8419b
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 152 deletions.
64 changes: 14 additions & 50 deletions packages/graphql/src/ops.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5078,12 +5078,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "LIVE_QUIZ",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "MICROLEARNING",
"description": null,
Expand Down Expand Up @@ -8237,7 +8231,7 @@
"name": null,
"ofType": {
"kind": "ENUM",
"name": "GroupActivityStatus",
"name": "PublicationStatus",
"ofType": null
}
},
Expand Down Expand Up @@ -8937,7 +8931,7 @@
"name": null,
"ofType": {
"kind": "ENUM",
"name": "GroupActivityStatus",
"name": "PublicationStatus",
"ofType": null
}
},
Expand Down Expand Up @@ -9382,48 +9376,6 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "GroupActivityStatus",
"description": null,
"isOneOf": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "DRAFT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "ENDED",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "GRADED",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "PUBLISHED",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "SCHEDULED",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "GroupActivitySummary",
Expand Down Expand Up @@ -19422,6 +19374,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "ENDED",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "GRADED",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "PUBLISHED",
"description": null,
Expand Down
39 changes: 16 additions & 23 deletions packages/graphql/src/ops.ts

Large diffs are not rendered by default.

15 changes: 4 additions & 11 deletions packages/graphql/src/public/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ input ElementStackInput {

enum ElementStackType {
GROUP_ACTIVITY
LIVE_QUIZ
MICROLEARNING
PRACTICE_QUIZ
}
Expand Down Expand Up @@ -726,7 +725,7 @@ type GroupActivity {
scheduledEndAt: Date!
scheduledStartAt: Date!
stacks: [ElementStack!]
status: GroupActivityStatus!
status: PublicationStatus!
}

type GroupActivityClue {
Expand Down Expand Up @@ -787,7 +786,7 @@ type GroupActivityDetails {
scheduledEndAt: Date
scheduledStartAt: Date
stacks: [ElementStack!]!
status: GroupActivityStatus!
status: PublicationStatus!
}

type GroupActivityGrading {
Expand Down Expand Up @@ -831,14 +830,6 @@ type GroupActivityResults {
points: Float!
}

enum GroupActivityStatus {
DRAFT
ENDED
GRADED
PUBLISHED
SCHEDULED
}

type GroupActivitySummary {
numOfStartedInstances: Int!
numOfSubmissions: Int!
Expand Down Expand Up @@ -1318,6 +1309,8 @@ type PracticeQuiz {

enum PublicationStatus {
DRAFT
ENDED
GRADED
PUBLISHED
SCHEDULED
}
Expand Down
16 changes: 8 additions & 8 deletions packages/graphql/src/schema/groupActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ import {
ParticipantGroupRef,
ParticipantRef,
} from './participant.js'
import { type IElementStack, ElementStackRef } from './practiceQuizzes.js'
import {
type IElementStack,
ElementStackRef,
PublicationStatus,
} from './practiceQuizzes.js'
import { ElementType } from './questionData.js'

export const ParameterType = builder.enumType('ParameterType', {
values: Object.values(DB.ParameterType),
})

export const GroupActivityStatus = builder.enumType('GroupActivityStatus', {
values: Object.values(DB.GroupActivityStatus),
})

export const ResponseCorrectnessType = builder.enumType(
'ResponseCorrectnessType',
{
Expand Down Expand Up @@ -59,7 +59,7 @@ export const GroupActivity = GroupActivityRef.implement({
name: t.exposeString('name'),
displayName: t.exposeString('displayName'),
description: t.exposeString('description', { nullable: true }),
status: t.expose('status', { type: GroupActivityStatus }),
status: t.expose('status', { type: PublicationStatus }),
numOfQuestions: t.exposeInt('numOfQuestions', { nullable: true }),

pointsMultiplier: t.exposeInt('pointsMultiplier', { nullable: true }),
Expand Down Expand Up @@ -220,7 +220,7 @@ export interface IGroupActivityDetails {
id: string
name: string
displayName: string
status: DB.GroupActivityStatus
status: DB.PublicationStatus
description?: string | null
scheduledStartAt?: Date
scheduledEndAt?: Date
Expand All @@ -240,7 +240,7 @@ export const GroupActivityDetails = GroupActivityDetailsRef.implement({
name: t.exposeString('name', { nullable: false }),
displayName: t.exposeString('displayName', { nullable: false }),
description: t.exposeString('description', { nullable: true }),
status: t.expose('status', { type: GroupActivityStatus }),
status: t.expose('status', { type: PublicationStatus }),

scheduledStartAt: t.expose('scheduledStartAt', {
type: 'Date',
Expand Down
5 changes: 2 additions & 3 deletions packages/graphql/src/services/courses.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
ElementOrderType,
GroupActivityStatus,
LeaderboardType,
type Participant,
type ParticipantGroup,
Expand Down Expand Up @@ -1129,7 +1128,7 @@ export async function publishScheduledActivities(ctx: Context) {
// ! Set group activity status to ended for all published group activities that have ended
const groupActivitiesToEnd = await ctx.prisma.groupActivity.findMany({
where: {
status: GroupActivityStatus.PUBLISHED,
status: PublicationStatus.PUBLISHED,
scheduledEndAt: {
lte: new Date(),
},
Expand All @@ -1143,7 +1142,7 @@ export async function publishScheduledActivities(ctx: Context) {
id: group.id,
},
data: {
status: GroupActivityStatus.ENDED,
status: PublicationStatus.ENDED,
},
})
)
Expand Down
Loading

0 comments on commit ac8419b

Please sign in to comment.