mirror of
https://github.com/chenasraf/pantry-flutter.git
synced 2026-05-17 17:28:03 +00:00
chore: cleanups
This commit is contained in:
@@ -46,11 +46,7 @@ class CategoryService {
|
||||
}) async {
|
||||
return ApiClient.instance.patch<Map<String, dynamic>, Category>(
|
||||
'/houses/$houseId/categories/$categoryId',
|
||||
body: {
|
||||
if (name != null) 'name': name,
|
||||
if (icon != null) 'icon': icon,
|
||||
if (color != null) 'color': color,
|
||||
},
|
||||
body: {'name': ?name, 'icon': ?icon, 'color': ?color},
|
||||
fromJson: (data) => Category.fromJson(data),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -143,9 +143,9 @@ class ChecklistService {
|
||||
if (description != null && description.isNotEmpty)
|
||||
'description': description,
|
||||
if (quantity != null && quantity.isNotEmpty) 'quantity': quantity,
|
||||
if (categoryId != null) 'categoryId': categoryId,
|
||||
'categoryId': ?categoryId,
|
||||
if (rrule != null && rrule.isNotEmpty) 'rrule': rrule,
|
||||
if (deleteOnDone != null) 'deleteOnDone': deleteOnDone,
|
||||
'deleteOnDone': ?deleteOnDone,
|
||||
},
|
||||
fromJson: (data) => ListItem.fromJson(data),
|
||||
);
|
||||
@@ -167,15 +167,14 @@ class ChecklistService {
|
||||
return ApiClient.instance.patch<Map<String, dynamic>, ListItem>(
|
||||
'/houses/$houseId/lists/$listId/items/$itemId',
|
||||
body: {
|
||||
if (name != null) 'name': name,
|
||||
if (description != null) 'description': description,
|
||||
if (quantity != null) 'quantity': quantity,
|
||||
'name': ?name,
|
||||
'description': ?description,
|
||||
'quantity': ?quantity,
|
||||
if (clearCategory) 'categoryId': 0,
|
||||
if (!clearCategory && categoryId != null) 'categoryId': categoryId,
|
||||
if (rrule != null) 'rrule': rrule,
|
||||
if (repeatFromCompletion != null)
|
||||
'repeatFromCompletion': repeatFromCompletion,
|
||||
if (deleteOnDone != null) 'deleteOnDone': deleteOnDone,
|
||||
'rrule': ?rrule,
|
||||
'repeatFromCompletion': ?repeatFromCompletion,
|
||||
'deleteOnDone': ?deleteOnDone,
|
||||
},
|
||||
fromJson: (data) => ListItem.fromJson(data),
|
||||
);
|
||||
|
||||
@@ -51,11 +51,7 @@ class NoteService {
|
||||
}) async {
|
||||
return ApiClient.instance.post<Map<String, dynamic>, Note>(
|
||||
'/houses/$houseId/notes',
|
||||
body: {
|
||||
'title': title,
|
||||
if (content != null) 'content': content,
|
||||
if (color != null) 'color': color,
|
||||
},
|
||||
body: {'title': title, 'content': ?content, 'color': ?color},
|
||||
fromJson: (data) => Note.fromJson(data),
|
||||
);
|
||||
}
|
||||
@@ -69,11 +65,7 @@ class NoteService {
|
||||
}) async {
|
||||
return ApiClient.instance.patch<Map<String, dynamic>, Note>(
|
||||
'/houses/$houseId/notes/$noteId',
|
||||
body: {
|
||||
if (title != null) 'title': title,
|
||||
if (content != null) 'content': content,
|
||||
if (color != null) 'color': color,
|
||||
},
|
||||
body: {'title': ?title, 'content': ?content, 'color': ?color},
|
||||
fromJson: (data) => Note.fromJson(data),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class PhotoService {
|
||||
return ApiClient.instance.patch<Map<String, dynamic>, Photo>(
|
||||
'/houses/$houseId/photos/$photoId',
|
||||
body: {
|
||||
if (caption != null) 'caption': caption,
|
||||
'caption': ?caption,
|
||||
if (moveToRoot) 'folderId': 0,
|
||||
if (!moveToRoot && folderId != null) 'folderId': folderId,
|
||||
},
|
||||
@@ -155,7 +155,7 @@ class PhotoService {
|
||||
}) async {
|
||||
return ApiClient.instance.patch<Map<String, dynamic>, PhotoFolder>(
|
||||
'/houses/$houseId/photos/folders/$folderId',
|
||||
body: {if (name != null) 'name': name},
|
||||
body: {'name': ?name},
|
||||
fromJson: (data) => PhotoFolder.fromJson(data),
|
||||
);
|
||||
}
|
||||
@@ -203,10 +203,7 @@ class PhotoService {
|
||||
}) async {
|
||||
await ApiClient.instance.put<Map<String, dynamic>, void>(
|
||||
'/houses/$houseId/prefs',
|
||||
body: {
|
||||
if (photoSort != null) 'photoSort': photoSort,
|
||||
if (photoFoldersFirst != null) 'photoFoldersFirst': photoFoldersFirst,
|
||||
},
|
||||
body: {'photoSort': ?photoSort, 'photoFoldersFirst': ?photoFoldersFirst},
|
||||
fromJson: (_) {},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: avoid_print
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
/// Replaces YAML unicode escape sequences (\uXXXX, \xXX) with actual UTF-8
|
||||
|
||||
Reference in New Issue
Block a user