debug: temporary tags debug endpoint
This commit is contained in:
parent
a3b6d7f425
commit
d7e195c0b3
|
|
@ -337,6 +337,26 @@ routes.get("/api/events", async (c) => {
|
||||||
return c.json({ count: rows.length, results: rows });
|
return c.json({ count: rows.length, results: rows });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// DEBUG: raw Automerge event data (temporary)
|
||||||
|
routes.get("/api/events-debug", async (c) => {
|
||||||
|
const space = c.req.param("space") || "demo";
|
||||||
|
const dataSpace = c.get("effectiveSpace") || space;
|
||||||
|
const doc = ensureDoc(dataSpace);
|
||||||
|
const events = Object.values(doc.events).slice(0, 3);
|
||||||
|
const raw = events.map((e) => ({
|
||||||
|
title: e.title,
|
||||||
|
tags_value: e.tags,
|
||||||
|
tags_type: typeof e.tags,
|
||||||
|
tags_truthy: !!e.tags,
|
||||||
|
tags_isArray: Array.isArray(e.tags),
|
||||||
|
tags_json: JSON.stringify(e.tags),
|
||||||
|
tags_arrayFrom: e.tags ? Array.from(e.tags) : 'WAS_FALSY',
|
||||||
|
has_tags_key: 'tags' in e,
|
||||||
|
all_keys: Object.keys(e),
|
||||||
|
}));
|
||||||
|
return c.json(raw);
|
||||||
|
});
|
||||||
|
|
||||||
// POST /api/events — create event
|
// POST /api/events — create event
|
||||||
routes.post("/api/events", async (c) => {
|
routes.post("/api/events", async (c) => {
|
||||||
const token = extractToken(c.req.raw.headers);
|
const token = extractToken(c.req.raw.headers);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue