Connect, collaborate, and grow with a community of TypeScript developers
Json -> MedText column (#107)
Sean Boult5b47dc31d016
diff --git a/prisma/schema.prisma b/prisma/schema.prismaindex c4e0d8f4..6a8156db 100644--- a/prisma/schema.prisma+++ b/prisma/schema.prisma@@ -104,9 +104,9 @@ model Challenge {updatedAt DateTime @updatedAtdifficulty Difficultyname String- description Json+ description String @db.MediumTextshortDescription String- prompt Json+ prompt String @db.MediumTextuser User @relation(fields: [userId], references: [id])userId StringVote Vote[]@@ -137,7 +137,7 @@ model Vote {model SharedSolution {id Int @id @default(autoincrement())- description Json+ description String @db.MediumTextsolution Solution @relation(fields: [solutionId], references: [id])solutionId IntVote Vote[]@@ -154,7 +154,7 @@ model SharedSolution {model Solution {id Int @id @default(autoincrement())- code Json+ code String @db.MediumTextuser User @relation(fields: [userId], references: [id])userId Stringchallenge Challenge @relation(fields: [challengeId], references: [id])diff --git a/src/components/challenge/description-panel.tsx b/src/components/challenge/description-panel.tsxindex c1a0913f..e2fdf7be 100644--- a/src/components/challenge/description-panel.tsx+++ b/src/components/challenge/description-panel.tsx@@ -364,7 +364,7 @@ export function DescriptionPanel({ challenge }: Props) {</TooltipProvider></div><div className="prose-invert leading-8 prose-h3:text-xl">- <Markdown>{challenge.description as string}</Markdown>+ <Markdown>{challenge.description}</Markdown></div></div></TabsContent>diff --git a/src/components/challenge/editor/index.tsx b/src/components/challenge/editor/index.tsxindex a78a0716..7e6b0fd9 100644--- a/src/components/challenge/editor/index.tsx+++ b/src/components/challenge/editor/index.tsx@@ -95,15 +95,15 @@ export const CodePanel = (props: Props) => {return props.challenge.prompt;}- const [appendSolutionToThis, separator] = (props.challenge.prompt as string).split(+ const [appendSolutionToThis, separator] = (props.challenge.prompt).split(USER_CODE_START_REGEX,);- const parsedUserSolution = JSON.parse(usersExistingSolution?.code as string) as string;+ const parsedUserSolution = usersExistingSolution?.code;return `${appendSolutionToThis ?? ''}${separator ?? ''}${parsedUserSolution}`;}, [props.challenge?.Solution, props.challenge?.prompt, props.mode, props.prompt]);- const [code, setCode] = useState(defaultCode as string);+ const [code, setCode] = useState(defaultCode);const editorTheme = theme === 'light' ? 'vs' : 'vs-dark';const modelRef = useRef<monaco.editor.ITextModel>();@@ -138,7 +138,7 @@ export const CodePanel = (props: Props) => {await saveSubmission(props.challenge.id,session?.user?.id as string,- JSON.stringify(solution) ?? '',+ solution ?? '',);router.refresh();toast({