feat: add usedInvite column to users table and update related configurations
This commit is contained in:
parent
7fa36c4b72
commit
6d41ff4520
9 changed files with 23 additions and 13 deletions
2
apps/db/migrations/45_userinvite.up.sql
Normal file
2
apps/db/migrations/45_userinvite.up.sql
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE IF EXISTS public.users
|
||||
ADD COLUMN IF NOT EXISTS "usedInvite" boolean NOT NULL DEFAULT false;
|
||||
|
|
@ -16,7 +16,7 @@ certificates
|
|||
knip.json
|
||||
check-env-vars.js
|
||||
headers
|
||||
.kanelrc.js
|
||||
kanel.config.js
|
||||
kyselyRules
|
||||
fic_cities.json
|
||||
fic_nations.json
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
"!.dockerignore",
|
||||
"!Dockerfile",
|
||||
"!*compose.yml",
|
||||
"!.kanelrc.js",
|
||||
"!kanel.config.js",
|
||||
"!TODO",
|
||||
"!src/i18n/comuni.ts",
|
||||
"!src/i18n/nazioni.ts",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "https://unpkg.com/knip@5/schema.json",
|
||||
"$schema": "https://unpkg.com/knip@6/schema.json",
|
||||
"ignore": [
|
||||
".kanelrc.js",
|
||||
"kanel.config.js",
|
||||
"TypeHelpers.type.ts",
|
||||
"src/utils/api.ts",
|
||||
"src/server/api/trpc.ts",
|
||||
|
|
@ -16,7 +16,9 @@
|
|||
"src/utils/get-media-url.ts",
|
||||
"src/utils/utils.ts"
|
||||
],
|
||||
"ignoreBinaries": ["stripe"],
|
||||
"ignoreBinaries": [
|
||||
"stripe"
|
||||
],
|
||||
"ignoreDependencies": [
|
||||
"pdfjs-dist",
|
||||
"kysely-plugin-serialize",
|
||||
|
|
@ -39,5 +41,10 @@
|
|||
"@radix-ui/react-toggle-group",
|
||||
"tailwindcss"
|
||||
],
|
||||
"project": ["src/**", "**", "!src/schemas/public/*.ts", "!emails/**"]
|
||||
}
|
||||
"project": [
|
||||
"src/**",
|
||||
"**",
|
||||
"!src/schemas/public/*.ts",
|
||||
"!emails/**"
|
||||
]
|
||||
}
|
||||
|
|
@ -291,8 +291,7 @@ const IntestazioneMaker = () => {
|
|||
!data.data_nascita ||
|
||||
!data.luogo_nascita ||
|
||||
!data.comune_residenza ||
|
||||
!data.via_residenza ||
|
||||
!data.civico_residenza;
|
||||
!data.via_residenza;
|
||||
|
||||
const copyToClipboard = () => {
|
||||
if (
|
||||
|
|
@ -302,8 +301,7 @@ const IntestazioneMaker = () => {
|
|||
!data.data_nascita ||
|
||||
!data.luogo_nascita ||
|
||||
!data.comune_residenza ||
|
||||
!data.via_residenza ||
|
||||
!data.civico_residenza
|
||||
!data.via_residenza
|
||||
) {
|
||||
toast.error("Dati mancanti");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ export default interface UsersTable {
|
|||
extra_telefono_titolo: ColumnType<string | null, string | null, string | null>;
|
||||
|
||||
extra_telefono_numero: ColumnType<string | null, string | null, string | null>;
|
||||
|
||||
usedInvite: ColumnType<boolean, boolean | undefined, boolean>;
|
||||
}
|
||||
|
||||
export type Users = Selectable<UsersTable>;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ export const inviteRouter = createTRPCRouter({
|
|||
.query(async ({ input }) => {
|
||||
if (input.email) {
|
||||
const existingUser = await findUser_byEmail({ email: input.email });
|
||||
if (existingUser) {
|
||||
if (existingUser?.usedInvite) {
|
||||
return { status: "already_user" };
|
||||
}
|
||||
}
|
||||
|
|
@ -152,6 +152,7 @@ export const inviteRouter = createTRPCRouter({
|
|||
data: {
|
||||
password: hashedPassword,
|
||||
salt,
|
||||
usedInvite: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
"dist",
|
||||
"headers",
|
||||
"kyselyRules",
|
||||
".kanelrc.js"
|
||||
"kanel.config.js"
|
||||
],
|
||||
"include": [
|
||||
"src",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue