feat: diary

This commit is contained in:
Alex
2024-11-30 13:44:26 +03:00
parent 235d9fa08e
commit 06e8336cd3
14 changed files with 574 additions and 396 deletions

View File

@@ -21,7 +21,7 @@ class DiaryRepository {
}
Future<NutritionDataModel> getNutritionData(int index) async {
return await diaryService.getNutrition(index: index);
return await diaryService.getNutrition(diary: index);
}
Future<void> addPortionToMeal({
@@ -32,8 +32,8 @@ class DiaryRepository {
required int quantity,
}) async {
return await diaryService.addProductToMeal(
diaryId: diaryId,
mealId: mealId,
diary: diaryId,
typeNo: mealId,
productName: productName,
portion: portion,
quantity: quantity,
@@ -49,9 +49,9 @@ class DiaryRepository {
required int quantity,
}) async {
return await diaryService.updateProductInMeal(
diaryId: diaryId,
mealId: mealId,
portionId: portionId,
diary: diaryId,
typeNo: mealId,
portionModel: portionId,
productInMeal: ProductInMeal(
productName: productName,
portion: portion,
@@ -66,9 +66,9 @@ class DiaryRepository {
required int portionId,
}) async {
return await diaryService.deleteProductFromMeal(
diaryId: diaryId,
mealId: mealId,
portionId: portionId,
diary: diaryId,
typeNo: mealId,
portionModel: portionId,
);
}
@@ -80,8 +80,8 @@ class DiaryRepository {
try {
for (int i = 0; i < files.length; i++) {
await diaryService.uploadPhotoOfMeal(
diaryId: diaryId,
mealId: mealId,
diary: diaryId,
typeNo: mealId,
photo: files[i],
);
}
@@ -98,9 +98,8 @@ class DiaryRepository {
try {
await diaryService.deletePhotoOfMeal(
diaryId: diaryId,
mealId: mealId,
id: photo.id,
path: photo.path,
typeNo: mealId,
userAttachment: photo.id,
);
} catch (e) {
rethrow;
@@ -114,7 +113,7 @@ class DiaryRepository {
required String comment,
}) async {
return await diaryService.finishDiaryDay(
diaryId: diaryId,
diary: diaryId,
finishDiaryDayModel: FinishDiaryDayModel(
wakeUp: wakeUp,
retire: retire,
@@ -143,11 +142,31 @@ class DiaryRepository {
Future<void> fillSatiety({
required int diaryId,
required int meal,
required int mealId,
required int satiety,
}) async {
try {
return await diaryService.fillSatiety(diaryId: diaryId, meal: meal, satiety: satiety);
return await diaryService.fillSatiety(
diary: diaryId,
typeNo: mealId,
satiety: satiety,
);
} catch (e) {
rethrow;
}
}
Future<void> fillTime({
required int diaryId,
required int mealId,
required String time,
}) async {
try {
return await diaryService.fillTime(
diary: diaryId,
typeNo: mealId,
time: time,
);
} catch (e) {
rethrow;
}