mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-22 17:02:01 +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
|
island_id: z
|
||||||
.string({ required_error: "Island is required." })
|
.string({ required_error: "Island is required." })
|
||||||
.min(2, { message: "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." }),
|
dob: z.coerce.date({ message: "Date of birth is required." }),
|
||||||
phone_number: z
|
phone_number: z
|
||||||
.string()
|
.string()
|
||||||
.min(7, { message: "Phone number is required." })
|
.min(7, { message: "Phone number is required." })
|
||||||
.regex(/^[79][0-9]{2}[0-9]{4}$/, "Please enter a valid phone number")
|
.regex(/^[79][0-9]{2}[0-9]{4}$/, "Please enter a valid phone number")
|
||||||
.transform((val) => val.replace(/\D/g, "")),
|
.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",
|
"@hookform/resolvers": "^3.9.1",
|
||||||
"@prisma/client": "^5.22.0",
|
"@prisma/client": "^5.22.0",
|
||||||
"@radix-ui/react-alert-dialog": "^1.1.2",
|
"@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-collapsible": "^1.1.1",
|
||||||
"@radix-ui/react-dialog": "^1.1.2",
|
"@radix-ui/react-dialog": "^1.1.2",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.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": {
|
"node_modules/@radix-ui/react-collapsible": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-collapsible/-/react-collapsible-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@radix-ui/react-collapsible/-/react-collapsible-1.1.1.tgz",
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"@hookform/resolvers": "^3.9.1",
|
"@hookform/resolvers": "^3.9.1",
|
||||||
"@prisma/client": "^5.22.0",
|
"@prisma/client": "^5.22.0",
|
||||||
"@radix-ui/react-alert-dialog": "^1.1.2",
|
"@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-collapsible": "^1.1.1",
|
||||||
"@radix-ui/react-dialog": "^1.1.2",
|
"@radix-ui/react-dialog": "^1.1.2",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
||||||
|
@ -21,7 +21,7 @@ model User {
|
|||||||
firstPaymentDone Boolean @default(false)
|
firstPaymentDone Boolean @default(false)
|
||||||
verified Boolean @default(false)
|
verified Boolean @default(false)
|
||||||
// island String?
|
// island String?
|
||||||
house_name String?
|
address String?
|
||||||
id_card String? @unique
|
id_card String? @unique
|
||||||
dob DateTime?
|
dob DateTime?
|
||||||
atoll Atoll? @relation(fields: [atollId], references: [id])
|
atoll Atoll? @relation(fields: [atollId], references: [id])
|
||||||
@ -32,6 +32,10 @@ model User {
|
|||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
phoneNumber String @unique
|
phoneNumber String @unique
|
||||||
phoneNumberVerified Boolean @default(false)
|
phoneNumberVerified Boolean @default(false)
|
||||||
|
termsAccepted Boolean @default(false)
|
||||||
|
policyAccepted Boolean @default(false)
|
||||||
|
|
||||||
|
devices Device[]
|
||||||
|
|
||||||
role String?
|
role String?
|
||||||
lang String?
|
lang String?
|
||||||
@ -102,3 +106,14 @@ model Island {
|
|||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
User User[]
|
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,
|
emailVerified: false,
|
||||||
firstPaymentDone: false,
|
firstPaymentDone: false,
|
||||||
verified: false,
|
verified: false,
|
||||||
house_name: faker.location.streetAddress(),
|
address: faker.location.streetAddress(),
|
||||||
id_card: `A${Math.round(Math.random() * 999999)}`,
|
id_card: `A${Math.round(Math.random() * 999999)}`,
|
||||||
dob: faker.date.between({
|
dob: faker.date.between({
|
||||||
from: "1900-01-01",
|
from: "1900-01-01",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user