diff --git a/app/(admin)/(activity-management)/events/_components/data-table.tsx b/app/(admin)/(activity-management)/events/_components/data-table.tsx index 60f666b..dd300b9 100644 --- a/app/(admin)/(activity-management)/events/_components/data-table.tsx +++ b/app/(admin)/(activity-management)/events/_components/data-table.tsx @@ -18,7 +18,15 @@ export function EventsDataTable({ query }: { query?: string }) { const variables = { first: PAGE_SIZE, after, - where: query ? { typeContains: query } : undefined, + where: query + ? { + or: [ + { typeContains: query }, + { hasUserWith: [{ nameContains: query }] }, + { hasUserWith: [{ emailContains: query }] }, + ], + } + : undefined, } satisfies VariablesOf; const { data } = useSuspenseQuery(EVENTS_TABLE_QUERY, { diff --git a/app/(admin)/(activity-management)/events/_components/filterable-data-table.tsx b/app/(admin)/(activity-management)/events/_components/filterable-data-table.tsx index 35aeb40..208e086 100644 --- a/app/(admin)/(activity-management)/events/_components/filterable-data-table.tsx +++ b/app/(admin)/(activity-management)/events/_components/filterable-data-table.tsx @@ -15,7 +15,7 @@ export default function FilterableDataTable() {
setQuery(e.target.value)} /> diff --git a/app/(admin)/(activity-management)/points/_components/data-table.tsx b/app/(admin)/(activity-management)/points/_components/data-table.tsx index 67447a6..18265fb 100644 --- a/app/(admin)/(activity-management)/points/_components/data-table.tsx +++ b/app/(admin)/(activity-management)/points/_components/data-table.tsx @@ -62,7 +62,15 @@ export function PointsDataTable({ query }: { query?: string }) { const variables = { first: PAGE_SIZE, after, - where: query ? { descriptionContains: query } : undefined, + where: query + ? { + or: [ + { descriptionContains: query }, + { hasUserWith: [{ nameContains: query }] }, + { hasUserWith: [{ emailContains: query }] }, + ], + } + : undefined, } satisfies VariablesOf; const { data } = useSuspenseQuery(POINTS_TABLE_QUERY, { diff --git a/app/(admin)/(activity-management)/points/_components/filterable-data-table.tsx b/app/(admin)/(activity-management)/points/_components/filterable-data-table.tsx index a69767a..d9f04a8 100644 --- a/app/(admin)/(activity-management)/points/_components/filterable-data-table.tsx +++ b/app/(admin)/(activity-management)/points/_components/filterable-data-table.tsx @@ -15,7 +15,7 @@ export default function FilterableDataTable() {
setQuery(e.target.value)} /> diff --git a/app/(admin)/(activity-management)/submissions/_components/data-table.tsx b/app/(admin)/(activity-management)/submissions/_components/data-table.tsx index 8786a9c..22ce8c3 100644 --- a/app/(admin)/(activity-management)/submissions/_components/data-table.tsx +++ b/app/(admin)/(activity-management)/submissions/_components/data-table.tsx @@ -2,18 +2,38 @@ import { CursorDataTable } from "@/components/data-table/cursor"; import type { Direction } from "@/components/data-table/pagination"; +import type { SubmissionStatus } from "@/gql/graphql"; import { useSuspenseQuery } from "@apollo/client/react"; +import type { VariablesOf } from "@graphql-typed-document-node/core"; import { useState } from "react"; import { columns, type Submission } from "./data-table-columns"; import { SUBMISSIONS_TABLE_QUERY } from "./query"; -export function SubmissionsDataTable() { +export type SubmissionStatusFilter = SubmissionStatus | "all"; + +export function SubmissionsDataTable({ + query, + status, +}: { + query?: string; + status?: SubmissionStatusFilter; +}) { const PAGE_SIZE = 20; const [cursors, setCursors] = useState<(string | null)[]>([null]); const [currentIndex, setCurrentIndex] = useState(0); const after = cursors[currentIndex]; - const variables = { first: PAGE_SIZE, after }; + const variables = { + first: PAGE_SIZE, + after, + where: { + or: [ + { hasUserWith: [{ nameContains: query }] }, + { hasUserWith: [{ emailContains: query }] }, + ], + status: status === "all" ? undefined : status, + }, + } satisfies VariablesOf; const { data } = useSuspenseQuery(SUBMISSIONS_TABLE_QUERY, { variables, @@ -45,7 +65,7 @@ export function SubmissionsDataTable() { if (!pageInfo) return; if (direction === "forward" && pageInfo.hasNextPage) { const nextCursor = pageInfo.endCursor ?? null; - setCursors(prev => { + setCursors((prev) => { const newCursors = prev.slice(0, currentIndex + 1); newCursors.push(nextCursor); return newCursors; diff --git a/app/(admin)/(activity-management)/submissions/_components/filterable-data-table.tsx b/app/(admin)/(activity-management)/submissions/_components/filterable-data-table.tsx new file mode 100644 index 0000000..b4f6e0d --- /dev/null +++ b/app/(admin)/(activity-management)/submissions/_components/filterable-data-table.tsx @@ -0,0 +1,43 @@ +"use client"; + +import { Input } from "@/components/ui/input"; + +import { DataTableSkeleton } from "@/components/data-table/skeleton"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; +import { SubmissionStatus } from "@/gql/graphql"; +import { useDebouncedValue } from "foxact/use-debounced-value"; +import { Suspense, useState } from "react"; +import { SubmissionsDataTable, type SubmissionStatusFilter } from "./data-table"; + +export default function FilterableDataTable() { + const [query, setQuery] = useState(""); + const [status, setStatus] = useState("all"); + const debouncedQuery = useDebouncedValue(query, 200); + + return ( +
+
+ setQuery(e.target.value)} + /> + +
+ + }> + + +
+ ); +} diff --git a/app/(admin)/(activity-management)/submissions/_components/query.ts b/app/(admin)/(activity-management)/submissions/_components/query.ts index e75ca41..7a2c242 100644 --- a/app/(admin)/(activity-management)/submissions/_components/query.ts +++ b/app/(admin)/(activity-management)/submissions/_components/query.ts @@ -6,8 +6,9 @@ export const SUBMISSIONS_TABLE_QUERY = graphql(` $after: Cursor $last: Int $before: Cursor + $where: SubmissionWhereInput ) { - submissions(first: $first, after: $after, last: $last, before: $before, orderBy: { field: SUBMITTED_AT, direction: DESC }) { + submissions(first: $first, after: $after, last: $last, before: $before, where: $where, orderBy: { field: SUBMITTED_AT, direction: DESC }) { edges { node { id @@ -16,6 +17,7 @@ export const SUBMISSIONS_TABLE_QUERY = graphql(` user { id name + email } question { id diff --git a/app/(admin)/(activity-management)/submissions/page.tsx b/app/(admin)/(activity-management)/submissions/page.tsx index 04d57b7..0863e06 100644 --- a/app/(admin)/(activity-management)/submissions/page.tsx +++ b/app/(admin)/(activity-management)/submissions/page.tsx @@ -2,7 +2,7 @@ import { DataTableSkeleton } from "@/components/data-table/skeleton"; import { SiteHeader } from "@/components/site-header"; import type { Metadata } from "next"; import { Suspense } from "react"; -import { SubmissionsDataTable } from "./_components/data-table"; +import FilterableDataTable from "./_components/filterable-data-table"; export const metadata: Metadata = { title: "提交記錄", @@ -26,7 +26,7 @@ export default function Page() {
}> - +
diff --git a/app/(admin)/(user-management)/users/[id]/_components/points.tsx b/app/(admin)/(user-management)/users/[id]/_components/points.tsx new file mode 100644 index 0000000..de3d1ea --- /dev/null +++ b/app/(admin)/(user-management)/users/[id]/_components/points.tsx @@ -0,0 +1,105 @@ +"use client"; + +import { CardLayout } from "@/components/card-layout"; +import { type FragmentType, graphql, useFragment } from "@/gql"; +import { Trophy } from "lucide-react"; + +const USER_POINTS_CARD_FRAGMENT = graphql(` + fragment UserPointsCard on User { + totalPoints + + points(first: 5, orderBy: { field: GRANTED_AT, direction: DESC }) { + edges { + node { + id + ...UserPointHistoryLine + } + } + } + } +`); + +const USER_POINT_HISTORY_LINE_FRAGMENT = graphql(` + fragment UserPointHistoryLine on Point { + points + description + grantedAt + } +`); + +export function PointsCard({ + fragment, +}: { + fragment: FragmentType; +}) { + const { totalPoints, points } = useFragment( + USER_POINTS_CARD_FRAGMENT, + fragment, + ); + + return ( + +
+
+ +
+

{totalPoints}

+

積分

+
+
+ + {points?.edges && points.edges.length > 0 && ( +
+

最近積分紀錄

+
+ {points.edges + .map((edge) => { + if (!edge?.node) return null; + return ; + })} +
+
+ )} +
+
+ ); +} + +function PointHistoryLine({ + fragment, +}: { + fragment: FragmentType; +}) { + const { points, description, grantedAt } = useFragment( + USER_POINT_HISTORY_LINE_FRAGMENT, + fragment, + ); + + return ( +
+
+

{description || "積分取得"}

+

+ {new Date(grantedAt).toLocaleString("zh-TW", { + timeZone: "Asia/Taipei", + })} +

+
+ +
+ ); +} + +function Point({ point }: { point: number }) { + const pointAbs = Math.abs(point); + + if (point > 0) { + return +{pointAbs}; + } + + if (point < 0) { + return -{pointAbs}; + } + + return {pointAbs}; +} diff --git a/app/(admin)/(user-management)/users/[id]/_components/questions.tsx b/app/(admin)/(user-management)/users/[id]/_components/questions.tsx new file mode 100644 index 0000000..e2a4f0c --- /dev/null +++ b/app/(admin)/(user-management)/users/[id]/_components/questions.tsx @@ -0,0 +1,88 @@ +"use client"; + +import { CardLayout } from "@/components/card-layout"; +import { type FragmentType, graphql, useFragment } from "@/gql"; +import { DIFFICULTY_TRANSLATION } from "@/lib/translation"; +import { BookOpen, CheckCircle2, FileQuestion } from "lucide-react"; + +const USER_QUESTIONS_CARD_FRAGMENT = graphql(` + fragment UserQuestionsCard on User { + submissionStatistics { + totalQuestions + solvedQuestions + attemptedQuestions + + solvedQuestionByDifficulty { + difficulty + solvedQuestions + } + } + } +`); + +export function QuestionsCard({ fragment }: { fragment: FragmentType }) { + const { submissionStatistics } = useFragment(USER_QUESTIONS_CARD_FRAGMENT, fragment); + + if (!submissionStatistics) { + return ( + +

暫無資料

+
+ ); + } + + const { totalQuestions, solvedQuestions, attemptedQuestions, solvedQuestionByDifficulty } = submissionStatistics; + + return ( + +
+
+
+
+ + 總題數 +
+

{totalQuestions}

+
+
+
+ + 嘗試題數 +
+

{attemptedQuestions}

+
+
+
+ + 完成題數 +
+

{solvedQuestions}

+
+
+ + {solvedQuestionByDifficulty && solvedQuestionByDifficulty.length > 0 && ( +
+

各難度完成題數

+
+ {solvedQuestionByDifficulty.map(({ difficulty, solvedQuestions }) => ( +
+ {DIFFICULTY_TRANSLATION[difficulty]} + {solvedQuestions} +
+ ))} +
+
+ )} +
+
+ ); +} diff --git a/app/(admin)/(user-management)/users/[id]/_components/user-cards.tsx b/app/(admin)/(user-management)/users/[id]/_components/user-cards.tsx index 89d3a66..5c71bd2 100644 --- a/app/(admin)/(user-management)/users/[id]/_components/user-cards.tsx +++ b/app/(admin)/(user-management)/users/[id]/_components/user-cards.tsx @@ -4,6 +4,8 @@ import { graphql } from "@/gql"; import { useSuspenseQuery } from "@apollo/client/react"; import { AuditInfoCard } from "./audit-info"; import { GroupsCard } from "./groups"; +import { PointsCard } from "./points"; +import { QuestionsCard } from "./questions"; const USER_CARDS_QUERY = graphql(` query UserCards($id: ID!) { @@ -11,6 +13,8 @@ const USER_CARDS_QUERY = graphql(` id ...UserGroupsCard ...UserAuditInfoCard + ...UserPointsCard + ...UserQuestionsCard } } `); @@ -31,6 +35,8 @@ export function UserCards({ id }: { id: string }) { > + +
); } diff --git a/gql/gql.ts b/gql/gql.ts index fdfbc82..8302810 100644 --- a/gql/gql.ts +++ b/gql/gql.ts @@ -21,7 +21,6 @@ type Documents = { "\n fragment PointDetailsCard on Point {\n points\n description\n grantedAt\n }\n": typeof types.PointDetailsCardFragmentDoc, "\n fragment PointUserCard on Point {\n user {\n id\n name\n }\n }\n": typeof types.PointUserCardFragmentDoc, "\n mutation CreatePoint($input: CreatePointInput!) {\n createPoint(input: $input) {\n id\n }\n }\n": typeof types.CreatePointDocument, - "\n query CreatePointDialogContent {\n users(first: 100) {\n edges {\n node {\n id\n name\n email\n }\n }\n }\n }\n": typeof types.CreatePointDialogContentDocument, "\n query PointsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n $where: PointWhereInput\n ) {\n points(\n first: $first\n after: $after\n last: $last\n before: $before\n where: $where\n orderBy: { field: GRANTED_AT, direction: DESC }\n ) {\n edges {\n node {\n id\n ...PointsTableRow\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n": typeof types.PointsTableDocument, "\n fragment PointsTableRow on Point {\n id\n user {\n id\n name\n }\n points\n description\n grantedAt\n }\n": typeof types.PointsTableRowFragmentDoc, "\n query UpdatePointsFormUserInfo($id: ID!) {\n user(id: $id) {\n id\n name\n email\n }\n }\n": typeof types.UpdatePointsFormUserInfoDocument, @@ -30,7 +29,7 @@ type Documents = { "\n query SubmissionCards($id: ID!) {\n submission(id: $id) {\n id\n ...SubmissionDetailsCard\n ...SubmissionUserCard\n ...SubmissionResultCard\n }\n }\n": typeof types.SubmissionCardsDocument, "\n fragment SubmissionDetailsCard on Submission {\n submittedCode\n error\n }\n": typeof types.SubmissionDetailsCardFragmentDoc, "\n fragment SubmissionUserCard on Submission {\n user {\n id\n name\n }\n }\n": typeof types.SubmissionUserCardFragmentDoc, - "\n query SubmissionsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n ) {\n submissions(first: $first, after: $after, last: $last, before: $before, orderBy: { field: SUBMITTED_AT, direction: DESC }) {\n edges {\n node {\n id\n submittedCode\n status\n user {\n id\n name\n }\n question {\n id\n title\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n endCursor\n startCursor\n }\n }\n }\n": typeof types.SubmissionsTableDocument, + "\n query SubmissionsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n $where: SubmissionWhereInput\n ) {\n submissions(first: $first, after: $after, last: $last, before: $before, where: $where, orderBy: { field: SUBMITTED_AT, direction: DESC }) {\n edges {\n node {\n id\n submittedCode\n status\n user {\n id\n name\n email\n }\n question {\n id\n title\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n endCursor\n startCursor\n }\n }\n }\n": typeof types.SubmissionsTableDocument, "\n query DatabaseCards($id: ID!) {\n database(id: $id) {\n id\n ...DatabaseDescriptionCard\n ...DatabaseRelationCard\n ...DatabaseSchemaCard\n }\n }\n": typeof types.DatabaseCardsDocument, "\n fragment DatabaseDescriptionCard on Database {\n description\n }\n": typeof types.DatabaseDescriptionCardFragmentDoc, "\n query DatabaseHeader($id: ID!) {\n database(id: $id) {\n id\n slug\n description\n }\n }\n": typeof types.DatabaseHeaderDocument, @@ -80,7 +79,10 @@ type Documents = { "\n fragment UserAuditInfoCard on User {\n createdAt\n updatedAt\n }\n": typeof types.UserAuditInfoCardFragmentDoc, "\n fragment UserGroupsCard on User {\n group {\n id\n name\n }\n }\n": typeof types.UserGroupsCardFragmentDoc, "\n query UserHeader($id: ID!) {\n user(id: $id) {\n id\n name\n email\n avatar\n }\n }\n": typeof types.UserHeaderDocument, - "\n query UserCards($id: ID!) {\n user(id: $id) {\n id\n ...UserGroupsCard\n ...UserAuditInfoCard\n }\n }\n": typeof types.UserCardsDocument, + "\n fragment UserPointsCard on User {\n totalPoints\n\n points(first: 5, orderBy: { field: GRANTED_AT, direction: DESC }) {\n edges {\n node {\n id\n ...UserPointHistoryLine\n }\n }\n }\n }\n": typeof types.UserPointsCardFragmentDoc, + "\n fragment UserPointHistoryLine on Point {\n points\n description\n grantedAt\n }\n": typeof types.UserPointHistoryLineFragmentDoc, + "\n fragment UserQuestionsCard on User {\n submissionStatistics {\n totalQuestions\n solvedQuestions\n attemptedQuestions\n\n solvedQuestionByDifficulty {\n difficulty\n solvedQuestions\n }\n }\n }\n": typeof types.UserQuestionsCardFragmentDoc, + "\n query UserCards($id: ID!) {\n user(id: $id) {\n id\n ...UserGroupsCard\n ...UserAuditInfoCard\n ...UserPointsCard\n ...UserQuestionsCard\n }\n }\n": typeof types.UserCardsDocument, "\n mutation UpdateUser($id: ID!, $input: UpdateUserInput!) {\n updateUser(id: $id, input: $input) {\n id\n }\n }\n": typeof types.UpdateUserDocument, "\n mutation DeleteUser($id: ID!) {\n deleteUser(id: $id)\n }\n": typeof types.DeleteUserDocument, "\n mutation LogoutUserDevices($userID: ID!) {\n logoutUser(userID: $userID)\n }\n": typeof types.LogoutUserDevicesDocument, @@ -107,7 +109,6 @@ const documents: Documents = { "\n fragment PointDetailsCard on Point {\n points\n description\n grantedAt\n }\n": types.PointDetailsCardFragmentDoc, "\n fragment PointUserCard on Point {\n user {\n id\n name\n }\n }\n": types.PointUserCardFragmentDoc, "\n mutation CreatePoint($input: CreatePointInput!) {\n createPoint(input: $input) {\n id\n }\n }\n": types.CreatePointDocument, - "\n query CreatePointDialogContent {\n users(first: 100) {\n edges {\n node {\n id\n name\n email\n }\n }\n }\n }\n": types.CreatePointDialogContentDocument, "\n query PointsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n $where: PointWhereInput\n ) {\n points(\n first: $first\n after: $after\n last: $last\n before: $before\n where: $where\n orderBy: { field: GRANTED_AT, direction: DESC }\n ) {\n edges {\n node {\n id\n ...PointsTableRow\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n": types.PointsTableDocument, "\n fragment PointsTableRow on Point {\n id\n user {\n id\n name\n }\n points\n description\n grantedAt\n }\n": types.PointsTableRowFragmentDoc, "\n query UpdatePointsFormUserInfo($id: ID!) {\n user(id: $id) {\n id\n name\n email\n }\n }\n": types.UpdatePointsFormUserInfoDocument, @@ -116,7 +117,7 @@ const documents: Documents = { "\n query SubmissionCards($id: ID!) {\n submission(id: $id) {\n id\n ...SubmissionDetailsCard\n ...SubmissionUserCard\n ...SubmissionResultCard\n }\n }\n": types.SubmissionCardsDocument, "\n fragment SubmissionDetailsCard on Submission {\n submittedCode\n error\n }\n": types.SubmissionDetailsCardFragmentDoc, "\n fragment SubmissionUserCard on Submission {\n user {\n id\n name\n }\n }\n": types.SubmissionUserCardFragmentDoc, - "\n query SubmissionsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n ) {\n submissions(first: $first, after: $after, last: $last, before: $before, orderBy: { field: SUBMITTED_AT, direction: DESC }) {\n edges {\n node {\n id\n submittedCode\n status\n user {\n id\n name\n }\n question {\n id\n title\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n endCursor\n startCursor\n }\n }\n }\n": types.SubmissionsTableDocument, + "\n query SubmissionsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n $where: SubmissionWhereInput\n ) {\n submissions(first: $first, after: $after, last: $last, before: $before, where: $where, orderBy: { field: SUBMITTED_AT, direction: DESC }) {\n edges {\n node {\n id\n submittedCode\n status\n user {\n id\n name\n email\n }\n question {\n id\n title\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n endCursor\n startCursor\n }\n }\n }\n": types.SubmissionsTableDocument, "\n query DatabaseCards($id: ID!) {\n database(id: $id) {\n id\n ...DatabaseDescriptionCard\n ...DatabaseRelationCard\n ...DatabaseSchemaCard\n }\n }\n": types.DatabaseCardsDocument, "\n fragment DatabaseDescriptionCard on Database {\n description\n }\n": types.DatabaseDescriptionCardFragmentDoc, "\n query DatabaseHeader($id: ID!) {\n database(id: $id) {\n id\n slug\n description\n }\n }\n": types.DatabaseHeaderDocument, @@ -166,7 +167,10 @@ const documents: Documents = { "\n fragment UserAuditInfoCard on User {\n createdAt\n updatedAt\n }\n": types.UserAuditInfoCardFragmentDoc, "\n fragment UserGroupsCard on User {\n group {\n id\n name\n }\n }\n": types.UserGroupsCardFragmentDoc, "\n query UserHeader($id: ID!) {\n user(id: $id) {\n id\n name\n email\n avatar\n }\n }\n": types.UserHeaderDocument, - "\n query UserCards($id: ID!) {\n user(id: $id) {\n id\n ...UserGroupsCard\n ...UserAuditInfoCard\n }\n }\n": types.UserCardsDocument, + "\n fragment UserPointsCard on User {\n totalPoints\n\n points(first: 5, orderBy: { field: GRANTED_AT, direction: DESC }) {\n edges {\n node {\n id\n ...UserPointHistoryLine\n }\n }\n }\n }\n": types.UserPointsCardFragmentDoc, + "\n fragment UserPointHistoryLine on Point {\n points\n description\n grantedAt\n }\n": types.UserPointHistoryLineFragmentDoc, + "\n fragment UserQuestionsCard on User {\n submissionStatistics {\n totalQuestions\n solvedQuestions\n attemptedQuestions\n\n solvedQuestionByDifficulty {\n difficulty\n solvedQuestions\n }\n }\n }\n": types.UserQuestionsCardFragmentDoc, + "\n query UserCards($id: ID!) {\n user(id: $id) {\n id\n ...UserGroupsCard\n ...UserAuditInfoCard\n ...UserPointsCard\n ...UserQuestionsCard\n }\n }\n": types.UserCardsDocument, "\n mutation UpdateUser($id: ID!, $input: UpdateUserInput!) {\n updateUser(id: $id, input: $input) {\n id\n }\n }\n": types.UpdateUserDocument, "\n mutation DeleteUser($id: ID!) {\n deleteUser(id: $id)\n }\n": types.DeleteUserDocument, "\n mutation LogoutUserDevices($userID: ID!) {\n logoutUser(userID: $userID)\n }\n": types.LogoutUserDevicesDocument, @@ -228,10 +232,6 @@ export function graphql(source: "\n fragment PointUserCard on Point {\n user * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql(source: "\n mutation CreatePoint($input: CreatePointInput!) {\n createPoint(input: $input) {\n id\n }\n }\n"): (typeof documents)["\n mutation CreatePoint($input: CreatePointInput!) {\n createPoint(input: $input) {\n id\n }\n }\n"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "\n query CreatePointDialogContent {\n users(first: 100) {\n edges {\n node {\n id\n name\n email\n }\n }\n }\n }\n"): (typeof documents)["\n query CreatePointDialogContent {\n users(first: 100) {\n edges {\n node {\n id\n name\n email\n }\n }\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -267,7 +267,7 @@ export function graphql(source: "\n fragment SubmissionUserCard on Submission { /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query SubmissionsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n ) {\n submissions(first: $first, after: $after, last: $last, before: $before, orderBy: { field: SUBMITTED_AT, direction: DESC }) {\n edges {\n node {\n id\n submittedCode\n status\n user {\n id\n name\n }\n question {\n id\n title\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n endCursor\n startCursor\n }\n }\n }\n"): (typeof documents)["\n query SubmissionsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n ) {\n submissions(first: $first, after: $after, last: $last, before: $before, orderBy: { field: SUBMITTED_AT, direction: DESC }) {\n edges {\n node {\n id\n submittedCode\n status\n user {\n id\n name\n }\n question {\n id\n title\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n endCursor\n startCursor\n }\n }\n }\n"]; +export function graphql(source: "\n query SubmissionsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n $where: SubmissionWhereInput\n ) {\n submissions(first: $first, after: $after, last: $last, before: $before, where: $where, orderBy: { field: SUBMITTED_AT, direction: DESC }) {\n edges {\n node {\n id\n submittedCode\n status\n user {\n id\n name\n email\n }\n question {\n id\n title\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n endCursor\n startCursor\n }\n }\n }\n"): (typeof documents)["\n query SubmissionsTable(\n $first: Int\n $after: Cursor\n $last: Int\n $before: Cursor\n $where: SubmissionWhereInput\n ) {\n submissions(first: $first, after: $after, last: $last, before: $before, where: $where, orderBy: { field: SUBMITTED_AT, direction: DESC }) {\n edges {\n node {\n id\n submittedCode\n status\n user {\n id\n name\n email\n }\n question {\n id\n title\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n endCursor\n startCursor\n }\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -467,7 +467,19 @@ export function graphql(source: "\n query UserHeader($id: ID!) {\n user(id: /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query UserCards($id: ID!) {\n user(id: $id) {\n id\n ...UserGroupsCard\n ...UserAuditInfoCard\n }\n }\n"): (typeof documents)["\n query UserCards($id: ID!) {\n user(id: $id) {\n id\n ...UserGroupsCard\n ...UserAuditInfoCard\n }\n }\n"]; +export function graphql(source: "\n fragment UserPointsCard on User {\n totalPoints\n\n points(first: 5, orderBy: { field: GRANTED_AT, direction: DESC }) {\n edges {\n node {\n id\n ...UserPointHistoryLine\n }\n }\n }\n }\n"): (typeof documents)["\n fragment UserPointsCard on User {\n totalPoints\n\n points(first: 5, orderBy: { field: GRANTED_AT, direction: DESC }) {\n edges {\n node {\n id\n ...UserPointHistoryLine\n }\n }\n }\n }\n"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "\n fragment UserPointHistoryLine on Point {\n points\n description\n grantedAt\n }\n"): (typeof documents)["\n fragment UserPointHistoryLine on Point {\n points\n description\n grantedAt\n }\n"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "\n fragment UserQuestionsCard on User {\n submissionStatistics {\n totalQuestions\n solvedQuestions\n attemptedQuestions\n\n solvedQuestionByDifficulty {\n difficulty\n solvedQuestions\n }\n }\n }\n"): (typeof documents)["\n fragment UserQuestionsCard on User {\n submissionStatistics {\n totalQuestions\n solvedQuestions\n attemptedQuestions\n\n solvedQuestionByDifficulty {\n difficulty\n solvedQuestions\n }\n }\n }\n"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "\n query UserCards($id: ID!) {\n user(id: $id) {\n id\n ...UserGroupsCard\n ...UserAuditInfoCard\n ...UserPointsCard\n ...UserQuestionsCard\n }\n }\n"): (typeof documents)["\n query UserCards($id: ID!) {\n user(id: $id) {\n id\n ...UserGroupsCard\n ...UserAuditInfoCard\n ...UserPointsCard\n ...UserQuestionsCard\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/gql/graphql.ts b/gql/graphql.ts index 8487654..375aec0 100644 --- a/gql/graphql.ts +++ b/gql/graphql.ts @@ -1590,11 +1590,6 @@ export type CreatePointMutationVariables = Exact<{ export type CreatePointMutation = { __typename?: 'Mutation', createPoint?: { __typename?: 'Point', id: string } | null }; -export type CreatePointDialogContentQueryVariables = Exact<{ [key: string]: never; }>; - - -export type CreatePointDialogContentQuery = { __typename?: 'Query', users: { __typename?: 'UserConnection', edges?: Array<{ __typename?: 'UserEdge', node?: { __typename?: 'User', id: string, name: string, email: string } | null } | null> | null } }; - export type PointsTableQueryVariables = Exact<{ first?: InputMaybe; after?: InputMaybe; @@ -1646,10 +1641,11 @@ export type SubmissionsTableQueryVariables = Exact<{ after?: InputMaybe; last?: InputMaybe; before?: InputMaybe; + where?: InputMaybe; }>; -export type SubmissionsTableQuery = { __typename?: 'Query', submissions: { __typename?: 'SubmissionConnection', totalCount: number, edges?: Array<{ __typename?: 'SubmissionEdge', node?: { __typename?: 'Submission', id: string, submittedCode: string, status: SubmissionStatus, user: { __typename?: 'User', id: string, name: string }, question: { __typename?: 'Question', id: string, title: string } } | null } | null> | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, endCursor?: any | null, startCursor?: any | null } } }; +export type SubmissionsTableQuery = { __typename?: 'Query', submissions: { __typename?: 'SubmissionConnection', totalCount: number, edges?: Array<{ __typename?: 'SubmissionEdge', node?: { __typename?: 'Submission', id: string, submittedCode: string, status: SubmissionStatus, user: { __typename?: 'User', id: string, name: string, email: string }, question: { __typename?: 'Question', id: string, title: string } } | null } | null> | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, endCursor?: any | null, startCursor?: any | null } } }; export type DatabaseCardsQueryVariables = Exact<{ id: Scalars['ID']['input']; @@ -1940,6 +1936,15 @@ export type UserHeaderQueryVariables = Exact<{ export type UserHeaderQuery = { __typename?: 'Query', user: { __typename?: 'User', id: string, name: string, email: string, avatar?: string | null } }; +export type UserPointsCardFragment = { __typename?: 'User', totalPoints: number, points: { __typename?: 'PointConnection', edges?: Array<{ __typename?: 'PointEdge', node?: ( + { __typename?: 'Point', id: string } + & { ' $fragmentRefs'?: { 'UserPointHistoryLineFragment': UserPointHistoryLineFragment } } + ) | null } | null> | null } } & { ' $fragmentName'?: 'UserPointsCardFragment' }; + +export type UserPointHistoryLineFragment = { __typename?: 'Point', points: number, description?: string | null, grantedAt: string } & { ' $fragmentName'?: 'UserPointHistoryLineFragment' }; + +export type UserQuestionsCardFragment = { __typename?: 'User', submissionStatistics: { __typename?: 'SubmissionStatistics', totalQuestions: number, solvedQuestions: number, attemptedQuestions: number, solvedQuestionByDifficulty: Array<{ __typename?: 'SolvedQuestionByDifficulty', difficulty: QuestionDifficulty, solvedQuestions: number }> } } & { ' $fragmentName'?: 'UserQuestionsCardFragment' }; + export type UserCardsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; @@ -1947,7 +1952,7 @@ export type UserCardsQueryVariables = Exact<{ export type UserCardsQuery = { __typename?: 'Query', user: ( { __typename?: 'User', id: string } - & { ' $fragmentRefs'?: { 'UserGroupsCardFragment': UserGroupsCardFragment;'UserAuditInfoCardFragment': UserAuditInfoCardFragment } } + & { ' $fragmentRefs'?: { 'UserGroupsCardFragment': UserGroupsCardFragment;'UserAuditInfoCardFragment': UserAuditInfoCardFragment;'UserPointsCardFragment': UserPointsCardFragment;'UserQuestionsCardFragment': UserQuestionsCardFragment } } ) }; export type UpdateUserMutationVariables = Exact<{ @@ -2075,6 +2080,9 @@ export const GroupScopeCardFragmentDoc = {"kind":"Document","definitions":[{"kin export const ScopeSetScopesCardFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ScopeSetScopesCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ScopeSet"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"scopes"}}]}}]} as unknown as DocumentNode; export const UserAuditInfoCardFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserAuditInfoCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const UserGroupsCardFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserGroupsCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"group"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode; +export const UserPointHistoryLineFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserPointHistoryLine"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Point"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"points"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"grantedAt"}}]}}]} as unknown as DocumentNode; +export const UserPointsCardFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserPointsCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalPoints"}},{"kind":"Field","name":{"kind":"Name","value":"points"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"5"}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"field"},"value":{"kind":"EnumValue","value":"GRANTED_AT"}},{"kind":"ObjectField","name":{"kind":"Name","value":"direction"},"value":{"kind":"EnumValue","value":"DESC"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserPointHistoryLine"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserPointHistoryLine"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Point"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"points"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"grantedAt"}}]}}]} as unknown as DocumentNode; +export const UserQuestionsCardFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQuestionsCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"submissionStatistics"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalQuestions"}},{"kind":"Field","name":{"kind":"Name","value":"solvedQuestions"}},{"kind":"Field","name":{"kind":"Name","value":"attemptedQuestions"}},{"kind":"Field","name":{"kind":"Name","value":"solvedQuestionByDifficulty"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"difficulty"}},{"kind":"Field","name":{"kind":"Name","value":"solvedQuestions"}}]}}]}}]}}]} as unknown as DocumentNode; export const UserCompletedQuestionsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserCompletedQuestions"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RankingEdge"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"submissionStatistics"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"solvedQuestions"}}]}}]}}]}}]} as unknown as DocumentNode; export const UserTotalPointsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserTotalPoints"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RankingEdge"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalPoints"}}]}}]}}]} as unknown as DocumentNode; export const RankingFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RankingFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RankingEdge"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"score"}}]}}]} as unknown as DocumentNode; @@ -2084,12 +2092,11 @@ export const EventsTableDocument = {"kind":"Document","definitions":[{"kind":"Op export const PointHeaderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"PointHeader"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pointGrant"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"points"}},{"kind":"Field","name":{"kind":"Name","value":"grantedAt"}}]}}]}}]} as unknown as DocumentNode; export const PointCardsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"PointCards"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pointGrant"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"PointDetailsCard"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"PointUserCard"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PointDetailsCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Point"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"points"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"grantedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PointUserCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Point"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode; export const CreatePointDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreatePoint"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreatePointInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createPoint"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; -export const CreatePointDialogContentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CreatePointDialogContent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"users"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"100"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const PointsTableDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"PointsTable"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Cursor"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"last"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"before"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Cursor"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"PointWhereInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"points"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}},{"kind":"Argument","name":{"kind":"Name","value":"last"},"value":{"kind":"Variable","name":{"kind":"Name","value":"last"}}},{"kind":"Argument","name":{"kind":"Name","value":"before"},"value":{"kind":"Variable","name":{"kind":"Name","value":"before"}}},{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"field"},"value":{"kind":"EnumValue","value":"GRANTED_AT"}},{"kind":"ObjectField","name":{"kind":"Name","value":"direction"},"value":{"kind":"EnumValue","value":"DESC"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"PointsTableRow"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PointsTableRow"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Point"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"points"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"grantedAt"}}]}}]} as unknown as DocumentNode; export const UpdatePointsFormUserInfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"UpdatePointsFormUserInfo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}}]}}]} as unknown as DocumentNode; export const SubmissionHeaderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SubmissionHeader"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"submission"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"submittedAt"}}]}}]}}]} as unknown as DocumentNode; export const SubmissionCardsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SubmissionCards"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"submission"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubmissionDetailsCard"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubmissionUserCard"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubmissionResultCard"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubmissionDetailsCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Submission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"submittedCode"}},{"kind":"Field","name":{"kind":"Name","value":"error"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubmissionUserCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Submission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubmissionResultCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Submission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"queryResult"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"columns"}},{"kind":"Field","name":{"kind":"Name","value":"rows"}},{"kind":"Field","name":{"kind":"Name","value":"matchAnswer"}}]}},{"kind":"Field","name":{"kind":"Name","value":"question"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; -export const SubmissionsTableDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SubmissionsTable"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Cursor"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"last"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"before"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Cursor"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"submissions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}},{"kind":"Argument","name":{"kind":"Name","value":"last"},"value":{"kind":"Variable","name":{"kind":"Name","value":"last"}}},{"kind":"Argument","name":{"kind":"Name","value":"before"},"value":{"kind":"Variable","name":{"kind":"Name","value":"before"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"field"},"value":{"kind":"EnumValue","value":"SUBMITTED_AT"}},{"kind":"ObjectField","name":{"kind":"Name","value":"direction"},"value":{"kind":"EnumValue","value":"DESC"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"submittedCode"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"question"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"hasPreviousPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}},{"kind":"Field","name":{"kind":"Name","value":"startCursor"}}]}}]}}]}}]} as unknown as DocumentNode; +export const SubmissionsTableDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SubmissionsTable"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Cursor"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"last"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"before"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Cursor"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"SubmissionWhereInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"submissions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}},{"kind":"Argument","name":{"kind":"Name","value":"last"},"value":{"kind":"Variable","name":{"kind":"Name","value":"last"}}},{"kind":"Argument","name":{"kind":"Name","value":"before"},"value":{"kind":"Variable","name":{"kind":"Name","value":"before"}}},{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"field"},"value":{"kind":"EnumValue","value":"SUBMITTED_AT"}},{"kind":"ObjectField","name":{"kind":"Name","value":"direction"},"value":{"kind":"EnumValue","value":"DESC"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"submittedCode"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}},{"kind":"Field","name":{"kind":"Name","value":"question"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"hasPreviousPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}},{"kind":"Field","name":{"kind":"Name","value":"startCursor"}}]}}]}}]}}]} as unknown as DocumentNode; export const DatabaseCardsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"DatabaseCards"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"database"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"DatabaseDescriptionCard"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"DatabaseRelationCard"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"DatabaseSchemaCard"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DatabaseDescriptionCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Database"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DatabaseRelationCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Database"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"relationFigure"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DatabaseSchemaCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Database"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"schema"}}]}}]} as unknown as DocumentNode; export const DatabaseHeaderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"DatabaseHeader"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"database"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode; export const CreateDatabaseDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateDatabase"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateDatabaseInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createDatabase"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; @@ -2126,7 +2133,7 @@ export const DeleteScopeSetDocument = {"kind":"Document","definitions":[{"kind": export const ScopeSetTableDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ScopeSetTable"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"scopeSets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"scopes"}}]}}]}}]} as unknown as DocumentNode; export const ScopeSetByIdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ScopeSetById"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"scopeSet"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"scopes"}}]}}]}}]} as unknown as DocumentNode; export const UserHeaderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"UserHeader"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"avatar"}}]}}]}}]} as unknown as DocumentNode; -export const UserCardsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"UserCards"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserGroupsCard"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserAuditInfoCard"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserGroupsCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"group"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserAuditInfoCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; +export const UserCardsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"UserCards"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserGroupsCard"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserAuditInfoCard"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserPointsCard"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserQuestionsCard"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserPointHistoryLine"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Point"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"points"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"grantedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserGroupsCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"group"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserAuditInfoCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserPointsCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalPoints"}},{"kind":"Field","name":{"kind":"Name","value":"points"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"5"}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"field"},"value":{"kind":"EnumValue","value":"GRANTED_AT"}},{"kind":"ObjectField","name":{"kind":"Name","value":"direction"},"value":{"kind":"EnumValue","value":"DESC"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserPointHistoryLine"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQuestionsCard"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"submissionStatistics"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalQuestions"}},{"kind":"Field","name":{"kind":"Name","value":"solvedQuestions"}},{"kind":"Field","name":{"kind":"Name","value":"attemptedQuestions"}},{"kind":"Field","name":{"kind":"Name","value":"solvedQuestionByDifficulty"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"difficulty"}},{"kind":"Field","name":{"kind":"Name","value":"solvedQuestions"}}]}}]}}]}}]} as unknown as DocumentNode; export const UpdateUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateUser"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateUserInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateUser"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; export const DeleteUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteUser"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteUser"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}]}}]} as unknown as DocumentNode; export const LogoutUserDevicesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"LogoutUserDevices"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"userID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"logoutUser"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"userID"},"value":{"kind":"Variable","name":{"kind":"Name","value":"userID"}}}]}]}}]} as unknown as DocumentNode; diff --git a/lib/translation.ts b/lib/translation.ts new file mode 100644 index 0000000..2b41713 --- /dev/null +++ b/lib/translation.ts @@ -0,0 +1,8 @@ +import { QuestionDifficulty } from "@/gql/graphql"; + +export const DIFFICULTY_TRANSLATION: Record = { + [QuestionDifficulty.Easy]: "簡單", + [QuestionDifficulty.Medium]: "中等", + [QuestionDifficulty.Hard]: "困難", + [QuestionDifficulty.Unspecified]: "未指定", +};