backend & types

This commit is contained in:
2024-01-27 18:58:35 +00:00
parent 91bfa0864d
commit 0b4a474180
219 changed files with 5211 additions and 12325 deletions

View File

@@ -1,20 +1,8 @@
const publishedFilter = {
$or: [
{ publishDate: { $exists: false } },
{ publishDate: null },
{
publishDate: { $lte: { $date: new Date().toISOString() } },
// publishDate: { $lte: new Date() },
},
],
}
const apiSsrBaseURL = "http://localhost:8080/api/v1/_/demo/"
const apiSsrBaseURL = "http://localhost:8080/api/v1/_/allkids_erfurt"
module.exports = {
publishedFilter,
apiSsrBaseURL,
ssrValidatePath: function (/** @type {string} */ path) {
ssrValidatePath: function (path) {
// validate if path ssr rendering is ok, -1 = NOTFOUND, 0 = NO SSR, 1 = SSR
// pe. use context.readCollection("product", {filter: {path: path}}) ... to validate dynamic urls
@@ -22,16 +10,16 @@ module.exports = {
// if (path == "/") return 1
// // all other sites are in db
// path = path?.replace(/^\//, "")
// filter for path or alternativePaths
//path = path?.replace(/^\//, "")
console.log("PATH:", path)
const resp = context.db.find("content", {
filter: {
$and: [{ $or: [{ path }, { "alternativePaths.path": path }] }, publishedFilter],
$and: [{ path }],
},
selector: { _id: 1 },
})
console.log("RESP:", resp?.length)
if (resp && resp.length) {
return 1
}
@@ -40,4 +28,5 @@ module.exports = {
return -1
},
ssrPublishCheckCollections: ["content"],
LIGHTHOUSE_TOKEN: "AIzaSyC0UxHp3-MpJiDL3ws7pEV6lj57bfIc7GQ",
}