diff --git a/backend/src/routes/public.ts b/backend/src/routes/public.ts index d291b87..30464b1 100644 --- a/backend/src/routes/public.ts +++ b/backend/src/routes/public.ts @@ -14,7 +14,7 @@ publicRouter.get('/content', async (_req, res) => { ), query( `SELECT id, slug, title, subtitle, description, - status, audience, icon_key, tags, sort_order + status, audience, icon_key, tags, sort_order, site_url FROM products WHERE is_published = true ORDER BY sort_order ASC` diff --git a/db/003_product_url_and_requisites.sql b/db/003_product_url_and_requisites.sql new file mode 100644 index 0000000..eb53743 --- /dev/null +++ b/db/003_product_url_and_requisites.sql @@ -0,0 +1,15 @@ +-- Ссылка на сайт продукта и реквизиты компании в подвале. +-- Зачем: Apple при регистрации организации проверяет, что сайт принадлежит +-- компании (реквизиты) и что продукт с ней связан (ссылка на agroto.ru). + +ALTER TABLE products ADD COLUMN IF NOT EXISTS site_url VARCHAR(256); + +UPDATE products SET site_url = 'https://agroto.ru' WHERE slug = 'agroto' AND site_url IS NULL; + +INSERT INTO settings (key, value) VALUES + ('company_inn', '3528347856'), + ('company_kpp', '352801001'), + ('company_ogrn', '1263500003667'), + ('company_address', '162620, Вологодская обл., г. Череповец, ул. Центральная, д. 12'), + ('company_director', 'Блюма Сергей Николаевич') +ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = now(); diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index f01e1ee..6814fee 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -3,6 +3,7 @@ const API_BASE = import.meta.env.VITE_API_URL || ''; export interface Product { id: number; slug: string; + site_url?: string | null; title: string; subtitle: string | null; description: string; diff --git a/frontend/src/pages/Landing.tsx b/frontend/src/pages/Landing.tsx index daee2fd..4379bad 100644 --- a/frontend/src/pages/Landing.tsx +++ b/frontend/src/pages/Landing.tsx @@ -133,6 +133,17 @@ export function Landing() { {tag} ))} + {p.site_url && ( + + {p.site_url.replace(/^https?:\/\//, '')} + + + )} ); @@ -184,12 +195,37 @@ export function Landing() { diff --git a/frontend/tsconfig.tsbuildinfo b/frontend/tsconfig.tsbuildinfo new file mode 100644 index 0000000..a2d920d --- /dev/null +++ b/frontend/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"root":["./src/main.tsx","./src/vite-env.d.ts","./src/admin/AdminLayout.tsx","./src/admin/AdminLogin.tsx","./src/admin/ProductsAdmin.tsx","./src/admin/SectionsAdmin.tsx","./src/admin/SettingsAdmin.tsx","./src/api/client.ts","./src/components/Icons.tsx","./src/pages/Landing.tsx"],"errors":true,"version":"6.0.3"} \ No newline at end of file