Blog create, update and publication
Publication is a status update, not a deployment or review queue. draft→published sets publishedAt, published→draft clears it, remaining published retains it. Creation defaults to draft. SQL protects unique slug; Dynamo checks a slug GSI then writes by ID, not an atomic slug claim. Updates have no optimistic revision check in the reviewed path. Blog deletion uses a native confirm dialog, authenticated DELETE and then navigation to the list.
Legend: all drawn relationships are source-verified.
sequenceDiagram
actor U as Administrator
participant P as Blog editor
participant R as Post route
participant A as Injected AdminBlogApi
participant V as Post service and parser
participant S as Selected BlogPostStore
U->>P: Edit fields and draft/published status
P->>R: POST new or PUT id via adminFetch
Note over R,S: Request hook already selected cached store
R->>R: Read body then requireAdminBlog auth
R->>A: Create or update
A->>V: Delegate with selected store
V->>V: Validate fields and normalize slug
alt Invalid body
V-->>R: Failure mapped to 400
else Valid
V->>S: create or update
S->>S: Resolve timestamps and publication fields
alt Slug conflict or missing update id
S-->>V: Conflict error or null
V-->>R: 409 or 404
else Saved
S-->>R: BlogPost through facade
R-->>P: Record
P->>P: New post navigates to id, edit shows success
end
end
Source evidence
- packages/web-layer-admin/app/pages/admin/blog/[id].vue:137 — const onSave
- packages/web-layer-admin/server/api/admin/posts/index.post.ts:7 — export default defineEventHandler
- packages/web-layer-admin/server/api/admin/posts/[id].put.ts:25 — export default defineEventHandler
- packages/web-layer-admin/server/utils/admin-handler.ts:11 — export function requireAdminBlog
- core/web/server/api/posts/service.ts:47 — export const createBlogPostFromBody
- core/web/server/api/posts/parse-body.ts:61 — export const parseCreateBlogPostBody
- core/web/server/db/blog-helpers.ts:40 — export function resolveUpdateFields
- core/web/server/db/blog-dynamodb.ts:103 — const createPost