Auth: document an import for the generated Better Auth tables (`userTable`, …)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 62/100
- Issue-Typ
- Dokumentation
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- sqlite, typescript
- Bereich
- backend, database, documentation
Rechercherichtung
Dokumentiere .void/better-auth-schema.ts und seine Exporte (userTable, sessionTable, accountTable, verificationTable) im Auth-Leitfaden, mit einem Fremdschlüssel-Beispiel auf userTable.id. Beginne in der bestehenden Auth-Dokumentation, in der die Typen AuthUser und AuthSession aus void/auth beschrieben sind, und füge einen Abschnitt für die Tabellen hinzu. Fertig ist es, wenn der Leitfaden den Import-Pfad zeigt, die stabilen Exporte benennt und das Beispiel enthält. Der Vorschlag zum öffentlichen Import bleibt eine Entscheidung der Maintainer.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
Void generates the Better Auth tables into .void/better-auth-schema.ts (userTable, sessionTable, accountTable, verificationTable), but the docs never say how to import them. The auth guide documents the AuthUser and AuthSession types from void/auth, but not the tables.
An app that queries its users, or has a table that belongs to a user, needs those tables. Today the only way to get them is to point at the generated file yourself, and a release that renames the file or its exports breaks that app without warning.
Example
An admin page that lists users:
// tsconfig.json: our own alias, next to the `@schema` one Void configures
"paths": {
"@auth-schema": ["./.void/better-auth-schema.ts"]
}
// src/server/data/users.ts
import { userTable } from '@auth-schema';
import { db, desc } from 'void/db';
export function listUsers() {
return db.select().from(userTable).orderBy(desc(userTable.createdAt));
}
A table whose rows belong to a user needs the same import for its foreign key:
// db/schema.ts
import { userTable } from '@auth-schema';
import { sqliteTable, text } from 'void/schema-d1';
export const postTable = sqliteTable('post', {
id: text('id').primaryKey(),
userId: text('user_id')
.notNull()
.references(() => userTable.id, { onDelete: 'cascade' }),
});
Why it matters
- Users are app data too. Admin lists, "posts by this user" joins and foreign keys from app tables all need the table, not just the
AuthUsertype. - The generated file looks internal. It sits in
.void/with "Auto-generated by void — do not edit" at the top, so nothing tells an app it's safe to import. Its path and export names aren't documented, so an app can't tell what a release may change. - The tables already include the app's own columns. The generated
userTablehas the columns from Better Auth plugins anduser.additionalFields(such asroleandbannedfromadmin()), so it's the right table to query. Copying it by hand would drift.
Proposal
In order of preference:
- A public import, for example
import { userTable } from 'void/auth/schema', typed for the app's dialect and plugins. - An auto-configured alias, like the existing
@schemafordb/schema.ts. - At minimum, document
.void/better-auth-schema.tsand its export names as stable, with an example of a foreign key touserTable.idin the database or auth guide.
Environment
void1.5.0- D1 with Better Auth's
admin()plugin
- Vorherrschende Sprache
- TypeScript
- Sterne
- 627
- Forks
- 66
- Ø Merge
- 14 Std. 56 Min.
- Gemergte PRs (30 T.)
- 170
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/void
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 52/100
voidzero-dev/void#680 ·
Maintainer antworten meist innerhalb von 1 Tag
-
`withValidator({ body })` rejects the multipart bodies that `useForm` and `action()` send for filesOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
voidzero-dev/void#679 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
voidzero-dev/void#676 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 18/100
voidzero-dev/void#667 ·
Maintainer antworten meist innerhalb von 1 Tag
-
platform: interrupted install ignores a replacement runtime token and never updates deployed WorkersOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
voidzero-dev/void#666 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/void
Ähnliche Issues
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
microsoft/playwright#43875 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
feature
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
calagopus/panel#285 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
adobe/react-spectrum#10909 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Run the dependency drift checkEvtl. vergeben @spaceninja hat das heute übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
cloudfour/lighthouse-parade#449 ·
Maintainer antworten meist innerhalb von 1 Tag