Refactor user actions and authentication components

- Updated user verification logic to include atoll and island relationships.
- Introduced CreateClient function for integrating with external client API.
- Replaced 'house_name' with 'address' in user signup data handling.
- Added new Checkbox component for improved UI interactions.
- Migrated database provider from SQLite to PostgreSQL and redefined user schema.
- Removed obsolete migration files and ensured database integrity with new structure.
This commit is contained in:
2024-11-30 23:38:20 +05:00
parent 4e78ff2de9
commit 490150f9b7
16 changed files with 270 additions and 195 deletions

View File

@ -3,10 +3,10 @@
import { authClient } from "@/lib/auth-client";
import prisma from "@/lib/db";
import { signUpFormSchema } from "@/lib/schemas";
import { headers } from "next/headers";
// import type { User } from "@prisma/client";
import { redirect } from "next/navigation";
import { z } from "zod";
import { headers } from "next/headers";
const formSchema = z.object({
phoneNumber: z
.string()
@ -112,7 +112,7 @@ export async function signup(_actionState: ActionState, formData: FormData) {
name: parsedData.data.name,
islandId: parsedData.data.island_id,
atollId: parsedData.data.atoll_id,
house_name: parsedData.data.house_name,
address: parsedData.data.address,
id_card: parsedData.data.id_card,
dob: new Date(parsedData.data.dob),
role: "USER",