refactor: switch from go to bun

This commit is contained in:
Nicolas Meienberger
2025-08-31 17:32:00 +02:00
parent a0be690eb9
commit a16fc37b44
76 changed files with 4283 additions and 4173 deletions

View File

@@ -0,0 +1,35 @@
import { type } from "arktype";
import { sql } from "drizzle-orm";
import { int, sqliteTable, text } from "drizzle-orm/sqlite-core";
const nfsConfigSchema = type({
backend: "'nfs'",
server: "string",
exportPath: "string",
port: "number",
version: type.enumerated(["3", "4"]),
});
const smbConfigSchema = type({
backend: "'smb'",
});
const directoryConfigSchema = type({
backend: "'directory'",
});
const configSchema = nfsConfigSchema
.or(smbConfigSchema)
.or(directoryConfigSchema);
export const volumesTable = sqliteTable("volumes_table", {
id: int().primaryKey({ autoIncrement: true }),
name: text().notNull().unique(),
path: text().notNull(),
type: text().notNull(),
createdAt: int("created_at").notNull().default(sql`(current_timestamp)`),
updatedAt: int("updated_at").notNull().default(sql`(current_timestamp)`),
config: text("config", { mode: "json" })
.$type<typeof configSchema.inferOut>()
.notNull(),
});