MCPcopy Create free account
hub / github.com/axe-api/axe-api / getSearchData

Function getSearchData

packages/axe-api/src/Handlers/Helpers.ts:688–715  ·  view source on GitHub ↗
(
  model: IModelService,
  item: any,
)

Source from the content-addressed store, hash-verified

686};
687
688export const getSearchData = (
689 model: IModelService,
690 item: any,
691): Record<string, any> => {
692 const result: Record<string, any> = {};
693
694 if (model.instance.search) {
695 for (const field of model.instance.search) {
696 result[field] = item[field];
697 }
698 }
699
700 // If there is a deleted at column, we should put it to the index data
701 if (model.instance.deletedAtColumn) {
702 result[model.instance.deletedAtColumn] =
703 item[model.instance.deletedAtColumn];
704 }
705
706 // We should add the parent relations if there is any
707 const relations = model.relations.filter(
708 (relation) => relation.type === Relationships.HAS_ONE,
709 );
710 for (const relation of relations) {
711 result[relation.foreignKey] = item[relation.foreignKey];
712 }
713
714 return result;
715};

Callers 3

ActionPhase.tsFile · 0.90
ActionPhase.tsFile · 0.90
ActionPhase.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected