From e8bf8b502ea0c73fb7e3343761298ab25792659f Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 12 May 2026 13:57:25 +0300 Subject: [PATCH] fix: align PocketBase type definitions with actual schema Remove slug field from PageContentRecord (intro/bio collections have none). Remove number field from SectionRecord (not stored in PocketBase); derive zero-padded display number from the order field at render time. --- src/entities/Section/model/types.ts | 4 ---- src/shared/api/types.ts | 5 +---- .../ui/SectionsAccordion/SectionsAccordion.test.tsx | 6 +++--- .../ui/SectionsAccordion/SectionsAccordion.tsx | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/entities/Section/model/types.ts b/src/entities/Section/model/types.ts index f3d4824..da6bcc5 100644 --- a/src/entities/Section/model/types.ts +++ b/src/entities/Section/model/types.ts @@ -12,10 +12,6 @@ export type SectionRecord = BaseRecord & { * Display name of the section */ title: string; - /** - * Visual numbering prefix (e.g., "01") - */ - number: string; /** * Sorting weight for section order */ diff --git a/src/shared/api/types.ts b/src/shared/api/types.ts index 453d68b..787ec8b 100644 --- a/src/shared/api/types.ts +++ b/src/shared/api/types.ts @@ -26,12 +26,9 @@ export type BaseRecord = { /** * PocketBase collection for simple text blocks (Intro, Bio). + * Each collection is named after its section — no slug field. */ export type PageContentRecord = BaseRecord & { - /** - * Slug corresponding to the parent section - */ - slug: string; /** * HTML or Markdown content string */ diff --git a/src/widgets/SectionsAccordion/ui/SectionsAccordion/SectionsAccordion.test.tsx b/src/widgets/SectionsAccordion/ui/SectionsAccordion/SectionsAccordion.test.tsx index 703ba5c..918c46b 100644 --- a/src/widgets/SectionsAccordion/ui/SectionsAccordion/SectionsAccordion.test.tsx +++ b/src/widgets/SectionsAccordion/ui/SectionsAccordion/SectionsAccordion.test.tsx @@ -5,9 +5,9 @@ import { SectionsAccordion } from './SectionsAccordion'; const baseRecord = { collectionId: 'c1', collectionName: 'sections', created: '', updated: '' }; const sections: SectionRecord[] = [ - { ...baseRecord, id: '1', slug: 'intro', title: 'Intro', number: '01', order: 1 }, - { ...baseRecord, id: '2', slug: 'bio', title: 'Bio', number: '02', order: 2 }, - { ...baseRecord, id: '3', slug: 'skills', title: 'Skills', number: '03', order: 3 }, + { ...baseRecord, id: '1', slug: 'intro', title: 'Intro', order: 1 }, + { ...baseRecord, id: '2', slug: 'bio', title: 'Bio', order: 2 }, + { ...baseRecord, id: '3', slug: 'skills', title: 'Skills', order: 3 }, ]; describe('SectionsAccordion', () => { diff --git a/src/widgets/SectionsAccordion/ui/SectionsAccordion/SectionsAccordion.tsx b/src/widgets/SectionsAccordion/ui/SectionsAccordion/SectionsAccordion.tsx index 51fe610..c195e02 100644 --- a/src/widgets/SectionsAccordion/ui/SectionsAccordion/SectionsAccordion.tsx +++ b/src/widgets/SectionsAccordion/ui/SectionsAccordion/SectionsAccordion.tsx @@ -33,7 +33,7 @@ export function SectionsAccordion({ sections, activeSlug, children }: Props) {