added backend-mgmt for dataset/dataset_entry and utterances, this includes upload and also displaying of the dataset on the admin pages

This commit is contained in:
averel10
2026-03-05 11:31:06 +01:00
parent 28c45bc133
commit c08dc46305
33 changed files with 5609 additions and 37 deletions

23
src/lib/model/dataset.ts Normal file
View File

@@ -0,0 +1,23 @@
import { sqliteTable, text, integer, real } from 'drizzle-orm/sqlite-core';
import { relations } from 'drizzle-orm';
import { dataset_entry } from './dataset_entry';
// Define the dataset table schema
export const dataset = sqliteTable('dataset', {
id: integer('id').primaryKey({ autoIncrement: true }),
name: text('name').notNull(),
createdAt: integer('created_at', { mode: 'timestamp' })
.notNull()
.default(new Date()),
updatedAt: integer('updated_at', { mode: 'timestamp' })
.notNull()
.default(new Date())
});
export const datasetRelations = relations(dataset, ({ many }) => ({
entries: many(dataset_entry)
}));
// Create a type for dataset records based on the schema
export type Dataset = typeof dataset.$inferSelect;
export type NewDataset = typeof dataset.$inferInsert;