Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x | import { z } from 'zod';
export const inviteBabyParamsSchema = z.object({
babyId: z.string().uuid(),
});
export const inviteCodeParamsSchema = z.object({
code: z.string().min(1),
});
export const guardianParamsSchema = z.object({
babyId: z.string().uuid(),
userId: z.string().uuid(),
});
export const createInviteBodySchema = z.object({
inviteeEmail: z
.string()
.email()
.optional()
.describe('If provided, an invite email is sent to this address (best-effort — failure does not block the request)'),
});
export const createInviteResponseSchema = z
.object({
code: z.string(),
expiresAt: z.string().datetime(),
})
.describe('A shareable invite code that grants guardian access to the baby once redeemed');
export const invitePreviewResponseSchema = z
.object({
babyName: z.string(),
babyAvatarUrl: z.string().nullable(),
expired: z.boolean(),
alreadyUsed: z.boolean(),
})
.describe(
'Preview of an invite for display before redeeming it. Always 200, even when expired/used, so the ' +
'frontend can render a clear message instead of a generic error.',
);
export const redeemInviteResponseSchema = z
.object({
babyId: z.string().uuid(),
babyName: z.string(),
})
.describe('The baby the authenticated user just gained guardian access to');
export const guardianRoleSchema = z.enum(['OWNER', 'GUARDIAN']);
export const guardianListItemSchema = z.object({
userId: z.string().uuid(),
name: z.string(),
email: z.string().email(),
role: guardianRoleSchema,
joinedAt: z.string().datetime(),
});
export const guardianListResponseSchema = z.array(guardianListItemSchema);
export type CreateInviteBody = z.infer<typeof createInviteBodySchema>;
export type InviteBabyParams = z.infer<typeof inviteBabyParamsSchema>;
export type InviteCodeParams = z.infer<typeof inviteCodeParamsSchema>;
export type GuardianParams = z.infer<typeof guardianParamsSchema>;
|