admin: Superforms + Zod validation, three-address-defaults schema, profiles toast fix

- Add Superforms + Zod 4 for all admin form validation
- Replace address isDefault with three separate boolean defaults (Mailing, Billing, Shipping)
- Update profiles page with three-checkbox address form and toast improvements
- Convert all admin page server actions to pass request directly to crud
- Export superFormErrorsToFieldErrors helper for profiles server actions
- Regenerate Prisma client for new schema fields
This commit is contained in:
NeilClack
2026-07-07 13:36:23 -05:00
parent 38347f5f24
commit 38d1752f5b
98 changed files with 3408 additions and 1758 deletions
+1 -4
View File
@@ -1,10 +1,7 @@
import { BETTER_AUTH_URL } from '$env/static/private';
import { sendMail } from './resend';
export async function sendVerificationEmail(options: {
email: string;
token: string;
}) {
export async function sendVerificationEmail(options: { email: string; token: string }) {
const verificationUrl = `${BETTER_AUTH_URL}/api/auth/verify-email?token=${options.token}&callbackURL=/login?verified=true`;
await sendMail({
+21 -21
View File
@@ -2,11 +2,11 @@
* AUTHOR: Neil Clack
* EMAIL: nclack@radiantwavetech.com
* DATE: 07/06/2027
*
*
* A server side library and client for Resend
* Includes the Resend client, as well as functions
* for different email scenarios.
*
*
*/
import { Resend } from 'resend';
import { RESEND_API_KEY, EMAIL_FROM, RESEND_TEMPLATE_ID } from '$env/static/private';
@@ -31,26 +31,26 @@ export const resend = new Resend(RESEND_API_KEY);
* @throws {Error} If the Resend API call fails.
*/
export async function sendMail(options: {
to: string;
subject?: string;
templateId?: string;
data?: Record<string, string | number>;
to: string;
subject?: string;
templateId?: string;
data?: Record<string, string | number>;
}) {
const { to, subject, templateId, data } = options;
const { to, subject, templateId, data } = options;
const result = await resend.emails.send({
from: EMAIL_FROM,
to: [to],
subject: subject ?? 'Template Email',
template: {
id: templateId ?? RESEND_TEMPLATE_ID,
variables: data ?? {}
}
});
const result = await resend.emails.send({
from: EMAIL_FROM,
to: [to],
subject: subject ?? 'Template Email',
template: {
id: templateId ?? RESEND_TEMPLATE_ID,
variables: data ?? {}
}
});
if (result.error) {
throw new Error(result.error.message);
}
if (result.error) {
throw new Error(result.error.message);
}
return result.data;
}
return result.data;
}