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
|
knip.json
|
||||||
check-env-vars.js
|
check-env-vars.js
|
||||||
headers
|
headers
|
||||||
.kanelrc.js
|
kanel.config.js
|
||||||
kyselyRules
|
kyselyRules
|
||||||
fic_cities.json
|
fic_cities.json
|
||||||
fic_nations.json
|
fic_nations.json
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
"!.dockerignore",
|
"!.dockerignore",
|
||||||
"!Dockerfile",
|
"!Dockerfile",
|
||||||
"!*compose.yml",
|
"!*compose.yml",
|
||||||
"!.kanelrc.js",
|
"!kanel.config.js",
|
||||||
"!TODO",
|
"!TODO",
|
||||||
"!src/i18n/comuni.ts",
|
"!src/i18n/comuni.ts",
|
||||||
"!src/i18n/nazioni.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": [
|
"ignore": [
|
||||||
".kanelrc.js",
|
"kanel.config.js",
|
||||||
"TypeHelpers.type.ts",
|
"TypeHelpers.type.ts",
|
||||||
"src/utils/api.ts",
|
"src/utils/api.ts",
|
||||||
"src/server/api/trpc.ts",
|
"src/server/api/trpc.ts",
|
||||||
|
|
@ -16,7 +16,9 @@
|
||||||
"src/utils/get-media-url.ts",
|
"src/utils/get-media-url.ts",
|
||||||
"src/utils/utils.ts"
|
"src/utils/utils.ts"
|
||||||
],
|
],
|
||||||
"ignoreBinaries": ["stripe"],
|
"ignoreBinaries": [
|
||||||
|
"stripe"
|
||||||
|
],
|
||||||
"ignoreDependencies": [
|
"ignoreDependencies": [
|
||||||
"pdfjs-dist",
|
"pdfjs-dist",
|
||||||
"kysely-plugin-serialize",
|
"kysely-plugin-serialize",
|
||||||
|
|
@ -39,5 +41,10 @@
|
||||||
"@radix-ui/react-toggle-group",
|
"@radix-ui/react-toggle-group",
|
||||||
"tailwindcss"
|
"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.data_nascita ||
|
||||||
!data.luogo_nascita ||
|
!data.luogo_nascita ||
|
||||||
!data.comune_residenza ||
|
!data.comune_residenza ||
|
||||||
!data.via_residenza ||
|
!data.via_residenza;
|
||||||
!data.civico_residenza;
|
|
||||||
|
|
||||||
const copyToClipboard = () => {
|
const copyToClipboard = () => {
|
||||||
if (
|
if (
|
||||||
|
|
@ -302,8 +301,7 @@ const IntestazioneMaker = () => {
|
||||||
!data.data_nascita ||
|
!data.data_nascita ||
|
||||||
!data.luogo_nascita ||
|
!data.luogo_nascita ||
|
||||||
!data.comune_residenza ||
|
!data.comune_residenza ||
|
||||||
!data.via_residenza ||
|
!data.via_residenza
|
||||||
!data.civico_residenza
|
|
||||||
) {
|
) {
|
||||||
toast.error("Dati mancanti");
|
toast.error("Dati mancanti");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ export default interface UsersTable {
|
||||||
extra_telefono_titolo: ColumnType<string | null, string | null, string | null>;
|
extra_telefono_titolo: ColumnType<string | null, string | null, string | null>;
|
||||||
|
|
||||||
extra_telefono_numero: 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>;
|
export type Users = Selectable<UsersTable>;
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ export const inviteRouter = createTRPCRouter({
|
||||||
.query(async ({ input }) => {
|
.query(async ({ input }) => {
|
||||||
if (input.email) {
|
if (input.email) {
|
||||||
const existingUser = await findUser_byEmail({ email: input.email });
|
const existingUser = await findUser_byEmail({ email: input.email });
|
||||||
if (existingUser) {
|
if (existingUser?.usedInvite) {
|
||||||
return { status: "already_user" };
|
return { status: "already_user" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -152,6 +152,7 @@ export const inviteRouter = createTRPCRouter({
|
||||||
data: {
|
data: {
|
||||||
password: hashedPassword,
|
password: hashedPassword,
|
||||||
salt,
|
salt,
|
||||||
|
usedInvite: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
"dist",
|
"dist",
|
||||||
"headers",
|
"headers",
|
||||||
"kyselyRules",
|
"kyselyRules",
|
||||||
".kanelrc.js"
|
"kanel.config.js"
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
"src",
|
"src",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue