fix(entity): correctly parse checkbox to boolean to prevent appwrite schema validation crash
This commit is contained in:
parent
242ea2f60f
commit
2ee9bd00df
@ -47,9 +47,15 @@ export async function updateEntityConfig(data: any) {
|
||||
let parsedData: any = data;
|
||||
if (typeof FormData !== 'undefined' && data instanceof FormData) {
|
||||
parsedData = {};
|
||||
|
||||
// Los checkboxes no vienen en el FormData si no están marcados.
|
||||
// Manejamos explícitamente los booleanos conocidos aquí para que puedan actualizarse a false,
|
||||
// y para que se envíen como boolean en lugar de string "true".
|
||||
parsedData['mostrar_texto_logo'] = data.has('mostrar_texto_logo');
|
||||
|
||||
for (const [key, value] of Array.from(data.entries())) {
|
||||
// Ignorar claves internas de Next.js y Appwrite
|
||||
if (key.startsWith('$ACTION') || key === '$id' || key === '$collectionId' || key === '$databaseId') {
|
||||
// Ignorar claves tratadas explícitamente y claves internas
|
||||
if (key === 'mostrar_texto_logo' || key.startsWith('$ACTION') || key === '$id' || key === '$collectionId' || key === '$databaseId') {
|
||||
continue;
|
||||
}
|
||||
if (typeof value === 'object' && 'size' in value && 'name' in value) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user