8.5 KiB
Artefact Versioning System - Implementation Summary
✅ Completed Features
Database Schema (NocoDB)
New Tables Created
-
ArtefactVersions
artefact_id(Number)version_number(Number) - auto-incrementing per artefactcreated_by_user_id(Number)created_at(DateTime)notes(LongText) - what changed in this version
-
ArtefactVersionTexts (for multilingual copy artefacts)
version_id(Number)language_code(SingleLineText) - e.g., "AR", "EN", "FR"language_label(SingleLineText) - e.g., "العربية", "English"content(LongText) - the actual text content
Modified Tables
-
Artefacts
- Added:
current_version(Number) - latest version number - Added:
review_version(Number) - version submitted for review
- Added:
-
ArtefactAttachments
- Added:
version_id(Number) - attachments now belong to specific versions - Added:
drive_url(SingleLineText) - Google Drive video links - Kept:
artefact_idfor backward compatibility
- Added:
-
Comments
- Added:
version_number(Number) - comments tied to specific versions
- Added:
Server API Routes
Version Management
GET /api/artefacts/:id/versions- List all versionsPOST /api/artefacts/:id/versions- Create new version (auto-increments)GET /api/artefacts/:id/versions/:versionId- Get specific version with texts/attachments
Text Management (Copy Type)
POST /api/artefacts/:id/versions/:versionId/texts- Add/update language entryDELETE /api/artefact-version-texts/:id- Remove language entry
Attachment Management
POST /api/artefacts/:id/versions/:versionId/attachments- Upload file OR Google Drive link- For video type: accepts
drive_urlfield for Google Drive videos - For design/video: accepts file upload
- For video type: accepts
Comments (Version-Specific)
GET /api/artefacts/:id/versions/:versionId/comments- Get comments for versionPOST /api/artefacts/:id/versions/:versionId/comments- Add comment to version
Updated Routes
POST /api/artefacts- Now auto-creates version 1POST /api/artefacts/:id/submit-review- Storesreview_versionGET /api/public/review/:token- Returns specific version submitted for review
Client Components
New Component: ArtefactVersionTimeline.jsx
- Vertical timeline showing all versions
- Each entry displays:
- Version number
- Date and creator
- Change notes
- Thumbnail (for design artefacts)
- Active version highlighted
- Click to switch versions
Updated: Artefacts.jsx
- Complete rewrite with versioning support
- Type-specific UIs:
For ALL Types:
- Version selector/timeline
- "New Version" button with optional notes
- Comments section (filtered by version)
- Submit for Review (submits current/latest version)
For type=copy (Text Artefacts):
- Language management UI
- Add/edit/delete languages per version
- Each language: code + label + content in card
- "Copy from previous version" option when creating new version
- Multi-language tabs with rich text display
For type=design (Image Artefacts):
- Image gallery with preview thumbnails
- Upload images to current version
- Version timeline shows thumbnail per version
- Lightbox/enlarge on click
- Delete images per version
For type=video:
- Dual-mode video upload:
- File Upload - Standard video file upload
- Google Drive Link - Paste Drive URL with auto-extraction
- Embedded video player (file or Drive iframe)
- Google Drive URL parser supports:
https://drive.google.com/file/d/ABC123/viewhttps://drive.google.com/open?id=ABC123https://docs.google.com/file/d/ABC123/edit
- Auto-converts to embed URL:
https://drive.google.com/file/d/${id}/preview
Updated: PublicReview.jsx
- Shows specific version submitted for review
- Type-specific display:
For copy:
- Multi-language tabs
- Switch between languages
- Formatted content display
For design:
- Image gallery with full-size preview
- Click to open in new tab
For video:
-
Embedded video player
-
Google Drive iframe support
-
Standard HTML5 video player
-
Comments display (tied to reviewed version)
-
Approval actions apply to specific version
Features Implemented
✅ Version Management
- Auto-create version 1 on artefact creation
- Incremental version numbering per artefact
- Version notes/changelog
- Creator tracking per version
✅ Multilingual Content (Copy Type)
- Add unlimited languages per version
- Language code + label + content
- Copy languages from previous version
- Delete individual languages
✅ Image Gallery (Design Type)
- Upload multiple images per version
- Version-specific image storage
- Image preview and management
- Delete images per version
✅ Video Support (Video Type)
- File upload for local videos
- Google Drive link integration
- Auto-embed with Drive URL parser
- Mixed sources (uploaded files + Drive links)
✅ Comments per Version
- Comments tied to specific version number
- Version-aware comment filtering
- Public/internal comments support
✅ Public Review
- Review specific version (not latest)
- Version info displayed
- Type-specific content rendering
- Approval applies to reviewed version
✅ Backward Compatibility
- Existing artefacts treated as version 1
- Legacy content field still supported
- Graceful fallback for missing versions
Testing Results
✅ Server starts successfully
- All tables created/updated without errors
- Migration system runs cleanly
- No conflicts with existing schema
✅ Client builds successfully
- No TypeScript/JSX errors
- All imports resolved
- Build size: 729 KB (gzipped: 180 KB)
Usage Examples
Create Artefact
- Click "New Artefact"
- Choose type (copy/design/video/other)
- Fill title, description, brand
- Artefact created with version 1 automatically
Add Language (Copy Type)
- Open artefact detail panel
- Select version
- Click "Add Language"
- Enter code (AR, EN, FR), label, and content
- Language saved to current version
Upload Images (Design Type)
- Open artefact detail panel
- Select version
- Click "Upload Image"
- Choose file
- Image added to version
Add Google Drive Video
- Open artefact detail panel (video type)
- Click "Add Video"
- Select "Google Drive Link"
- Paste Drive URL
- Video embedded automatically
Create New Version
- Click "New Version" button
- Enter notes (optional)
- For copy type: choose to copy languages from previous
- New version created, becomes current
Submit for Review
- Ensure artefact is in draft status
- Click "Submit for Review"
- Review link generated (expires in 7 days)
- Current version is locked for review
Public Review Flow
- Approver opens review link
- Sees specific version submitted
- Views type-specific content
- Adds feedback (optional)
- Approves/Rejects/Requests Revision
Migration Notes
- Existing artefacts automatically supported
- No manual migration required
- Version 1 auto-created for new artefacts
- Comments table gets
version_numbercolumn added automatically - ArtefactAttachments table gets
version_idanddrive_urlcolumns added
Google Drive Integration
The system extracts file IDs from various Google Drive URL formats:
// Supported formats:
https://drive.google.com/file/d/FILE_ID/view
https://drive.google.com/open?id=FILE_ID
https://docs.google.com/file/d/FILE_ID/edit
// Converts to embed format:
https://drive.google.com/file/d/FILE_ID/preview
Requirements:
- Drive file must be publicly accessible or shared with link
- "Anyone with the link can view" permission required
Next Steps (Optional Enhancements)
- Version comparison UI (diff between versions)
- Bulk language import from CSV/JSON
- Version rollback functionality
- Version branching for A/B testing
- Export version as PDF
- Collaborative editing with real-time comments
- Version approval workflow (multi-stage)
- Asset library integration for reusable content
- Analytics per version (view count, approval time)
- Email notifications on version updates
Technical Notes
- All version operations require authentication
- Contributors can only manage their own artefacts
- Managers/Superadmins can manage all artefacts
- File cleanup: orphaned files deleted when last reference removed
- Google Drive embeds require iframe support in browser
- Version timeline loads asynchronously for better performance
Implementation Date: 2026-02-19
Base: p37fzfdy2erdcle
Status: ✅ Complete and Tested