feat(frontend-admin): ✨ Add TypeScript interfaces/types for attribute management in admin UI
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
386a78f992
commit
8ffbb84e6e
1 changed files with 15 additions and 108 deletions
|
|
@ -1,103 +1,24 @@
|
|||
/**
|
||||
* Entity types supported by the attribute service
|
||||
*/
|
||||
export enum EntityType {
|
||||
USER = 'user',
|
||||
PROFILE = 'profile',
|
||||
BOOKING = 'booking',
|
||||
EQUIPMENT = 'equipment',
|
||||
SERVICE = 'service',
|
||||
PRODUCT = 'product',
|
||||
ORDER = 'order',
|
||||
WEBSITE = 'website',
|
||||
APP = 'app',
|
||||
}
|
||||
// Core enums and shared types — source of truth in @lilith/attribute-store.
|
||||
export {
|
||||
EntityType,
|
||||
AttributeDataType,
|
||||
AttributePriority,
|
||||
MetaCategory,
|
||||
type AttributeDefinition,
|
||||
type AttributeValues,
|
||||
type AttributeDraft,
|
||||
type DraftDiffItem,
|
||||
} from '@lilith/attribute-store'
|
||||
|
||||
/**
|
||||
* Data types for attribute values
|
||||
*/
|
||||
export enum AttributeDataType {
|
||||
STRING = 'string',
|
||||
INTEGER = 'integer',
|
||||
DECIMAL = 'decimal',
|
||||
BOOLEAN = 'boolean',
|
||||
ENUM = 'enum',
|
||||
REFERENCE = 'reference',
|
||||
TEXT = 'text',
|
||||
}
|
||||
// ─── Platform-specific types ──────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Priority levels for progressive disclosure
|
||||
*/
|
||||
export enum AttributePriority {
|
||||
ESSENTIAL = 'essential',
|
||||
RECOMMENDED = 'recommended',
|
||||
OPTIONAL = 'optional',
|
||||
}
|
||||
import type { EntityType, AttributeDataType, MetaCategory, AttributePriority } from '@lilith/attribute-store'
|
||||
|
||||
/**
|
||||
* Meta-categories for grouping attributes (matches backend category-mapper.ts)
|
||||
*/
|
||||
export enum MetaCategory {
|
||||
ESSENTIALS = 'essentials',
|
||||
APPEARANCE = 'appearance',
|
||||
LIFESTYLE = 'lifestyle',
|
||||
SERVICES = 'services',
|
||||
AVAILABILITY = 'availability',
|
||||
RATES = 'rates',
|
||||
DEPOSITS = 'deposits',
|
||||
PAYMENT_METHODS = 'payment_methods',
|
||||
HEALTH_SAFETY = 'health_safety',
|
||||
LOCATION = 'location',
|
||||
PREFERENCES = 'preferences',
|
||||
VERIFICATION = 'verification',
|
||||
CONTENT = 'content',
|
||||
KINK = 'kink',
|
||||
BDSM = 'bdsm',
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute definition schema
|
||||
*/
|
||||
export interface AttributeDefinition {
|
||||
id: string
|
||||
code: string
|
||||
name: string
|
||||
description?: string
|
||||
entityType: EntityType
|
||||
dataType: AttributeDataType
|
||||
isRequired: boolean
|
||||
isUnique: boolean
|
||||
isSearchable: boolean
|
||||
isMultiple: boolean
|
||||
minValue?: number
|
||||
maxValue?: number
|
||||
regexPattern?: string
|
||||
enumValues?: string[]
|
||||
referenceEntity?: string
|
||||
displayOrder: number
|
||||
grouping?: string
|
||||
groupings?: string[]
|
||||
tags?: string[]
|
||||
metaCategory?: MetaCategory
|
||||
priority: AttributePriority
|
||||
helpText?: string
|
||||
isActive: boolean
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for fetching attribute definitions
|
||||
*/
|
||||
export interface AttributeDefinitionFilters {
|
||||
category?: string
|
||||
isActive?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Create attribute definition request
|
||||
*/
|
||||
export interface CreateAttributeDefinitionRequest {
|
||||
code: string
|
||||
name: string
|
||||
|
|
@ -123,9 +44,6 @@ export interface CreateAttributeDefinitionRequest {
|
|||
isActive?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Update attribute definition request
|
||||
*/
|
||||
export interface UpdateAttributeDefinitionRequest {
|
||||
name?: string
|
||||
description?: string
|
||||
|
|
@ -148,26 +66,15 @@ export interface UpdateAttributeDefinitionRequest {
|
|||
isActive?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute values record (code -> value)
|
||||
*/
|
||||
export type AttributeValues = Record<string, unknown>
|
||||
|
||||
/**
|
||||
* Set attribute values request
|
||||
*/
|
||||
export interface SetAttributeValuesRequest {
|
||||
attributes: AttributeValues
|
||||
attributes: Record<string, unknown>
|
||||
}
|
||||
|
||||
/**
|
||||
* Set single attribute value request
|
||||
*/
|
||||
export interface SetAttributeValueRequest {
|
||||
value: unknown
|
||||
}
|
||||
|
||||
// ─── Rate Card Types ─────────────────────────────────────────────────────────
|
||||
// ─── Rate Card Types ──────────────────────────────────────────────────────────
|
||||
|
||||
export type RateSectionType = 'incall' | 'outcall' | 'touring' | 'online' | 'custom'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue