import{CatalogEntitiesService as c}from"../../../plugins/catalog-entities/database/catalog-entities-service.js";import{createPaginationParamsValidator as y}from"../../../providers/database/pagination/schemas.js";const m=["type","key","title","summary","tags","metadata","metadata.*","git","contact","links","id","source","sourceFile","createdAt","updatedAt","domains","owners"];function u(n){return async t=>{const e=await c.getInstance({baseDbDir:n.serverOutDir}),a=t.req.param("entityKey");if(!a){const r=t.req.query(),s=y(m).parse(r),o=await e.getEntitiesWithRelations(s);return t.json(o)}const i=await e.getEntityWithRelationsByKey(a);return i?t.json(i):t.json({message:"Entity not found"},404)}}export{u as bffCatalogHandler};
