mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-21 18:22:00 +00:00
Update user schema and forms to include address and consent fields
- Replaced 'house_name' with 'address' in user schema and related files. - Added new fields for terms and privacy policy acceptance in the signup form schema. - Updated package.json and package-lock.json to include @radix-ui/react-checkbox for checkbox functionality. - Modified seed script to reflect changes in the user model.
This commit is contained in:
parent
0322bee567
commit
4e78ff2de9
@ -9,11 +9,21 @@ export const signUpFormSchema = z.object({
|
||||
island_id: z
|
||||
.string({ required_error: "Island is required." })
|
||||
.min(2, { message: "Island is required." }),
|
||||
house_name: z.string().min(2, { message: "House name is required." }),
|
||||
address: z.string().min(2, { message: "address is required." }),
|
||||
dob: z.coerce.date({ message: "Date of birth is required." }),
|
||||
phone_number: z
|
||||
.string()
|
||||
.min(7, { message: "Phone number is required." })
|
||||
.regex(/^[79][0-9]{2}[0-9]{4}$/, "Please enter a valid phone number")
|
||||
.transform((val) => val.replace(/\D/g, "")),
|
||||
terms: z
|
||||
.string({
|
||||
required_error: "You must accept the terms and conditions",
|
||||
})
|
||||
.transform((val) => val === "on"),
|
||||
policy: z
|
||||
.string({
|
||||
required_error: "You must accept the privacy policy",
|
||||
})
|
||||
.transform((val) => val === "on"),
|
||||
});
|
||||
|
30
package-lock.json
generated
30
package-lock.json
generated
@ -12,6 +12,7 @@
|
||||
"@hookform/resolvers": "^3.9.1",
|
||||
"@prisma/client": "^5.22.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.2",
|
||||
"@radix-ui/react-checkbox": "^1.1.2",
|
||||
"@radix-ui/react-collapsible": "^1.1.1",
|
||||
"@radix-ui/react-dialog": "^1.1.2",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
||||
@ -1591,6 +1592,35 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-checkbox": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.1.2.tgz",
|
||||
"integrity": "sha512-/i0fl686zaJbDQLNKrkCbMyDm6FQMt4jg323k7HuqitoANm9sE23Ql8yOK3Wusk34HSLKDChhMux05FnP6KUkw==",
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.0",
|
||||
"@radix-ui/react-compose-refs": "1.1.0",
|
||||
"@radix-ui/react-context": "1.1.1",
|
||||
"@radix-ui/react-presence": "1.1.1",
|
||||
"@radix-ui/react-primitive": "2.0.0",
|
||||
"@radix-ui/react-use-controllable-state": "1.1.0",
|
||||
"@radix-ui/react-use-previous": "1.1.0",
|
||||
"@radix-ui/react-use-size": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-collapsible": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-collapsible/-/react-collapsible-1.1.1.tgz",
|
||||
|
@ -16,6 +16,7 @@
|
||||
"@hookform/resolvers": "^3.9.1",
|
||||
"@prisma/client": "^5.22.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.2",
|
||||
"@radix-ui/react-checkbox": "^1.1.2",
|
||||
"@radix-ui/react-collapsible": "^1.1.1",
|
||||
"@radix-ui/react-dialog": "^1.1.2",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
||||
|
@ -21,7 +21,7 @@ model User {
|
||||
firstPaymentDone Boolean @default(false)
|
||||
verified Boolean @default(false)
|
||||
// island String?
|
||||
house_name String?
|
||||
address String?
|
||||
id_card String? @unique
|
||||
dob DateTime?
|
||||
atoll Atoll? @relation(fields: [atollId], references: [id])
|
||||
@ -32,6 +32,10 @@ model User {
|
||||
updatedAt DateTime @updatedAt
|
||||
phoneNumber String @unique
|
||||
phoneNumberVerified Boolean @default(false)
|
||||
termsAccepted Boolean @default(false)
|
||||
policyAccepted Boolean @default(false)
|
||||
|
||||
devices Device[]
|
||||
|
||||
role String?
|
||||
lang String?
|
||||
@ -102,3 +106,14 @@ model Island {
|
||||
updatedAt DateTime @updatedAt
|
||||
User User[]
|
||||
}
|
||||
|
||||
model Device {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
mac String
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
User User? @relation(fields: [userId], references: [id])
|
||||
userId String?
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ async function main() {
|
||||
emailVerified: false,
|
||||
firstPaymentDone: false,
|
||||
verified: false,
|
||||
house_name: faker.location.streetAddress(),
|
||||
address: faker.location.streetAddress(),
|
||||
id_card: `A${Math.round(Math.random() * 999999)}`,
|
||||
dob: faker.date.between({
|
||||
from: "1900-01-01",
|
||||
|
Loading…
x
Reference in New Issue
Block a user