onboarding completed

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-16 11:41:15 +02:00
committed by Carl-Gerhard Lindesvärd
parent 97627583ec
commit 7d22d2ddad
79 changed files with 2542 additions and 805 deletions

View File

@@ -97,3 +97,36 @@ export const zCreateReference = z.object({
projectId: z.string(),
datetime: z.string(),
});
export const zOnboardingProject = z
.object({
organization: z.string().min(3),
project: z.string().min(3),
domain: z.string().url().or(z.literal('').or(z.null())),
website: z.boolean(),
app: z.boolean(),
backend: z.boolean(),
})
.superRefine((data, ctx) => {
if (data.website && !data.domain) {
ctx.addIssue({
code: 'custom',
message: 'Domain is required for website tracking',
path: ['domain'],
});
}
if (
data.website === false &&
data.app === false &&
data.backend === false
) {
['app', 'backend', 'website'].forEach((key) => {
ctx.addIssue({
code: 'custom',
message: 'At least one type must be selected',
path: [key],
});
});
}
});