Ignore:
Timestamp:
12/29/25 03:57:02 (6 months ago)
Author:
Tome <gjorgievtome@…>
Branches:
main
Children:
f46bf5c
Parents:
3870834
Message:

Implement getDetailsForNewComponent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • database/drizzle/util/componentFieldConfig.ts

    r3870834 rdda6f51  
    108108    return true;
    109109}
    110 
    111 export function getValidationError(type: string, specificData: any): string | null {
    112     if (!(type in requiredFields)) {
    113         return `Invalid component type: ${type}`;
    114     }
    115 
    116     const fields = requiredFields[type as ComponentType];
    117     const missingFields: string[] = [];
    118 
    119     for (const field of fields) {
    120         const value = specificData[field];
    121         if (value === undefined || value === null || value === '') {
    122             missingFields.push(field);
    123         }
    124     }
    125 
    126     if (missingFields.length > 0) {
    127         return `Missing required fields: ${missingFields.join(', ')}`;
    128     }
    129 
    130     return null;
    131 }
Note: See TracChangeset for help on using the changeset viewer.