41ae7d4d06
- Implemented functionality to set recipe visibility (public/private) with appropriate checks for user permissions. - Added ability to share recipes with other users, including validation for existing users and permissions. - Introduced new DTOs for setting visibility and sharing recipes. - Updated RecipesController and RecipesService to handle new endpoints for visibility and sharing. - Enhanced inventory preview to consider user permissions and shared recipes. - Updated front-end to support new sharing and visibility features, including UI changes for recipe detail and admin user management.
78 lines
2.9 KiB
Dart
78 lines
2.9 KiB
Dart
class AuthApiPaths {
|
|
static const login = '/auth/login';
|
|
}
|
|
|
|
class ProductApiPaths {
|
|
static const list = '/products';
|
|
static const mine = '/products/mine';
|
|
static const createPrivate = '/products/private';
|
|
static const pending = '/products/pending';
|
|
static const aiCategorizeBulk = '/products/ai-categorize-bulk';
|
|
static const deleted = '/products/deleted';
|
|
static const merge = '/products/merge';
|
|
static String setStatus(int id) => '/products/$id/status';
|
|
static String update(int id) => '/products/$id';
|
|
static String remove(int id) => '/products/$id';
|
|
static String restore(int id) => '/products/$id/restore';
|
|
static const bulkUpdate = '/products/bulk-update';
|
|
}
|
|
|
|
class AiApiPaths {
|
|
static const models = '/ai/models';
|
|
}
|
|
|
|
class CategoryApiPaths {
|
|
static const tree = '/categories/tree';
|
|
}
|
|
|
|
class RecipeApiPaths {
|
|
static const list = '/recipes';
|
|
static String detail(int id) => '/recipes/$id';
|
|
static String update(int id) => '/recipes/$id';
|
|
static String remove(int id) => '/recipes/$id';
|
|
static String setVisibility(int id) => '/recipes/$id/visibility';
|
|
static String share(int id) => '/recipes/$id/share';
|
|
static String unshare(int id, String username) => '/recipes/$id/share/${Uri.encodeComponent(username)}';
|
|
static String inventoryPreview(int id) => '/recipes/$id/inventory-preview';
|
|
static const parseMarkdown = '/recipes/parse-markdown';
|
|
}
|
|
|
|
class InventoryApiPaths {
|
|
static const list = '/inventory';
|
|
static String update(int id) => '/inventory/$id';
|
|
static String remove(int id) => '/inventory/$id';
|
|
static String consume(int id) => '/inventory/$id/consume';
|
|
static String consumptionHistory(int id) => '/inventory/$id/consumption-history';
|
|
}
|
|
|
|
class PantryApiPaths {
|
|
static const list = '/pantry';
|
|
static String remove(int id) => '/pantry/$id';
|
|
}
|
|
|
|
class UserApiPaths {
|
|
static const me = '/users/me';
|
|
static const list = '/users';
|
|
static String setRole(int id) => '/users/$id/role';
|
|
static String setPremium(int id) => '/users/$id/premium';
|
|
static String setRecipeSharing(int id) => '/users/$id/recipe-sharing';
|
|
static String updateEmail(int id) => '/users/$id/email';
|
|
static String delete(int id) => '/users/$id';
|
|
static String resetPassword(int id) => '/users/$id/reset-password';
|
|
}
|
|
|
|
class MealPlanApiPaths {
|
|
static const list = '/meal-plan';
|
|
|
|
static String listByRange(String from, String to) =>
|
|
'$list?from=${Uri.encodeQueryComponent(from)}&to=${Uri.encodeQueryComponent(to)}';
|
|
|
|
static String shoppingList(String from, String to) =>
|
|
'$list/shopping-list?from=${Uri.encodeQueryComponent(from)}&to=${Uri.encodeQueryComponent(to)}';
|
|
|
|
static String inventoryCompare(String from, String to) =>
|
|
'$list/inventory-compare?from=${Uri.encodeQueryComponent(from)}&to=${Uri.encodeQueryComponent(to)}';
|
|
|
|
static String removeByDate(String date) =>
|
|
'$list/${Uri.encodeComponent(date)}';
|
|
} |