Files
leocrm/app/plugins/builtins/wiki/schemas.py
T

38 lines
1.3 KiB
Python

"""Pydantic schemas for the Wiki plugin."""
from __future__ import annotations
from datetime import datetime
from pydantic import BaseModel, Field
class CategoryCreate(BaseModel):
name: str = Field(..., min_length=1, max_length=200)
slug: str = Field(..., min_length=1, max_length=200)
description: str | None = None
parent_id: str | None = None
sort_order: int = 0
class CategoryUpdate(BaseModel):
name: str | None = None
description: str | None = None
parent_id: str | None = None
sort_order: int | None = None
class ArticleCreate(BaseModel):
title: str = Field(..., min_length=1, max_length=300)
slug: str = Field(..., min_length=1, max_length=300)
content: str = ""
summary: str | None = None
category_id: str | None = None
tags: list[str] = Field(default_factory=list)
status: str = Field(default="draft", pattern="^(draft|published|archived)$")
entity_links: list[dict] = Field(default_factory=list)
class ArticleUpdate(BaseModel):
title: str | None = None
content: str | None = None
summary: str | None = None
category_id: str | None = None
tags: list[str] | None = None
status: str | None = Field(None, pattern="^(draft|published|archived)$")
entity_links: list[dict] | None = None
edit_comment: str | None = None