Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/schemas/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export const userIdSchema = unsafeUuidSchema.brand('UserId').or(unsafeUuidSchema
export const uuidSchema = unsafeUuidSchema.brand('Uuid');
export const unixTimestampSchema = z.number().brand('UnixTimestamp');
export const emailSchema = z.string().email().brand('Email');
export const idpIdSchema = z.string().brand('IdpId');
export const dateTimeSchema = z.string().datetime().brand('DateTime');
export const timeZoneSchema = z.string().brand('TimeZone');
export const idpIdSchema = z.string().max(128).brand('IdpId');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is something I've been thinking (max). should we cap it for the form/onboarding stuff too?

BusinessName, BusinessAddress, etc etc

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(discussed on call)yes, let's limit fields ion frontend too.

export const dateTimeSchema = z.string().max(128).datetime().brand('DateTime');
export const timeZoneSchema = z.string().max(128).brand('TimeZone');
15 changes: 14 additions & 1 deletion src/types/reminder.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dateTimeSchema, languageCodeSchema } from '@schemas';
import { calendarSchema } from '@schemas/calendar';
import { senderSchema } from '@schemas/contact';
import type { demoReminderPayloadSchema } from '@schemas/reminder';
Expand Down Expand Up @@ -96,7 +97,19 @@ export const reminderConfigSchema = z.object({
business: z.object({
name: z.string().min(1).brand('BusinessName'),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that .brand('BusinessName') and .transform(value => value as BusinessName) behave the same (because the TS type is a Brand)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it separetely once all PRs are merged - as discusssed over meet

address: z.string().min(1).brand('BusinessAddress'),
senderContact: senderSchema
senderContact: senderSchema,
language: languageCodeSchema,
companyIndustry: z.object({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This schema isn't for the API endpoint, right? I am a bit confused xD

category: z.string().max(256),
subcategory: z.string().max(256),
customIndustry: z.string().max(256).optional()
}),
companySize: z.string().max(128)
}),
confirmation: z.object({
termsAccepted: dateTimeSchema,
privacyAccepted: dateTimeSchema,
marketingOptInAccepted: dateTimeSchema.optional()
})
});

Expand Down