From 344ab5515be32407aca0e4eaa324ddff484ccb9b Mon Sep 17 00:00:00 2001 From: sylvanie85 Date: Mon, 15 Jul 2024 19:49:10 +0000 Subject: [PATCH] fix and documentation #69 --- datastore/db/queries/picture/__init__.py | 6 +++-- doc/nachet-manage-folders.md | 33 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/datastore/db/queries/picture/__init__.py b/datastore/db/queries/picture/__init__.py index 9c51d2a6..ffc5a331 100644 --- a/datastore/db/queries/picture/__init__.py +++ b/datastore/db/queries/picture/__init__.py @@ -342,8 +342,10 @@ def change_picture_set_id(cursor, user_id, old_picture_set_id, new_picture_set_i - picture_set_id (str): The UUID of the PictureSet to retrieve the pictures from. """ try : - if get_picture_set_owner_id(cursor, old_picture_set_id) != user_id or get_picture_set_owner_id(cursor, new_picture_set_id) != user_id: - raise PictureUpdateError(f"Error: picture set not own by user :{user_id}") + if get_picture_set_owner_id(cursor, old_picture_set_id) != user_id : + raise PictureUpdateError(f"Error: old picture set not own by user :{user_id}") + if get_picture_set_owner_id(cursor, new_picture_set_id) != user_id : + raise PictureUpdateError(f"Error: new picture set not own by user :{user_id}") query = """ UPDATE picture diff --git a/doc/nachet-manage-folders.md b/doc/nachet-manage-folders.md index 2f0a05a2..3c6b3bb5 100644 --- a/doc/nachet-manage-folders.md +++ b/doc/nachet-manage-folders.md @@ -66,6 +66,10 @@ training purposes. Our solution is to request confirmation from the user, who can decide to delete pictures from his container but let us save them, or he can delete everything anyway, for example if there has been a missed click. +Users have asked to be able to access the pictures of folders in the directory +section on frontend. We want them to be able to see each pictures name. Then a +user can select a folder this will get all pictures and their inferences. + ## Prerequisites - The user must be signed in and have an Azure Storage Container @@ -137,3 +141,32 @@ note left of FE : "Are you sure ? Everything in this folder will be deleted and end ``` + +### Get folder content user case + +```mermaid +sequenceDiagram + participant User + participant FE as Frontend + participant BE as Backend + participant DS as Datastore + + User->>FE: ApplicationStart() + FE-->>BE: /directories + BE->>DS: get_picture_sets_info(user_id) + loop for each picture set + DS-->DS: get_pictures(user_id, picture_set_id) + end + DS-->>BE: List of picture_set with pictures name + BE-->>FE: Response : List of picture_set with pictures name + User->>FE: Select Folder + FE->>BE: /get-folder-content + BE->>DS: get_picture_set_content(user_id, picture_set_id) + loop for each picture + DS-->DS: get_picture_hash(user_id, picture_id) + DS-->DS: get_picture_inference(user_id, picture_id) + end + DS-->>BE: Return pictures with inferences + BE-->>FE: Send pictures + FE-->>User: Display folder content (list of pictures) +```