File tree Expand file tree Collapse file tree
integrations/directus/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @replexica/integration-directus " : patch
3+ ---
4+
5+ Update primary key selection
Original file line number Diff line number Diff line change @@ -61,14 +61,17 @@ export default defineOperationApi<Options>({
6161 const languagesService = new ItemsService ( language_table , { schema } ) ;
6262 const translationsService = new ItemsService ( translation_table , { schema } ) ;
6363
64+ // Get the primary key field for the collection
65+ const collection_pk = schema . collections [ collection ] . primary ;
66+
6467 // Get collection fields and their types
6568 const collectionFields = schema . collections [ translation_table ] . fields ;
6669
6770 // Get all existing translations for this item
6871 const existingTranslations = await translationsService . readByQuery ( {
6972 fields : [ '*' ] ,
7073 filter : {
71- [ `${ collection } _id ` ] : { _eq : item_id }
74+ [ `${ collection } _ ${ collection_pk } ` ] : { _eq : item_id }
7275 }
7376 } ) ;
7477
@@ -189,7 +192,7 @@ export default defineOperationApi<Options>({
189192 result = await translationsService . createOne ( {
190193 ...translatedData ,
191194 languages_code : language . code ,
192- [ `${ collection } _id ` ] : item_id
195+ [ `${ collection } _ ${ collection_pk } ` ] : item_id
193196 } ) ;
194197 }
195198
You can’t perform that action at this time.
0 commit comments