Auth: document an import for the generated Better Auth tables (`userTable`, …)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 62/100
- Tipo de issue
- Documentación
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- sqlite, typescript
- Área
- backend, database, documentation
Línea de trabajo
Documenta .void/better-auth-schema.ts y sus exports (userTable, sessionTable, accountTable, verificationTable) en la guía de autenticación, con un ejemplo de clave foránea a userTable.id. Empieza en la documentación de autenticación existente, donde se describen los tipos AuthUser y AuthSession de void/auth, y añade una sección para las tablas. Se considera terminado cuando la guía muestra la ruta de importación, nombra los exports estables e incluye el ejemplo. La propuesta de importación pública queda como decisión de los maintainers.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 627
- Forks
- 66
- Merge medio
- 14 h 56 min
- PR fusionados (30 d)
- 170
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de voidzero-dev/void
-
Dificultad 3/5 1-2 días Aptitud para principiantes 52/100
voidzero-dev/void#680 ·
Los mantenedores suelen responder en 1 día
-
`withValidator({ body })` rejects the multipart bodies that `useForm` and `action()` send for filesAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
voidzero-dev/void#679 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
voidzero-dev/void#676 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 18/100
voidzero-dev/void#667 ·
Los mantenedores suelen responder en 1 día
-
platform: interrupted install ignores a replacement runtime token and never updates deployed WorkersAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
voidzero-dev/void#666 ·
Los mantenedores suelen responder en 1 día
Todos los issues de voidzero-dev/void
Issues similares
-
Remove unused dependenciesPosiblemente ocupada @alastair-smith la tomó hoy. Abiertochore other
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
alastair-smith/card-games#384 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
code-yeongyu/senpi#5571 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nexu-io/open-design#9262 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
friction
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
kentcdodds/kody#4753 ·
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
lingdojo/kana-dojo#33508 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día