Add Logbuch: project update blog with admin, media and API
Public archive with sidebar navigation, project pages, month archive, search and entry pages with image blocks. Admin area for brands, projects, post types, users, api clients, media and the entry editor with drag and drop images, preview per audience, scheduling and publish checks. Read and write API with bearer tokens, audience scoping, idempotent creation, OpenAPI document and editorial guide. Magic link login with configurable allowed domains, whole app behind the session gate. 456 tests including design rule checks.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { problem } from './problem'
|
||||
import type { ApiEntryError } from './api-entries'
|
||||
|
||||
const statuses: Record<ApiEntryError, number> = {
|
||||
forbidden: 403,
|
||||
project_unknown: 404,
|
||||
project_not_allowed: 403,
|
||||
type_unknown: 422,
|
||||
audience_not_allowed: 403,
|
||||
title_missing: 400,
|
||||
title_too_long: 400,
|
||||
teaser_too_long: 400,
|
||||
slug_invalid: 400,
|
||||
blocks_invalid: 400,
|
||||
too_many_blocks: 400,
|
||||
not_found: 404,
|
||||
already_published: 409,
|
||||
}
|
||||
|
||||
const details: Record<ApiEntryError, string> = {
|
||||
forbidden: 'Dieser Zugang darf nicht schreiben.',
|
||||
project_unknown: 'Das Projekt gibt es nicht.',
|
||||
project_not_allowed: 'Dieser Zugang ist an ein anderes Projekt gebunden.',
|
||||
type_unknown: 'Diese Beitragsart gibt es nicht oder sie ist abgeschaltet.',
|
||||
audience_not_allowed: 'Dieser Zugang darf diese Zielgruppe nicht setzen.',
|
||||
title_missing: 'Der Titel fehlt.',
|
||||
title_too_long: 'Der Titel ist zu lang.',
|
||||
teaser_too_long: 'Der Anreisser ist zu lang.',
|
||||
slug_invalid: 'Der Slug enthaelt unerlaubte Zeichen.',
|
||||
blocks_invalid: 'Mindestens ein Block hat einen unbekannten Typ oder fehlende Felder.',
|
||||
too_many_blocks: 'Zu viele Bloecke.',
|
||||
not_found: 'Nicht gefunden.',
|
||||
already_published: 'Der Beitrag ist bereits veroeffentlicht und laesst sich so nicht mehr aendern.',
|
||||
}
|
||||
|
||||
export function entryProblem(error: ApiEntryError): Response {
|
||||
return problem(statuses[error], error, details[error])
|
||||
}
|
||||
Reference in New Issue
Block a user