@access-dlsu/leapify 0.260604.1 → 0.260605.1

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 CHANGED
@@ -1133,6 +1133,14 @@ var classesRoute = new Hono();
1133
1133
  function generateSlug(title) {
1134
1134
  return title.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1135
1135
  }
1136
+ function serializeEvent(event) {
1137
+ if (!event) return event;
1138
+ const { dateTime, ...rest } = event;
1139
+ return { ...rest, date: dateTime };
1140
+ }
1141
+ function serializeEvents(events2) {
1142
+ return events2.map(serializeEvent);
1143
+ }
1136
1144
  classesRoute.get(
1137
1145
  "/admin",
1138
1146
  describeRoute({
@@ -1148,7 +1156,7 @@ classesRoute.get(
1148
1156
  with: { theme: true, organization: true },
1149
1157
  orderBy: (e, { desc }) => [desc(e.createdAt)]
1150
1158
  });
1151
- return c.json({ data });
1159
+ return c.json({ data: serializeEvents(data) });
1152
1160
  }
1153
1161
  );
1154
1162
  classesRoute.post(
@@ -1250,7 +1258,7 @@ classesRoute.get(
1250
1258
  "Cache-Control",
1251
1259
  "public, max-age=604800, stale-while-revalidate=86400"
1252
1260
  );
1253
- return c.json({ data });
1261
+ return c.json({ data: serializeEvents(data) });
1254
1262
  }
1255
1263
  );
1256
1264
  classesRoute.get(
@@ -1273,7 +1281,7 @@ classesRoute.get(
1273
1281
  }
1274
1282
  });
1275
1283
  if (!event) throw notFound("Event");
1276
- return c.json({ data: event });
1284
+ return c.json({ data: serializeEvent(event) });
1277
1285
  }
1278
1286
  );
1279
1287
  classesRoute.get(
@@ -1377,7 +1385,7 @@ classesRoute.post(
1377
1385
  cache.del(EVENTS_LIST_KV_KEY),
1378
1386
  cache.del(EVENTS_ETAG_KV_KEY)
1379
1387
  ]);
1380
- return c.json({ data: created }, 201);
1388
+ return c.json({ data: serializeEvent(created) }, 201);
1381
1389
  }
1382
1390
  );
1383
1391
  classesRoute.patch(
@@ -1407,7 +1415,7 @@ classesRoute.patch(
1407
1415
  cache.del(EVENTS_LIST_KV_KEY),
1408
1416
  cache.del(EVENTS_ETAG_KV_KEY)
1409
1417
  ]);
1410
- return c.json({ data: updated });
1418
+ return c.json({ data: serializeEvent(updated) });
1411
1419
  }
1412
1420
  );
1413
1421
  classesRoute.delete(
@@ -2455,7 +2463,7 @@ function createApp(options = {}) {
2455
2463
  documentation: {
2456
2464
  info: {
2457
2465
  title: "Leapify API",
2458
- version: "0.260602.1",
2466
+ version: "0.260605.1" ,
2459
2467
  description: "DLSU CSO LEAP backend API"
2460
2468
  },
2461
2469
  openapi: "3.1.0"
@@ -3105,7 +3113,7 @@ function defaultGetRuntimeConfig(env) {
3105
3113
  };
3106
3114
  }
3107
3115
  function injectConfig(html, config) {
3108
- const configScript = `<script>window.__CONFIG__=${JSON.stringify(config)};</script>`;
3116
+ const configScript = `<script>window.__CONFIG__=${JSON.stringify(config)};<\/script>`;
3109
3117
  return html.replace("</head>", `${configScript}</head>`);
3110
3118
  }
3111
3119
  function createWorkerHandler(options) {
@@ -3227,10 +3235,10 @@ function getRuntimeConfig(env) {
3227
3235
  };
3228
3236
  }
3229
3237
  function injectConfig2(html, config) {
3230
- const configScript = `<script>window.__CONFIG__=${JSON.stringify(config)};</script>`;
3238
+ const configScript = `<script>window.__CONFIG__=${JSON.stringify(config)};<\/script>`;
3231
3239
  return html.replace("</head>", `${configScript}</head>`);
3232
3240
  }
3233
3241
 
3234
3242
  export { authAccount, authSession, authUser, authVerification, bookmarks, bookmarksRelations, createDb, createLeapify, createQueueHandler, createWorkerHandler, ensureDatabase, events, eventsRelations, faqs, getRuntimeConfig, injectConfig2 as injectConfig, organizations, organizationsRelations, siteConfig, themes, themesRelations, users };
3235
3243
  //# sourceMappingURL=index.js.map
3236
- //# sourceMappingURL=index.js.mapap
3244
+ //# sourceMappingURL=index.js.map