Rework database model to be more flexible

This commit is contained in:
2026-01-16 21:59:47 -07:00
parent 994a80c45c
commit 0e2a8e425b
14 changed files with 2294 additions and 139 deletions
+8
View File
@@ -1,5 +1,6 @@
use flix::db::entity;
use flix::model::id::CollectionId;
use flix::model::text;
use anyhow::Result;
use sea_orm::ActiveValue::{NotSet, Set};
@@ -14,11 +15,18 @@ pub async fn add(db: &DatabaseConnection, command: AddCommand) -> Result<()> {
.transaction(|txn| {
let title = title.clone();
let sort_title = text::make_sortable_title(&title);
let fs_slug = text::make_fs_slug(&title);
let web_slug = text::make_web_slug(&title);
Box::pin(async move {
let flix = entity::info::collections::ActiveModel {
id: NotSet,
title: Set(title),
overview: Set(overview),
sort_title: Set(sort_title),
fs_slug: Set(fs_slug),
web_slug: Set(web_slug),
}
.insert(txn)
.await?;