Skip to content

Commit

Permalink
update zod schema for import assets
Browse files Browse the repository at this point in the history
  • Loading branch information
rockingrohit9639 committed Jan 17, 2025
1 parent 2db4355 commit 7d2327e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/modules/asset/utils.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,4 @@ export const importAssetsSchema = z
bookable: z.enum(["yes", "no"]).optional(),
imageUrl: z.string().url().optional(),
})
.and(z.record(z.string().startsWith("cf"), z.any()));
.and(z.record(z.string(), z.any()));
6 changes: 3 additions & 3 deletions app/utils/import.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export function extractCSVDataFromContentImport<Schema extends ZodSchema>(
)
);

const parseResult = schema.safeParse(rawData);
if (!parseResult.success) {
const parsedResult = schema.safeParse(rawData);
if (!parsedResult.success) {
throw new ShelfError({
cause: null,
message:
Expand All @@ -64,7 +64,7 @@ export function extractCSVDataFromContentImport<Schema extends ZodSchema>(
});
}

return parseResult.data as Schema["_output"];
return parsedResult.data as Schema["_output"];
}

/** Takes the CSV data from a `backup` import and parses it into an object that we can then use to create the entries */
Expand Down

0 comments on commit 7d2327e

Please sign in to comment.