mirror of
https://github.com/tale/headplane.git
synced 2026-07-27 16:18:57 +00:00
d2c4f5eb2b
* Cookies are now encrypted JWTs (GHSA-wrqq-v7qw-r5w7) * Authentication is stored in the SQLite database (auto-migrated) * Session logic is much cleaner
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
|
import { HostInfo } from '~/types';
|
|
|
|
export const ephemeralNodes = sqliteTable('ephemeral_nodes', {
|
|
auth_key: text('auth_key').primaryKey(),
|
|
node_key: text('node_key'),
|
|
});
|
|
|
|
export type EphemeralNode = typeof ephemeralNodes.$inferSelect;
|
|
export type EphemeralNodeInsert = typeof ephemeralNodes.$inferInsert;
|
|
|
|
export const hostInfo = sqliteTable('host_info', {
|
|
host_id: text('host_id').primaryKey(),
|
|
payload: text('payload', { mode: 'json' }).$type<HostInfo>(),
|
|
updated_at: integer('updated_at', { mode: 'timestamp' }).$default(
|
|
() => new Date(),
|
|
),
|
|
});
|
|
|
|
export type HostInfoRecord = typeof hostInfo.$inferSelect;
|
|
export type HostInfoInsert = typeof hostInfo.$inferInsert;
|
|
|
|
export const users = sqliteTable('users', {
|
|
id: text('id').primaryKey(),
|
|
sub: text('sub').notNull().unique(),
|
|
caps: integer('caps').notNull().default(0),
|
|
onboarded: integer('onboarded', { mode: 'boolean' }).notNull().default(false),
|
|
});
|
|
|
|
export type User = typeof users.$inferSelect;
|
|
export type UserInsert = typeof users.$inferInsert;
|