Skip to content

Commit

Permalink
chore: rename input schema for exports
Browse files Browse the repository at this point in the history
  • Loading branch information
JBR90 committed Nov 29, 2024
1 parent 52eec1b commit 324ae3a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";

import type { LessonDeepPartial } from "@oakai/exports/browser";
import { exportSlidesFullLessonSchema } from "@oakai/exports/browser";
import type { LessonSlidesInputData } from "@oakai/exports/src/schema/input.schema";
import type { LessonInputData } from "@oakai/exports/src/schema/input.schema";
import { aiLogger } from "@oakai/logger";
import * as Sentry from "@sentry/nextjs";
import { useDebounce } from "@uidotdev/usehooks";
Expand All @@ -29,8 +29,7 @@ export function useExportAllLessonAssets({
const query = trpc.exports.generateAllAssetExports.useMutation();

const [parseResult, setParseResult] = useState<
| { data?: LessonSlidesInputData; success: boolean; error?: ZodError }
| undefined
{ data?: LessonInputData; success: boolean; error?: ZodError } | undefined
>({ success: false });
const debouncedParseResult = useDebounce(parseResult, 500);

Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/export/exportAdditionalMaterialsDoc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { SignedInAuthObject } from "@clerk/backend/internal";
import type { PrismaClientWithAccelerate } from "@oakai/db";
import { exportAdditionalMaterials } from "@oakai/exports";
import type { LessonSlidesInputData } from "@oakai/exports/src/schema/input.schema";
import type { LessonInputData } from "@oakai/exports/src/schema/input.schema";
import { aiLogger } from "@oakai/logger";
import * as Sentry from "@sentry/nextjs";

Expand All @@ -16,7 +16,7 @@ export async function exportAdditionalMaterialsDoc({
ctx,
}: {
input: {
data: LessonSlidesInputData;
data: LessonInputData;
chatId: string;
messageId: string;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/export/exportLessonPlan.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { SignedInAuthObject } from "@clerk/backend/internal";
import type { PrismaClientWithAccelerate } from "@oakai/db";
import { exportDocLessonPlan } from "@oakai/exports";
import type { LessonPlanSections } from "@oakai/exports/src/schema/input.schema";
import type { LessonInputData } from "@oakai/exports/src/schema/input.schema";
import { aiLogger } from "@oakai/logger";
import * as Sentry from "@sentry/nextjs";

Expand All @@ -16,7 +16,7 @@ export async function exportLessonPlan({
ctx,
}: {
input: {
data: LessonPlanSections;
data: LessonInputData;
chatId: string;
messageId: string;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/exports/src/exportAdditionalMaterials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { prepLessonForAdditionalMaterialsDoc } from "./dataHelpers/prepLessonFor
import { exportGeneric } from "./exportGeneric";
import { getDocsClient } from "./gSuite/docs/client";
import { populateDoc } from "./gSuite/docs/populateDoc";
import type { LessonSlidesInputData } from "./schema/input.schema";
import type { LessonInputData } from "./schema/input.schema";
import { getSlidesTemplateIdAdditionalMaterials as getDocsTemplateIdAdditionalMaterials } from "./templates";
import type { OutputData, Result, State } from "./types";

Expand All @@ -17,7 +17,7 @@ export const exportAdditionalMaterials = async ({
onStateChange,
}: {
snapshotId: string;
lesson: LessonSlidesInputData;
lesson: LessonInputData;
userEmail: string;
onStateChange: (state: State<OutputData>) => void;
}): Promise<Result<OutputData>> => {
Expand Down
6 changes: 5 additions & 1 deletion packages/exports/src/schema/input.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const keywordSchema = z.object({
definition: z.string(),
});

export const lessonSlidesInputSchema = z.object({
export const lessonInputSchema = z.object({
title: z.string(),
subject: z.string(),
keyStage: z.string().nullish(),
Expand All @@ -58,6 +58,10 @@ export const lessonSlidesInputSchema = z.object({
_experimental_exitQuizMathsV0: quizSchema.nullish(),
});

export type LessonInputData = z.infer<typeof lessonInputSchema>;

export const lessonSlidesInputSchema = lessonInputSchema;

export type LessonSlidesInputData = z.infer<typeof lessonSlidesInputSchema>;

export const lessonPlanDocInputSchema = lessonSlidesInputSchema;
Expand Down

0 comments on commit 324ae3a

Please sign in to comment.