Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions backend/app/database/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ def db_get_folder_ids_by_paths(


def db_get_all_folder_details() -> (
List[Tuple[str, str, Optional[str], int, bool, Optional[bool]]]
List[Tuple[str, str, Optional[str], int, bool, Optional[bool], int]]
):
"""
Get all folder details including folder_id, folder_path, parent_folder_id,
last_modified_time, AI_Tagging, and taggingCompleted.
last_modified_time, AI_Tagging, taggingCompleted, and image_count.
Returns list of tuples with all folder information.
"""
conn = sqlite3.connect(DATABASE_PATH)
Expand All @@ -408,9 +408,18 @@ def db_get_all_folder_details() -> (
try:
cursor.execute(
"""
SELECT folder_id, folder_path, parent_folder_id, last_modified_time, AI_Tagging, taggingCompleted
FROM folders
ORDER BY folder_path
SELECT
f.folder_id,
f.folder_path,
f.parent_folder_id,
f.last_modified_time,
f.AI_Tagging,
f.taggingCompleted,
COUNT(i.id) as image_count
FROM folders f
LEFT JOIN images i ON f.folder_id = i.folder_id
GROUP BY f.folder_id
ORDER BY f.folder_path
"""
)
return cursor.fetchall()
Expand Down
2 changes: 2 additions & 0 deletions backend/app/routes/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ def get_all_folders():
last_modified_time,
ai_tagging,
tagging_completed,
image_count,
) = folder_data
folders.append(
FolderDetails(
Expand All @@ -458,6 +459,7 @@ def get_all_folders():
last_modified_time=last_modified_time,
AI_Tagging=ai_tagging,
taggingCompleted=tagging_completed,
image_count=image_count,
)
)

Expand Down
1 change: 1 addition & 0 deletions backend/app/schemas/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class FolderDetails(BaseModel):
last_modified_time: int
AI_Tagging: bool
taggingCompleted: Optional[bool] = None
image_count: int = 0


class GetAllFoldersData(BaseModel):
Expand Down
69 changes: 39 additions & 30 deletions docs/backend/backend_python/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1117,9 +1117,14 @@
"in": "query",
"required": false,
"schema": {
"$ref": "#/components/schemas/InputType",
"allOf": [
{
"$ref": "#/components/schemas/InputType"
}
],
"description": "Choose input type: 'path' or 'base64'",
"default": "path"
"default": "path",
"title": "Input Type"
},
"description": "Choose input type: 'path' or 'base64'"
}
Expand Down Expand Up @@ -1232,7 +1237,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
"$ref": "#/components/schemas/app__schemas__user_preferences__ErrorResponse"
}
}
}
Expand Down Expand Up @@ -1272,7 +1277,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
"$ref": "#/components/schemas/app__schemas__user_preferences__ErrorResponse"
}
}
}
Expand All @@ -1282,7 +1287,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
"$ref": "#/components/schemas/app__schemas__user_preferences__ErrorResponse"
}
}
}
Expand Down Expand Up @@ -1637,30 +1642,6 @@
],
"title": "DeleteFoldersResponse"
},
"ErrorResponse": {
"properties": {
"success": {
"type": "boolean",
"title": "Success"
},
"error": {
"type": "string",
"title": "Error"
},
"message": {
"type": "string",
"title": "Message"
}
},
"type": "object",
"required": [
"success",
"error",
"message"
],
"title": "ErrorResponse",
"description": "Error response model"
},
"FaceSearchRequest": {
"properties": {
"path": {
Expand Down Expand Up @@ -1728,6 +1709,11 @@
}
],
"title": "Taggingcompleted"
},
"image_count": {
"type": "integer",
"title": "Image Count",
"default": 0
}
},
"type": "object",
Expand Down Expand Up @@ -2246,7 +2232,6 @@
"metadata": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
Expand Down Expand Up @@ -2959,6 +2944,30 @@
"error"
],
"title": "ErrorResponse"
},
"app__schemas__user_preferences__ErrorResponse": {
"properties": {
"success": {
"type": "boolean",
"title": "Success"
},
"error": {
"type": "string",
"title": "Error"
},
"message": {
"type": "string",
"title": "Message"
}
},
"type": "object",
"required": [
"success",
"error",
"message"
],
"title": "ErrorResponse",
"description": "Error response model"
}
}
}
Expand Down
Loading