ponch-mcp-server 1.0.70 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2691,6 +2691,23 @@ async function contenidoUpdater(input) {
|
|
|
2691
2691
|
};
|
|
2692
2692
|
}
|
|
2693
2693
|
var CAMPOS_SEMANTICOS = ["keyword", "tema", "plataforma", "tipo"];
|
|
2694
|
+
function mapContenidoEstadoToSlotEstado(contenidoEstado) {
|
|
2695
|
+
switch (contenidoEstado) {
|
|
2696
|
+
case "pendiente_aprobacion":
|
|
2697
|
+
case "generado":
|
|
2698
|
+
case "editado":
|
|
2699
|
+
return "generado";
|
|
2700
|
+
case "aprobado":
|
|
2701
|
+
return "aprobado";
|
|
2702
|
+
case "publicado":
|
|
2703
|
+
return "publicado";
|
|
2704
|
+
case "rechazado":
|
|
2705
|
+
return "rechazado";
|
|
2706
|
+
// borrador + error_publicacion + estados desconocidos → no tocar slot
|
|
2707
|
+
default:
|
|
2708
|
+
return null;
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2694
2711
|
async function calendarSlotUpdater(input) {
|
|
2695
2712
|
const { db, tenantId, brandId, mes, semana, slotIndex, cambios, accionContenidoExistente } = input;
|
|
2696
2713
|
if (slotIndex < 0) {
|
|
@@ -2790,6 +2807,18 @@ async function calendarSlotUpdater(input) {
|
|
|
2790
2807
|
targetRef: `semana:${targetSemanaNum}:slot:${targetSlotIdx}`
|
|
2791
2808
|
};
|
|
2792
2809
|
}
|
|
2810
|
+
let movedSlotEstado = null;
|
|
2811
|
+
if (moveTarget && oldContenidoRef) {
|
|
2812
|
+
try {
|
|
2813
|
+
const contenidoSnap = await db.collection("marketing_contenido").doc(oldContenidoRef).get();
|
|
2814
|
+
if (contenidoSnap.exists) {
|
|
2815
|
+
const estadoContenido = contenidoSnap.data().estado;
|
|
2816
|
+
movedSlotEstado = mapContenidoEstadoToSlotEstado(estadoContenido);
|
|
2817
|
+
}
|
|
2818
|
+
} catch {
|
|
2819
|
+
movedSlotEstado = null;
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2793
2822
|
let resultAction;
|
|
2794
2823
|
let resultSlotIndex = slotIndex;
|
|
2795
2824
|
let movedTo;
|
|
@@ -2825,10 +2854,14 @@ async function calendarSlotUpdater(input) {
|
|
|
2825
2854
|
};
|
|
2826
2855
|
const targetSemana = freshSemanas[moveTarget.targetSemanaNum - 1];
|
|
2827
2856
|
const targetItems = targetSemana.items ?? [];
|
|
2857
|
+
const targetSlotActual = targetItems[moveTarget.targetSlotIdx];
|
|
2858
|
+
const targetEstadoActual = targetSlotActual.estado;
|
|
2859
|
+
const shouldUpdateEstado = movedSlotEstado !== null && targetEstadoActual !== "publicado";
|
|
2828
2860
|
targetItems[moveTarget.targetSlotIdx] = {
|
|
2829
|
-
...
|
|
2861
|
+
...targetSlotActual,
|
|
2830
2862
|
contenidoRef: oldContenidoRef,
|
|
2831
|
-
...oldFotoIdAsignada ? { fotoIdAsignada: oldFotoIdAsignada } : {}
|
|
2863
|
+
...oldFotoIdAsignada ? { fotoIdAsignada: oldFotoIdAsignada } : {},
|
|
2864
|
+
...shouldUpdateEstado ? { estado: movedSlotEstado } : {}
|
|
2832
2865
|
};
|
|
2833
2866
|
targetSemana.items = targetItems;
|
|
2834
2867
|
freshSemanas[moveTarget.targetSemanaNum - 1] = targetSemana;
|