issue-56: Improve template preview#68
Conversation
📝 WalkthroughWalkthroughA major PR introducing a moderation system with database schema and API handlers, restructuring Go data models, implementing comprehensive RO-Crate metadata extraction and rendering via JavaScript, and updating record queries to enforce moderation status filtering. Changes
Sequence Diagram(s)sequenceDiagram
actor Admin
participant Browser
participant ModerationHandler
participant ModerationRepository
participant Database
Admin->>Browser: Click approve/reject button
Browser->>ModerationHandler: POST /api/v1/moderation/{id}<br/>(action, reason)
ModerationHandler->>ModerationHandler: Verify admin session
ModerationHandler->>ModerationRepository: SetRecordStatus(recordId, status)
ModerationRepository->>Database: UPDATE records SET moderation_status
Database-->>ModerationRepository: Status updated
ModerationHandler->>ModerationRepository: LogModerationAction(action)
ModerationRepository->>Database: INSERT moderation_actions
Database-->>ModerationRepository: Action logged
ModerationHandler-->>Browser: JSON response {status}
Browser->>Browser: Show toast notification
Browser->>Browser: Reload page
sequenceDiagram
participant Browser
participant RecordTemplate
participant IndexJS
participant RecordExtractor
participant DOM
RecordTemplate->>Browser: Load with ro-crate-data & fallback-data
Browser->>IndexJS: Execute initializeRoCrateViewer()
IndexJS->>RecordExtractor: extractRecordData(roCrateData)
RecordExtractor->>RecordExtractor: Parse entities, resolve authors,<br/>extract metadata fields
RecordExtractor-->>IndexJS: Structured data {commonInfo,<br/>mainText, extraFields}
IndexJS->>IndexJS: applyFallbackData(extracted, fallback)
IndexJS->>DOM: renderCommonInfoBlock()
IndexJS->>DOM: renderMainTextBlock()
IndexJS->>DOM: renderExtraFieldsBlock()
IndexJS->>DOM: renderOtherMetadata()
DOM-->>Browser: Populated containers display
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Free 📒 Files selected for processing (13)
✏️ Tip: You can disable this entire section by setting Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Closes #56



Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.