Files
BA_TTS_Annotation_Plattform/src/lib/model/annotation.ts

30 lines
1012 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { sqliteTable, text, integer, uniqueIndex } from 'drizzle-orm/sqlite-core';
import { relations, sql } from 'drizzle-orm';
import { dataset_entry } from './dataset_entry';
export const annotation = sqliteTable(
'annotation',
{
id: integer('id').primaryKey({ autoIncrement: true }),
datasetEntryId: integer('dataset_entry_id')
.notNull()
.references(() => dataset_entry.id),
userId: text('user_id').notNull(),
rating: integer('rating').notNull(), // 15
dialectLabel: text('dialect_label').notNull(), // e.g. 'ch_be', 'ch_zh', …
createdAt: integer('created_at', { mode: 'timestamp' })
.notNull()
.default(sql`(unixepoch())`),
}
);
export const annotationRelations = relations(annotation, ({ one }) => ({
datasetEntry: one(dataset_entry, {
fields: [annotation.datasetEntryId],
references: [dataset_entry.id],
}),
}));
export type Annotation = typeof annotation.$inferSelect;
export type NewAnnotation = typeof annotation.$inferInsert;