feat(sprint-5.5): store block metadata (version, changelog) in PostgreSQL
- Prisma schema: added `changelog Json @default("[]")` to Block model
- Migration: 20260324141120_add_changelog_field
- Seed: 8 blocks with actual versions (v1.0–v1.2) and changelog entries
- API: PATCH /blocks/by-path accepts changelog field
- CORS: accept any localhost port (regex pattern)
- BlockChangelog component: renders version history from API or fallback
- BlockMetaBar: loads changelog from API, passes to BlockChangelog
- Removed "API офлайн" text, replaced with subtle gray dot
- Added defaultChangelog prop for offline fallback
- Block pages: removed hardcoded changelog JSX, use defaultChangelog prop
- Updated SPRINTS.md with completed tasks
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ export class BlocksController {
|
||||
@Patch('by-path')
|
||||
update(
|
||||
@Query('path') path: string,
|
||||
@Body() body: { version?: string; isInPreview?: boolean },
|
||||
@Body() body: { version?: string; isInPreview?: boolean; changelog?: object[] },
|
||||
) {
|
||||
return this.blocks.update(path, body);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export class BlocksService {
|
||||
});
|
||||
}
|
||||
|
||||
update(path: string, data: { version?: string; isInPreview?: boolean }) {
|
||||
update(path: string, data: { version?: string; isInPreview?: boolean; changelog?: object[] }) {
|
||||
return this.prisma.block.update({ where: { path }, data });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
app.enableCors({ origin: 'http://localhost:3001' });
|
||||
app.enableCors({ origin: [/^http:\/\/localhost:\d+$/] });
|
||||
await app.listen(process.env.PORT ?? 3000);
|
||||
}
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user