First Commit

This commit is contained in:
2026-09-12 13:56:36 +01:00
commit 4d75af0418
426 changed files with 36452 additions and 0 deletions
BIN
View File
Binary file not shown.
+169
View File
@@ -0,0 +1,169 @@
import { MediaParadigms, MediaTypes } from "@/src/dict/media-dict";
import { UserTypes } from "@/src/dict/user-types-dict";
import type { BUN_SQLITE_DatabaseSchemaType } from "@moduletrace/bun-sqlite/dist/types";
const schema: BUN_SQLITE_DatabaseSchemaType = {
tables: [
{
tableName: "users",
fields: [
{
fieldName: "first_name",
dataType: "TEXT",
},
{
fieldName: "last_name",
dataType: "TEXT",
},
{
fieldName: "email",
dataType: "TEXT",
unique: true,
},
{
fieldName: "username",
dataType: "TEXT",
unique: true,
},
{
fieldName: "password",
dataType: "TEXT",
},
{
fieldName: "bio",
dataType: "TEXT",
html: true,
},
{
fieldName: "archived",
dataType: "INTEGER",
options: [0, 1],
defaultValue: 0,
},
],
},
{
tableName: "user_types",
fields: [
{
fieldName: "user_id",
dataType: "INTEGER",
},
{
fieldName: "user_type",
dataType: "TEXT",
options: UserTypes.map((ut) => ut.value),
},
],
},
{
tableName: "sso_login_codes",
fields: [
{
fieldName: "user_id",
dataType: "INTEGER",
unique: true,
},
{
fieldName: "code",
dataType: "TEXT",
},
],
},
{
tableName: "media",
fields: [
{
fieldName: "user_id",
dataType: "INTEGER",
},
{
fieldName: "title",
dataType: "TEXT",
},
{
fieldName: "description",
dataType: "TEXT",
},
{
fieldName: "summary",
dataType: "TEXT",
},
{
fieldName: "media_type",
dataType: "TEXT",
options: MediaTypes.map((it) => it.value),
},
{
fieldName: "media_write_path",
dataType: "TEXT",
},
{
fieldName: "media_thumbnail_write_path",
dataType: "TEXT",
},
{
fieldName: "mime_type",
dataType: "TEXT",
},
{
fieldName: "text_content",
dataType: "TEXT",
},
{
fieldName: "is_primary",
dataType: "INTEGER",
options: [0, 1],
},
{
fieldName: "is_rag_ingested",
dataType: "INTEGER",
options: [0, 1],
},
{
fieldName: "is_private",
dataType: "INTEGER",
options: [0, 1],
},
{
fieldName: "archived",
dataType: "INTEGER",
options: [0, 1],
},
],
uniqueConstraints: [
{
alias: "one_user_per_primary_profile_image",
constraintName: "One User per primary profile image",
constraintTableFields: [
{ value: "user_id" },
{ value: "is_primary" },
],
},
],
},
{
tableName: "media_paradigms",
fields: [
{
fieldName: "media_id",
dataType: "INTEGER",
foreignKey: {
cascadeDelete: true,
destinationTableName: "media",
destinationTableColumnName: "id",
destinationTableColumnType: "INTEGER",
foreignKeyName: "media_paradigm_media_fk",
},
},
{
fieldName: "media_paradigm",
dataType: "TEXT",
options: MediaParadigms.map((mp) => mp.value),
},
],
},
],
};
export default schema;
+110
View File
@@ -0,0 +1,110 @@
export const BunSQLiteTables = [
"users",
"user_types",
"sso_login_codes",
"media",
"media_paradigms",
] as const
export type BUN_SQLITE_WGUI_USERS = {
/**
* The unique identifier of the record.
*/
id?: number | "";
/**
* The time when the record was created. (Unix Timestamp)
*/
created_at?: number | "";
/**
* The time when the record was updated. (Unix Timestamp)
*/
updated_at?: number | "";
first_name?: string;
last_name?: string;
email?: string;
username?: string;
password?: string;
bio?: string;
archived?: 0 | 1 | "";
}
export type BUN_SQLITE_WGUI_USER_TYPES = {
/**
* The unique identifier of the record.
*/
id?: number | "";
/**
* The time when the record was created. (Unix Timestamp)
*/
created_at?: number | "";
/**
* The time when the record was updated. (Unix Timestamp)
*/
updated_at?: number | "";
user_id?: number | "";
user_type?: "super_admin" | "admin" | "revoked" | "";
}
export type BUN_SQLITE_WGUI_SSO_LOGIN_CODES = {
/**
* The unique identifier of the record.
*/
id?: number | "";
/**
* The time when the record was created. (Unix Timestamp)
*/
created_at?: number | "";
/**
* The time when the record was updated. (Unix Timestamp)
*/
updated_at?: number | "";
user_id?: number | "";
code?: string;
}
export type BUN_SQLITE_WGUI_MEDIA = {
/**
* The unique identifier of the record.
*/
id?: number | "";
/**
* The time when the record was created. (Unix Timestamp)
*/
created_at?: number | "";
/**
* The time when the record was updated. (Unix Timestamp)
*/
updated_at?: number | "";
user_id?: number | "";
title?: string;
description?: string;
summary?: string;
media_type?: "image" | "video" | "document" | "";
media_write_path?: string;
media_thumbnail_write_path?: string;
mime_type?: string;
text_content?: string;
is_primary?: 0 | 1 | "";
is_rag_ingested?: 0 | 1 | "";
is_private?: 0 | 1 | "";
archived?: 0 | 1 | "";
}
export type BUN_SQLITE_WGUI_MEDIA_PARADIGMS = {
/**
* The unique identifier of the record.
*/
id?: number | "";
/**
* The time when the record was created. (Unix Timestamp)
*/
created_at?: number | "";
/**
* The time when the record was updated. (Unix Timestamp)
*/
updated_at?: number | "";
media_id?: number | "";
media_paradigm?: "user-profile-image" | "generic" | "event" | "";
}
export type BUN_SQLITE_WGUI_ALL_TYPEDEFS = BUN_SQLITE_WGUI_USERS & BUN_SQLITE_WGUI_USER_TYPES & BUN_SQLITE_WGUI_SSO_LOGIN_CODES & BUN_SQLITE_WGUI_MEDIA & BUN_SQLITE_WGUI_MEDIA_PARADIGMS
BIN
View File
Binary file not shown.