Skip to content

Commit 28a0a0a

Browse files
committed
max length and trim fix
1 parent 56a4c94 commit 28a0a0a

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

apps/antalmanac/src/backend/routers/review.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const submitReviewInput = z.object({
2929
difficulty: z.number().int().min(1).max(5),
3030
tags: z.array(reviewTagsEnum).default([]),
3131
anonymous: z.boolean().default(true),
32-
content: z.string().optional(),
32+
content: z.string().max(500).optional(),
3333
});
3434

3535
const reviewRouter = router({

apps/antalmanac/src/stores/ReviewPromptStore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ export const useReviewPromptStore = create(
169169
const { candidate, rating, difficulty, selectedTags, textReview } = get();
170170
if (!candidate || rating === 0 || difficulty === 0) return;
171171

172+
const trimmedReview = textReview.trim();
173+
172174
try {
173175
await trpc.review.submitReview.mutate({
174176
professorId: candidate.professorId,
@@ -177,7 +179,7 @@ export const useReviewPromptStore = create(
177179
rating,
178180
difficulty,
179181
tags: selectedTags,
180-
content: textReview || undefined,
182+
content: trimmedReview || undefined,
181183
});
182184
set({ step: 'hidden', candidate: null, rating: 0, difficulty: 0, selectedTags: [], textReview: '' });
183185
openSnackbar('success', 'Review submitted — thanks for helping other Anteaters!');

0 commit comments

Comments
 (0)