Im currently trying to implement functionality that deletes all translations within a project when a user deletes a project. However, when i try to call my deleteTranslations function within my deleteProject function, it says deleteTranslations is not defined.
deleteTranslations: async ({ user, projectId, trkeys }) => {
const deletePromises = trkeys.map(async (trkey) => {
const params = {
...getBaseParams(),
Key: {
PK: getPK('trans', user, projectId),
SK: getSK('trans', user, projectId, trkey),
},
};
return doDelete(params);
});
return Promise.all(deletePromises);
},
deleteProject: async ({ user, project }) => {
const translationsParams = {
user,
projectId: project,
trkeys: [],
};
await deleteTranslations(translationsParams); // the problem is here
const params = {
TableName: table,
Key: {
PK: getPK('project', user),
SK: getSK('project', user, project),
},
};
return doDelete(params);
},
Ive tried to implement this in a few ways but i cant wrap my head around this.