Skip to main content

create

Function create 

Source
pub async fn create(
    pool: &Pool,
    taxonomy_id: i64,
    new: NewCategory,
) -> Result<Category, CategoryError>
Expand description

Create a category. Validates parent (exists, same taxonomy, allowed by hierarchical, within max_depth) and slug-uniqueness, then inserts and materializes its path in one transaction.

ยงErrors

CategoryError for unknown taxonomy, flat-with-parent, depth overflow, duplicate slug, missing parent, or DB failure.