feat: add editing capability

This commit is contained in:
2025-09-04 12:51:43 -03:00
parent 07eba9b64a
commit 261528f329
5 changed files with 150 additions and 13 deletions
+20
View File
@@ -98,6 +98,26 @@ export class AppwriteDB {
}
}
// Upadte food entry
static async updateFoodEntry(documentId: string, entryData: Partial<FoodStorage>) {
try {
const response = await databases.updateDocument(
DATABASE_ID,
FOOD_ENTRIES_COLLECTION_ID,
documentId,
{
...entryData,
userId: (await account.get()).$id,
}
);
console.debug('Food entry updated:', response);
return response;
} catch (error) {
console.error('Update food entry error:', error);
throw error;
}
}
// Save food entry
static async saveUserSettings(userSettings: UserSettings) {
try {