feat(recipes): add recipe visibility and sharing features
- 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.
This commit is contained in:
@@ -49,6 +49,19 @@ class AdminRepository {
|
||||
return UserAdmin.fromJson(data);
|
||||
}
|
||||
|
||||
Future<UserAdmin> setRecipeSharing(int userId, {required bool canShareRecipes}) async {
|
||||
final token = await _token();
|
||||
final data = await guardedApiCall(
|
||||
_ref,
|
||||
() => _apiClient.patchJson(
|
||||
UserApiPaths.setRecipeSharing(userId),
|
||||
body: {'canShareRecipes': canShareRecipes},
|
||||
token: token,
|
||||
),
|
||||
);
|
||||
return UserAdmin.fromJson(data);
|
||||
}
|
||||
|
||||
Future<void> updateEmail(int userId, String email) async {
|
||||
final token = await _token();
|
||||
await guardedApiCall(
|
||||
|
||||
Reference in New Issue
Block a user