Files
Moniki_uslugi/apps/cms/src/collections/Specialties.ts
T
Alexey NovikovandClaude Opus 5.5 0b447e67bf Lock down access control and add image previews, file locations and cropping to the CMS.
Security:
- only admins can assign user roles; profile updates are whitelisted
- SBP payment confirmation requires an HMAC-signed webhook or an admin, and is idempotent
- patient receipts and documents are private media owned by the patient, downloaded via the site
- patients cannot change booking price or payment status, forge invoices or write for other accounts

CMS images:
- every upload field shows a large preview, focal point, server file path and public URL
- crop/resize keeps the original in media/originals with a "restore original" action
- legacy image URL fields show where the file really lives and can be moved into the media library
- specialties get a visual icon picker (Untitled UI) and an optional custom icon upload

Fixes: saving the cabinet profile, receipt PDF generation, uploaded doctor photos on the site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:23:05 +03:00

32 lines
1.1 KiB
TypeScript

import type { CollectionConfig } from 'payload'
import { ADMIN_GROUP } from '../admin/groups'
export const Specialties: CollectionConfig = {
slug: 'specialties',
labels: { singular: 'Направление', plural: 'Направления' },
admin: { group: ADMIN_GROUP.catalog, useAsTitle: 'title' },
access: { read: () => true },
fields: [
{ name: 'title', type: 'text', required: true, localized: true },
{ name: 'slug', type: 'text', required: true, unique: true },
{ name: 'description', type: 'textarea', localized: true },
{
name: 'icon',
type: 'text',
label: 'Иконка',
admin: {
description: 'Встроенная иконка (Untitled UI). Если ниже загружена своя картинка, используется она.',
components: { Field: '/components/admin/IconPicker#IconPicker' },
},
},
{
name: 'iconImage',
type: 'upload',
relationTo: 'media',
label: 'Своя иконка (SVG или PNG)',
filterOptions: { mimeType: { contains: 'image' } },
},
{ name: 'sortOrder', type: 'number', defaultValue: 0 },
],
}