Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Commit

Permalink
fix: minor bugs spotted in production [skip CI]
Browse files Browse the repository at this point in the history
  • Loading branch information
vecna committed Sep 14, 2022
1 parent 63a32b7 commit 51607e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions platforms/tktrex/backend/routes/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { SEARCH_FIELDS } from './public';
import D from 'debug';
const debug = D('routes:search');

function flattenSearch(memo, metasearch) {
export function flattenSearch(memo, metasearch) {
// function invoked to depack and flatten metadata {type: search}
// to produce CSV.

Expand Down Expand Up @@ -56,7 +56,7 @@ function flattenSearch(memo, metasearch) {
return memo;
}

function flattenProfile(memo, metaprofile) {
export function flattenProfile(memo, metaprofile) {
// function invoked to depack and flatten metadata {type: search}
// to produce CSV.

Expand Down Expand Up @@ -99,7 +99,7 @@ function flattenProfile(memo, metaprofile) {
return memo;
}

function flattenNative({
export function flattenNative({
nature,
music,
author,
Expand All @@ -117,7 +117,7 @@ function flattenNative({
};
}

async function getSearchByQuery(req) {
export async function getSearchByQuery(req) {
// /api/v2/query/<param>/<json|csv>

const amount = 200;
Expand Down
10 changes: 6 additions & 4 deletions platforms/yttrex/backend/routes/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function processHeaders(received, headerList) {
const h = _.get(received, headerName, undefined);
if (!h && headInfo.mandatory === true)
errors.push(`missing header [${headerName}, we use as ${headInfo.name}]`);
else if (h.length) _.set(headers, headInfo.name, h);
else if (h && h.length) _.set(headers, headInfo.name, h);
else {
missing.push(
`missing optional header [${headerName}], setting null [${headInfo.name}]`
Expand Down Expand Up @@ -183,6 +183,11 @@ async function processEvents2(req) {
/* this function process the received payload,
* and produce the object to be saved into mongodb */

// appendLast enable the mirror functionality, it is
// before any validation so we can test also submissions
// failing the next steps
appendLast(req);

const headers = processHeaders(req.headers, EXPECTED_HEADERS);
if (headers.error?.length) {
debug(
Expand Down Expand Up @@ -214,9 +219,6 @@ async function processEvents2(req) {

const supporter = await automo.tofu(headers.publickey, headers.version);

// this is necessary for the mirror functionality
appendLast(req);

// this information would be merged in htmls and leafs if exist
const experinfo = await automo.pullExperimentInfo(supporter.publicKey);
// experinfo is an aggregation from collection 'experiments' and
Expand Down

0 comments on commit 51607e0

Please sign in to comment.