{"version":3,"file":"translations.mjs","names":[],"sources":["../../../../../../src/astro/routes/api/relations/[id]/translations.ts"],"sourcesContent":["/**\n * Relation translations endpoint\n *\n * GET /_emdash/api/relations/:id/translations - List locale siblings of a relation\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, handleError, requireDb, unwrapResult } from \"#api/error.js\";\nimport { handleRelationTranslations } from \"#api/handlers/relations.js\";\n\nexport const prerender = false;\n\nexport const GET: APIRoute = async ({ params, locals }) => {\n\tconst { emdash, user } = locals;\n\tconst { id } = params;\n\n\tconst dbErr = requireDb(emdash?.db);\n\tif (dbErr) return dbErr;\n\n\tconst denied = requirePerm(user, \"schema:read\");\n\tif (denied) return denied;\n\n\tif (!id) return apiError(\"VALIDATION_ERROR\", \"Relation id required\", 400);\n\n\ttry {\n\t\tconst result = await handleRelationTranslations(emdash.db, id);\n\t\treturn unwrapResult(result);\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to get translations\", \"RELATION_TRANSLATIONS_ERROR\");\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,MAAa,YAAY;AAEzB,MAAa,MAAgB,OAAO,EAAE,QAAQ,aAAa;CAC1D,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,OAAO;CAEf,MAAM,QAAQ,UAAU,QAAQ,GAAG;AACnC,KAAI,MAAO,QAAO;CAElB,MAAM,SAAS,YAAY,MAAM,cAAc;AAC/C,KAAI,OAAQ,QAAO;AAEnB,KAAI,CAAC,GAAI,QAAO,SAAS,oBAAoB,wBAAwB,IAAI;AAEzE,KAAI;AAEH,SAAO,aADQ,MAAM,2BAA2B,OAAO,IAAI,GAAG,CACnC;UACnB,OAAO;AACf,SAAO,YAAY,OAAO,8BAA8B,8BAA8B"}