diff --git a/apps/db/migrations/45_userinvite.up.sql b/apps/db/migrations/45_userinvite.up.sql new file mode 100644 index 0000000..7b432c6 --- /dev/null +++ b/apps/db/migrations/45_userinvite.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE IF EXISTS public.users + ADD COLUMN IF NOT EXISTS "usedInvite" boolean NOT NULL DEFAULT false; \ No newline at end of file diff --git a/apps/infoalloggi/.dockerignore b/apps/infoalloggi/.dockerignore index 2c203ff..7086742 100644 --- a/apps/infoalloggi/.dockerignore +++ b/apps/infoalloggi/.dockerignore @@ -16,7 +16,7 @@ certificates knip.json check-env-vars.js headers -.kanelrc.js +kanel.config.js kyselyRules fic_cities.json fic_nations.json diff --git a/apps/infoalloggi/biome.json b/apps/infoalloggi/biome.json index 872a674..942a99c 100644 --- a/apps/infoalloggi/biome.json +++ b/apps/infoalloggi/biome.json @@ -32,7 +32,7 @@ "!.dockerignore", "!Dockerfile", "!*compose.yml", - "!.kanelrc.js", + "!kanel.config.js", "!TODO", "!src/i18n/comuni.ts", "!src/i18n/nazioni.ts", diff --git a/apps/infoalloggi/.kanelrc.js b/apps/infoalloggi/kanel.config.js similarity index 100% rename from apps/infoalloggi/.kanelrc.js rename to apps/infoalloggi/kanel.config.js diff --git a/apps/infoalloggi/knip.json b/apps/infoalloggi/knip.json index 1befc3a..640176c 100644 --- a/apps/infoalloggi/knip.json +++ b/apps/infoalloggi/knip.json @@ -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/**" + ] +} \ No newline at end of file diff --git a/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx b/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx index 74f8c36..1d31525 100644 --- a/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx +++ b/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx @@ -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; diff --git a/apps/infoalloggi/src/schemas/public/Users.ts b/apps/infoalloggi/src/schemas/public/Users.ts index 5be1f23..899116f 100644 --- a/apps/infoalloggi/src/schemas/public/Users.ts +++ b/apps/infoalloggi/src/schemas/public/Users.ts @@ -45,6 +45,8 @@ export default interface UsersTable { extra_telefono_titolo: ColumnType; extra_telefono_numero: ColumnType; + + usedInvite: ColumnType; } export type Users = Selectable; diff --git a/apps/infoalloggi/src/server/api/routers/invite.ts b/apps/infoalloggi/src/server/api/routers/invite.ts index f30831a..784d718 100644 --- a/apps/infoalloggi/src/server/api/routers/invite.ts +++ b/apps/infoalloggi/src/server/api/routers/invite.ts @@ -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, }, }); diff --git a/apps/infoalloggi/tsconfig.json b/apps/infoalloggi/tsconfig.json index 1bd0da6..6f10c02 100644 --- a/apps/infoalloggi/tsconfig.json +++ b/apps/infoalloggi/tsconfig.json @@ -38,7 +38,7 @@ "dist", "headers", "kyselyRules", - ".kanelrc.js" + "kanel.config.js" ], "include": [ "src",