You've already forked flix
Rework database model to be more flexible
This commit is contained in:
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user