This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { FieldWithPath } from '../../../..' | |
import array from './Array' | |
import blocks from './Blocks' | |
import checkbox from './Checkbox' | |
import code from './Code' | |
import collapsible from './Collapsible' | |
import confirmPassword from './ConfirmPassword' | |
import date from './DateTime' | |
import email from './Email' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { Where } from '../../../../types'; | |
export const simplifyWhereQuery = (whereQuery: Where): Where => { | |
if (!whereQuery?.or) { | |
return whereQuery; | |
} | |
// Filter out {} values from 'or' array. | |
const orArray = whereQuery.or.filter((obj) => Object.keys(obj).length !== 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id":{ | |
"$oid":"64b9b54c97eea491d64e5630" | |
}, | |
"summary":"Be2 anmeldelse og test (2023) - Er Be2 en svindel?:", | |
"trigger_hooks":false, | |
"passthrough":{ | |
"document_locale":"no-NO", | |
"niches":[ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qs from 'qs'; | |
export const cmsURL = "cms URL without the / at the end"; | |
export const apiKey = "yourAPIkey"; | |
export async function getDocuments (collectionName: string, whereQuery?) { | |
if (whereQuery) { | |
const stringifiedQuery = qs.stringify({ | |
where: whereQuery | |
}, { addQueryPrefix: true }); |