feat: instance invites

This commit is contained in:
Zoe
2026-10-08 13:50:44 -05:00
parent f6e1bc1f47
commit fae05ebc4c
17 changed files with 3962 additions and 26 deletions
+17
View File
@@ -357,3 +357,20 @@ export const verifications = pgTable(
},
(table) => [index("verifications_identifier_idx").on(table.identifier)],
);
// Links admins hand out so someone can register while the instance is invite
// only. The token is the secret part of the link.
export const invites = pgTable(
"invites",
{
id: text("id").primaryKey().$defaultFn(nanoid),
token: text("token").notNull().unique(),
createdBy: text("created_by")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
maxUses: integer("max_uses").notNull().default(1),
uses: integer("uses").notNull().default(0),
expiresAt: timestamptz("expires_at").notNull(),
createdAt: timestamptz("created_at").defaultNow().notNull(),
},
);