cambiar campo color categoria
Despliegue Automático / desplegar (push) Successful in 1m17s

This commit is contained in:
2026-08-17 18:39:33 +02:00
parent e0de5c92b5
commit ded4c8fc03
3 changed files with 4 additions and 8 deletions
+1 -4
View File
@@ -2,10 +2,7 @@ const sequelize = require('./config/database');
async function initDB() {
try {
// IMPORTANTISIMO: En producción, no uses force: true porque borrará todas las tablas y datos. Solo úsalo en desarrollo.
await sequelize.sync({ force: true }); // Borra y recrea las tablas en cada inicio (útil para desarrollo, no recomendado en producción)
//
await sequelize.sync({ alter: true });
console.log('✅ Base de datos conectada y tablas sincronizadas.');
+1 -1
View File
@@ -13,7 +13,7 @@ const Category = sequelize.define('Category', {
allowNull: false
},
colorValue: {
type: DataTypes.INTEGER,
type: DataTypes.BIGINT,
allowNull: true
},
iconCodePoint: {
+1 -2
View File
@@ -14,7 +14,7 @@ const isValidDate = (value) => {
const normalizeCategory = (category) => ({
id: category.id,
encrypted_name: category.encrypted_name,
colorValue: category.colorValue ?? null,
colorValue: category.colorValue ? parseInt(category.colorValue, 10) : null,
iconCodePoint: category.iconCodePoint ?? null,
delete: Boolean(category.delete),
serverVersion: category.serverVersion || 1,
@@ -24,7 +24,6 @@ const normalizeCategory = (category) => ({
const normalizeNote = (note) => ({
id: note.id,
// 👇 Convertimos la relación de Sequelize en un array simple de IDs de categorías
categoryIds: note.Categories ? note.Categories.map(c => c.id) : [],
title: note.title,
body: note.body,