6020310b3f
A tag is the writer's filing of a row — 「综述」, 「必读」 — and it is a different fact from `reference.keywords`, which are the 关键词 printed on the article. A tag never prints, one document carries several, and the same label is on many documents, so it gets two tables rather than a column: reference_tag name (unique), colour, note reference_tag_link reference_id + tag_id — the pair is the primary key The link is a bare link, which is why it is `_link` and not `_placement`: there is no `sort` to own, so the pair *is* the row and the same label cannot be applied twice. A tag is made first and applied second: `tag_ids`, never tag names, so a typo cannot invent a label — an unknown id is a 400 naming it, and nothing is written. Deleting a tag is deliberately *not* guarded the way deleting a cited reference is: both foreign keys cascade, so the labels go and the literature stays. `GET /references?tag=1&tag=2` narrows rather than widens — the rows carrying both labels — because that is what a second filter reads as. The smoke test now walks the whole flow in the order the feature intends: labels first, then tagged references, then a rename that follows every row.
100 lines
2.1 KiB
Python
100 lines
2.1 KiB
Python
"""Pydantic schemas for request and response payloads."""
|
|
|
|
from app.schemas.common import (
|
|
BatchDeleteRequest,
|
|
BatchDeleteResult,
|
|
PageResult,
|
|
normalize_hex_color,
|
|
)
|
|
from app.schemas.paper import (
|
|
CitationInput,
|
|
CitationRead,
|
|
PaperCitationRead,
|
|
PaperCreate,
|
|
PaperDocumentRead,
|
|
PaperListItem,
|
|
PaperRead,
|
|
PaperStatus,
|
|
PaperUpdate,
|
|
ParagraphListRead,
|
|
ParagraphRead,
|
|
ParagraphUpdate,
|
|
SentenceCreate,
|
|
SentenceRead,
|
|
SentenceUpdate,
|
|
)
|
|
from app.schemas.reference import (
|
|
ReferenceAuthorInput,
|
|
ReferenceAuthorRead,
|
|
ReferenceCitationRead,
|
|
ReferenceCreate,
|
|
ReferenceListItem,
|
|
ReferenceRead,
|
|
ReferenceUpdate,
|
|
normalize_doi,
|
|
)
|
|
from app.schemas.reference_tag import (
|
|
ReferenceTagCreate,
|
|
ReferenceTagRead,
|
|
ReferenceTagRef,
|
|
ReferenceTagUpdate,
|
|
)
|
|
from app.schemas.template import (
|
|
TemplateCreate,
|
|
TemplateListItem,
|
|
TemplateRead,
|
|
TemplateUpdate,
|
|
TemplateTitlePlacementInput,
|
|
TemplateTitlePlacementRead,
|
|
)
|
|
from app.schemas.template_title import (
|
|
TemplateTitleCreate,
|
|
TemplateTitleRead,
|
|
TemplateTitleRef,
|
|
TemplateTitleUpdate,
|
|
)
|
|
|
|
__all__ = [
|
|
"BatchDeleteRequest",
|
|
"ReferenceAuthorInput",
|
|
"ReferenceAuthorRead",
|
|
"ReferenceCitationRead",
|
|
"ReferenceCreate",
|
|
"ReferenceListItem",
|
|
"ReferenceRead",
|
|
"ReferenceTagCreate",
|
|
"ReferenceTagRead",
|
|
"ReferenceTagRef",
|
|
"ReferenceTagUpdate",
|
|
"ReferenceUpdate",
|
|
"normalize_doi",
|
|
"CitationInput",
|
|
"CitationRead",
|
|
"PaperCitationRead",
|
|
"PaperCreate",
|
|
"PaperDocumentRead",
|
|
"PaperListItem",
|
|
"PaperRead",
|
|
"PaperStatus",
|
|
"PaperUpdate",
|
|
"ParagraphListRead",
|
|
"ParagraphRead",
|
|
"ParagraphUpdate",
|
|
"SentenceCreate",
|
|
"SentenceRead",
|
|
"SentenceUpdate",
|
|
"BatchDeleteResult",
|
|
"PageResult",
|
|
"TemplateCreate",
|
|
"TemplateListItem",
|
|
"TemplateRead",
|
|
"TemplateUpdate",
|
|
"TemplateTitleCreate",
|
|
"TemplateTitleRead",
|
|
"TemplateTitleRef",
|
|
"TemplateTitleUpdate",
|
|
"TemplateTitlePlacementInput",
|
|
"TemplateTitlePlacementRead",
|
|
"normalize_hex_color",
|
|
]
|