Files
AR 15 M4 5b54ad5c23 feat(sprint-5.5): add block version snapshots with switching between versions
- Add BlockSnapshot Prisma model (html, css, version, changelog) + migration
- Add API endpoints: POST/GET /blocks/snapshots, GET /blocks/snapshots/:id
- BlockMetaBar: version dropdown, HTML capture on save, onSnapshotSelect prop
- "Сохранить версию" now captures innerHTML snapshot + CSS and stores in DB
- Selecting archived version shows stored HTML snapshot instead of live component
- Yellow banner "Архивная версия" with link to return to current
- Split all 8 block pages into Server Component (metadata) + Client Component
- Add data-block-capture attribute for snapshot capture targeting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 00:17:25 +05:00

66 lines
1.4 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
}
enum Role {
viewer
editor
}
enum ComponentStatus {
draft
review
approved
}
model User {
id String @id @default(uuid())
email String @unique
name String
passwordHash String
role Role @default(viewer)
createdAt DateTime @default(now())
components ExperimentalComponent[]
}
model ExperimentalComponent {
id String @id @default(uuid())
name String
baseComponent String
attributes Json
status ComponentStatus @default(draft)
author User @relation(fields: [authorId], references: [id])
authorId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Block {
id String @id @default(uuid())
path String @unique
name String
version String
isInPreview Boolean @default(false)
changelog Json @default("[]")
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}
model BlockSnapshot {
id String @id @default(uuid())
blockPath String
version String
changelog Json @default("[]")
html String @db.Text
css String @db.Text
createdAt DateTime @default(now())
@@unique([blockPath, version])
@@index([blockPath])
}