mirror of
http://172.20.10.11:3000/gitadmin/INSIGHT-MVP.git
synced 2026-06-25 01:36:39 +02:00
Backend (CRM expert): Custom field definitions CRUD, bulk value upsert, 7 endpoints, Prisma schema with CustomFieldDef + CustomFieldValue tables. Frontend: Types, API, hooks, admin settings page with field management, CustomFieldsDisplay for detail pages, CustomFieldsForm for edit modals. Also fix Vite allowedHosts for insight.xinion.lan. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
// ============================================================
|
|
// DTO fuer Custom Fields — Werte setzen (Bulk-Upsert)
|
|
// ============================================================
|
|
|
|
import { IsArray, IsUUID, ValidateNested } from 'class-validator';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
|
|
export class CustomFieldValueItemDto {
|
|
@ApiProperty({ format: 'uuid', description: 'ID der Feld-Definition' })
|
|
@IsUUID()
|
|
fieldDefId!: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Wert: string | number | boolean | string[] | null',
|
|
oneOf: [
|
|
{ type: 'string' },
|
|
{ type: 'number' },
|
|
{ type: 'boolean' },
|
|
{ type: 'array', items: { type: 'string' } },
|
|
{ nullable: true },
|
|
],
|
|
})
|
|
// HINWEIS: Keine class-validator Dekoration fuer value, da Union-Type.
|
|
// Validierung gegen fieldType erfolgt im Service.
|
|
value!: string | number | boolean | string[] | null;
|
|
}
|
|
|
|
export class SetCustomFieldValuesDto {
|
|
@ApiProperty({ type: [CustomFieldValueItemDto], description: 'Alle Werte fuer eine Entity' })
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => CustomFieldValueItemDto)
|
|
values!: CustomFieldValueItemDto[];
|
|
}
|