Skip to content

Commit 617023f

Browse files
Syed Faisal Haqueclaude
authored andcommitted
fix: restore compareParamsSchema after rebase conflict resolution
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 655192e commit 617023f

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

lib/validations.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,26 @@ export const wrappedParamsSchema = z.object({
442442
height: dimensionParam('height', 80, 800),
443443
});
444444

445+
export const compareParamsSchema = z
446+
.object({
447+
user1: z
448+
.string({ error: 'Missing user1 parameter' })
449+
.trim()
450+
.min(1, { message: 'user1 is required' })
451+
.max(39, { message: 'GitHub username cannot exceed 39 characters' })
452+
.regex(GITHUB_USERNAME_REGEX, { message: 'Invalid GitHub username for user1' }),
453+
user2: z
454+
.string({ error: 'Missing user2 parameter' })
455+
.trim()
456+
.min(1, { message: 'user2 is required' })
457+
.max(39, { message: 'GitHub username cannot exceed 39 characters' })
458+
.regex(GITHUB_USERNAME_REGEX, { message: 'Invalid GitHub username for user2' }),
459+
})
460+
.refine((data) => data.user1.toLowerCase() !== data.user2.toLowerCase(), {
461+
message: 'Cannot compare a user with themselves.',
462+
path: ['user2'],
463+
});
464+
445465
export const notifyPostSchema = z.object({
446466
username: z
447467
.string({ error: 'Username is required.' })
@@ -490,5 +510,6 @@ export type GithubParams = z.infer<typeof githubParamsSchema>;
490510
export type OgParams = z.infer<typeof ogParamsSchema>;
491511
export type StatsParams = z.infer<typeof statsParamsSchema>;
492512
export type WrappedParams = z.infer<typeof wrappedParamsSchema>;
513+
export type CompareParams = z.infer<typeof compareParamsSchema>;
493514
export type NotifyPostParams = z.infer<typeof notifyPostSchema>;
494515
export type NotifyGetParams = z.infer<typeof notifyGetSchema>;

0 commit comments

Comments
 (0)