haus23/tipprunde-legacy
model: Refactor updatedAt Schema to not be optional by default
Open
#37 opened on May 25, 2025
enhancementgood first issue
Repository metrics
- Stars
- (0 stars)
- PR merge metrics
- (PR metrics pending)
Description
Let the client decide whether the prop is optional or not.
Current code:
const UpdatedAtSchema = v.optional( v.pipe( v.object({ _seconds: v.number(), _nanoseconds: v.number(), }), v.transform((input) => new Date(input._seconds * 1000)), ), );
and usage in e.g. Account
const AccountSchema = v.object({ id: IdSchema, name: v.pipe(v.string(), v.nonEmpty()), email: v.optional( v.union([v.literal(''), v.pipe(v.string(), v.email())]), '', ), role: v.optional(v.string(), ''), updated_at: UpdatedAtSchema, });