Refactored both Stripe and Team Accounts features' schemas for better data validation and added specificity to keys. Enhanced form validations with methods to ensure Stripe keys follow appropriate prefixes. Replaced generic string types with UUID for accountId attributes in different services. Also turned off autocomplete for destructive actions for improved security.
21 lines
378 B
TypeScript
21 lines
378 B
TypeScript
import { z } from 'zod';
|
|
|
|
export const MailerSchema = z
|
|
.object({
|
|
to: z.string().email(),
|
|
// this is not necessarily formatted
|
|
// as an email so we type it loosely
|
|
from: z.string().min(1),
|
|
subject: z.string(),
|
|
})
|
|
.and(
|
|
z.union([
|
|
z.object({
|
|
text: z.string(),
|
|
}),
|
|
z.object({
|
|
html: z.string(),
|
|
}),
|
|
]),
|
|
);
|