mirror of
https://github.com/rowyio/rowy.git
synced 2026-01-06 12:26:34 +01:00
CF synonm access to doc id
This commit is contained in:
@@ -18,26 +18,6 @@ const cohort2algoliaKey = (cohort: string) =>
|
||||
const cohort2region = (cohort: string) =>
|
||||
cohort.toUpperCase().replace(/\d+.*$/, "");
|
||||
|
||||
// const location2region = (location: string) => {
|
||||
// const _location = location.toUpperCase();
|
||||
// switch (_location) {
|
||||
// case "GLOBAL":
|
||||
// return "GLOBAL";
|
||||
// case "SYDNEY":
|
||||
// return "SYD";
|
||||
// case "LONDON":
|
||||
// return "LON";
|
||||
// case "SINGAPORE":
|
||||
// return "SG";
|
||||
// case "AMSTERDAM":
|
||||
// return "AMS";
|
||||
// case 'OSLO': return 'OSL'
|
||||
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// };
|
||||
|
||||
const cohort2location = (cohort: string) => {
|
||||
const _region = cohort2region(cohort);
|
||||
switch (_region) {
|
||||
@@ -90,6 +70,21 @@ const config = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "icManagement",
|
||||
groups: [
|
||||
{
|
||||
listenerField: "cohort",
|
||||
synonymField: "region",
|
||||
transformer: cohort2region,
|
||||
},
|
||||
{
|
||||
listenerField: "cohort",
|
||||
synonymField: "algoliaKey",
|
||||
transformer: cohort2algoliaKey,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "portfolio",
|
||||
groups: [
|
||||
@@ -105,10 +100,24 @@ const config = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "teams",
|
||||
groups: [
|
||||
{
|
||||
listenerField: "cohort",
|
||||
synonymField: "region",
|
||||
transformer: cohort2region,
|
||||
},
|
||||
{
|
||||
listenerField: "id",
|
||||
synonymField: "ddPage",
|
||||
transformer: id => `https://firepage.antler.co/DD?id=${id}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
...cohort2regionCollections([
|
||||
"hubResources",
|
||||
"profiles",
|
||||
"teams",
|
||||
"sprintSubmissions",
|
||||
"trackoutApplications",
|
||||
"portfolioEnquiries",
|
||||
|
||||
@@ -36,7 +36,7 @@ const addSynonymOnUpdate = (groups: synonymGroup[]) => (
|
||||
if (!beforeData || !afterData) {
|
||||
return false;
|
||||
}
|
||||
const updates = synonyms(afterData, groups);
|
||||
const updates = synonyms({ ...afterData, id: change.after.id }, groups);
|
||||
if (Object.values(updates).length === 0) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -52,7 +52,7 @@ const addSynonymOnCreate = (groups: synonymGroup[]) => (
|
||||
if (!docData) {
|
||||
return false;
|
||||
}
|
||||
const updates = synonyms(docData, groups);
|
||||
const updates = synonyms({ ...docData, id: snapshot.id }, groups);
|
||||
if (Object.keys(updates).length === 0) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user