From f159c6e86172c514403fe5453360000eb1055534 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Mon, 18 May 2026 20:45:32 +0300 Subject: [PATCH] feat: add SocialRecord, ContactsRecord, SiteSettingsRecord API types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Models PocketBase relations: SiteSettings → contacts → ContactsRecord → socials[] → SocialRecord. expand fields typed as optional resolved records for use with PocketBase expand query param. --- src/shared/api/types.ts | 68 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/src/shared/api/types.ts b/src/shared/api/types.ts index 6c8db9b..b612be1 100644 --- a/src/shared/api/types.ts +++ b/src/shared/api/types.ts @@ -104,7 +104,7 @@ export type ProjectRecord = BaseRecord & { */ role: string; /** - * Short summary of the project + * Project description as HTML from the PocketBase rich-text editor */ description: string; /** @@ -119,12 +119,78 @@ export type ProjectRecord = BaseRecord & { * Primary thumbnail or hero image filename */ image: string; + /** + * Project's url + */ + url: string; /** * Sorting weight for the project list */ order: number; }; +/** + * PocketBase collection for individual social profile links. + */ +export type SocialRecord = BaseRecord & { + /** + * Display name shown as the link text + */ + label: string; + /** + * Full URL for the social profile + */ + url: string; +}; + +/** + * PocketBase collection for the primary contact record. + * Single-record collection — only the first record is consumed. + */ +export type ContactsRecord = BaseRecord & { + /** + * Primary contact email address + */ + email: string; + /** + * Raw relation IDs — use expand?.socials for resolved records + */ + socials: string[]; + /** + * Expanded relation data, present when fetched with expand=socials + */ + expand?: { + /** + * Resolved social link records + */ + socials?: SocialRecord[]; + }; +}; + +/** + * PocketBase collection for global site configuration. + * Single-record collection — only the first record is consumed. + */ +export type SiteSettingsRecord = BaseRecord & { + /** + * CV filename stored in PocketBase — build the full URL with buildFileUrl() + */ + cv: string; + /** + * Raw relation ID — use expand?.contacts for the resolved record + */ + contacts: string; + /** + * Expanded relation data, present when fetched with expand=contacts,contacts.socials + */ + expand?: { + /** + * Resolved contacts record + */ + contacts?: ContactsRecord; + }; +}; + /** * Generic response for a list of PocketBase records. */