diff --git a/openapi/openapi.json b/openapi/openapi.json new file mode 100644 index 0000000..5569195 --- /dev/null +++ b/openapi/openapi.json @@ -0,0 +1,2234 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "Assets API", + "version": "0.1.0" + }, + "paths": { + "/api/auth/me": { + "get": { + "tags": [ + "auth" + ], + "summary": "Read Users Me", + "operationId": "read_users_me_api_auth_me_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/api__endpoints__auth__UserResponse" + } + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/api/auth/register": { + "post": { + "tags": [ + "auth" + ], + "summary": "Register", + "operationId": "register_api_auth_register_post", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserRegister" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/auth/token": { + "post": { + "tags": [ + "auth" + ], + "summary": "Login For Access Token", + "operationId": "login_for_access_token_api_auth_token_post", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/Body_login_for_access_token_api_auth_token_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Token" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/admin/approvals": { + "get": { + "tags": [ + "admin" + ], + "summary": "List Pending Users", + "operationId": "list_pending_users_api_admin_approvals_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/UserResponse" + }, + "type": "array", + "title": "Response List Pending Users Api Admin Approvals Get" + } + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/api/admin/approve/{username}": { + "post": { + "tags": [ + "admin" + ], + "summary": "Approve User", + "operationId": "approve_user_api_admin_approve__username__post", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Username" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/admin/deny/{username}": { + "post": { + "tags": [ + "admin" + ], + "summary": "Deny User", + "operationId": "deny_user_api_admin_deny__username__post", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Username" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/assets/{asset_id}": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get Asset", + "operationId": "get_asset_api_assets__asset_id__get", + "parameters": [ + { + "name": "asset_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Asset Id" + } + }, + { + "name": "thumbnail", + "in": "query", + "required": false, + "schema": { + "type": "boolean", + "default": false, + "title": "Thumbnail" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Assets" + ], + "summary": "Delete Asset", + "operationId": "delete_asset_api_assets__asset_id__delete", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "asset_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Asset Id" + } + } + ], + "responses": { + "204": { + "description": "Successful Response" + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/assets": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get Assets", + "operationId": "get_assets_api_assets_get", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "type", + "in": "query", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Type" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 10, + "title": "Limit" + } + }, + { + "name": "offset", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 0, + "title": "Offset" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetsResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/assets/upload": { + "post": { + "tags": [ + "Assets" + ], + "summary": "Upload Asset", + "operationId": "upload_asset_api_assets_upload_post", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/Body_upload_asset_api_assets_upload_post" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/api/assets/regenerate_thumbnails": { + "post": { + "tags": [ + "Assets" + ], + "summary": "Regenerate Thumbnails", + "description": "Regenerates thumbnails for all existing image assets that don't have one.", + "operationId": "regenerate_thumbnails_api_assets_regenerate_thumbnails_post", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/api/assets/migrate_to_minio": { + "post": { + "tags": [ + "Assets" + ], + "summary": "Migrate To Minio", + "description": "Migrates assets from MongoDB to MinIO.", + "operationId": "migrate_to_minio_api_assets_migrate_to_minio_post", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/api/characters/": { + "get": { + "tags": [ + "Characters" + ], + "summary": "Get Characters", + "operationId": "get_characters_api_characters__get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/Character" + }, + "type": "array", + "title": "Response Get Characters Api Characters Get" + } + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/api/characters/{character_id}/assets": { + "get": { + "tags": [ + "Characters" + ], + "summary": "Get Character Assets", + "operationId": "get_character_assets_api_characters__character_id__assets_get", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "character_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Character Id" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 10, + "title": "Limit" + } + }, + { + "name": "offset", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 0, + "title": "Offset" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetsResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/characters/{character_id}": { + "get": { + "tags": [ + "Characters" + ], + "summary": "Get Character By Id", + "operationId": "get_character_by_id_api_characters__character_id__get", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "character_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Character Id" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Character" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/characters/{character_id}/_run": { + "post": { + "tags": [ + "Characters" + ], + "summary": "Post Character Generation", + "operationId": "post_character_generation_api_characters__character_id___run_post", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "character_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Character Id" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerationRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerationResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/generations/prompt-assistant": { + "post": { + "tags": [ + "Generation" + ], + "summary": "Ask Prompt Assistant", + "operationId": "ask_prompt_assistant_api_generations_prompt_assistant_post", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PromptRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PromptResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/api/generations/prompt-from-image": { + "post": { + "tags": [ + "Generation" + ], + "summary": "Prompt From Image", + "operationId": "prompt_from_image_api_generations_prompt_from_image_post", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/Body_prompt_from_image_api_generations_prompt_from_image_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PromptResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/api/generations": { + "get": { + "tags": [ + "Generation" + ], + "summary": "Get Generations", + "operationId": "get_generations_api_generations_get", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "character_id", + "in": "query", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Character Id" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 10, + "title": "Limit" + } + }, + { + "name": "offset", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 0, + "title": "Offset" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerationsResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/generations/_run": { + "post": { + "tags": [ + "Generation" + ], + "summary": "Post Generation", + "operationId": "post_generation_api_generations__run_post", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerationRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerationResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/api/generations/{generation_id}": { + "get": { + "tags": [ + "Generation" + ], + "summary": "Get Generation", + "operationId": "get_generation_api_generations__generation_id__get", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "generation_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Generation Id" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerationResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Generation" + ], + "summary": "Delete Generation", + "operationId": "delete_generation_api_generations__generation_id__delete", + "security": [ + { + "OAuth2PasswordBearer": [] + } + ], + "parameters": [ + { + "name": "generation_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Generation Id" + } + } + ], + "responses": { + "204": { + "description": "Successful Response" + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/api/generations/running": { + "get": { + "tags": [ + "Generation" + ], + "summary": "Get Running Generations", + "operationId": "get_running_generations_api_generations_running_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "security": [ + { + "OAuth2PasswordBearer": [] + } + ] + } + }, + "/albums/": { + "post": { + "tags": [ + "Albums" + ], + "summary": "Create Album", + "operationId": "create_album_albums__post", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AlbumCreateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AlbumResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + }, + "get": { + "tags": [ + "Albums" + ], + "summary": "Get Albums", + "operationId": "get_albums_albums__get", + "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 10, + "title": "Limit" + } + }, + { + "name": "offset", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 0, + "title": "Offset" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AlbumResponse" + }, + "title": "Response Get Albums Albums Get" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/albums/{album_id}": { + "get": { + "tags": [ + "Albums" + ], + "summary": "Get Album", + "operationId": "get_album_albums__album_id__get", + "parameters": [ + { + "name": "album_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Album Id" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AlbumResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + }, + "put": { + "tags": [ + "Albums" + ], + "summary": "Update Album", + "operationId": "update_album_albums__album_id__put", + "parameters": [ + { + "name": "album_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Album Id" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AlbumUpdateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AlbumResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Albums" + ], + "summary": "Delete Album", + "operationId": "delete_album_albums__album_id__delete", + "parameters": [ + { + "name": "album_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Album Id" + } + } + ], + "responses": { + "204": { + "description": "Successful Response" + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/albums/{album_id}/generations/{generation_id}": { + "post": { + "tags": [ + "Albums" + ], + "summary": "Add Generation To Album", + "operationId": "add_generation_to_album_albums__album_id__generations__generation_id__post", + "parameters": [ + { + "name": "album_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Album Id" + } + }, + { + "name": "generation_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Generation Id" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Albums" + ], + "summary": "Remove Generation From Album", + "operationId": "remove_generation_from_album_albums__album_id__generations__generation_id__delete", + "parameters": [ + { + "name": "album_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Album Id" + } + }, + { + "name": "generation_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Generation Id" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/albums/{album_id}/generations": { + "get": { + "tags": [ + "Albums" + ], + "summary": "Get Album Generations", + "operationId": "get_album_generations_albums__album_id__generations_get", + "parameters": [ + { + "name": "album_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Album Id" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 10, + "title": "Limit" + } + }, + { + "name": "offset", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 0, + "title": "Offset" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GenerationResponse" + }, + "title": "Response Get Album Generations Albums Album Id Generations Get" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "AlbumCreateRequest": { + "properties": { + "name": { + "type": "string", + "title": "Name" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + } + }, + "type": "object", + "required": [ + "name" + ], + "title": "AlbumCreateRequest" + }, + "AlbumResponse": { + "properties": { + "id": { + "type": "string", + "title": "Id" + }, + "name": { + "type": "string", + "title": "Name" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "generation_ids": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Generation Ids", + "default": [] + } + }, + "type": "object", + "required": [ + "id", + "name" + ], + "title": "AlbumResponse" + }, + "AlbumUpdateRequest": { + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Name" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + } + }, + "type": "object", + "title": "AlbumUpdateRequest" + }, + "AspectRatios": { + "type": "string", + "enum": [ + "NINESIXTEEN", + "SIXTEENNINE", + "THREEFOUR", + "FOURTHREE" + ], + "title": "AspectRatios" + }, + "AssetResponse": { + "properties": { + "id": { + "type": "string", + "title": "Id" + }, + "name": { + "type": "string", + "title": "Name" + }, + "type": { + "type": "string", + "title": "Type" + }, + "content_type": { + "type": "string", + "title": "Content Type" + }, + "linked_char_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Linked Char Id" + }, + "created_at": { + "type": "string", + "format": "date-time", + "title": "Created At" + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Url" + } + }, + "type": "object", + "required": [ + "id", + "name", + "type", + "content_type", + "created_at" + ], + "title": "AssetResponse" + }, + "AssetsResponse": { + "properties": { + "assets": { + "items": { + "$ref": "#/components/schemas/AssetResponse" + }, + "type": "array", + "title": "Assets" + }, + "total_count": { + "type": "integer", + "title": "Total Count" + } + }, + "type": "object", + "required": [ + "assets", + "total_count" + ], + "title": "AssetsResponse" + }, + "Body_login_for_access_token_api_auth_token_post": { + "properties": { + "grant_type": { + "anyOf": [ + { + "type": "string", + "pattern": "^password$" + }, + { + "type": "null" + } + ], + "title": "Grant Type" + }, + "username": { + "type": "string", + "title": "Username" + }, + "password": { + "type": "string", + "format": "password", + "title": "Password" + }, + "scope": { + "type": "string", + "title": "Scope", + "default": "" + }, + "client_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Id" + }, + "client_secret": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "format": "password", + "title": "Client Secret" + } + }, + "type": "object", + "required": [ + "username", + "password" + ], + "title": "Body_login_for_access_token_api_auth_token_post" + }, + "Body_prompt_from_image_api_generations_prompt_from_image_post": { + "properties": { + "prompt": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Prompt" + }, + "images": { + "items": { + "type": "string", + "format": "binary" + }, + "type": "array", + "title": "Images" + } + }, + "type": "object", + "required": [ + "images" + ], + "title": "Body_prompt_from_image_api_generations_prompt_from_image_post" + }, + "Body_upload_asset_api_assets_upload_post": { + "properties": { + "file": { + "type": "string", + "format": "binary", + "title": "File" + }, + "linked_char_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Linked Char Id" + } + }, + "type": "object", + "required": [ + "file" + ], + "title": "Body_upload_asset_api_assets_upload_post" + }, + "Character": { + "properties": { + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id" + }, + "name": { + "type": "string", + "title": "Name" + }, + "avatar_image": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Avatar Image" + }, + "character_image_data": { + "anyOf": [ + { + "type": "string", + "format": "binary" + }, + { + "type": "null" + } + ], + "title": "Character Image Data" + }, + "character_image_doc_tg_id": { + "type": "string", + "title": "Character Image Doc Tg Id" + }, + "character_image_tg_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Character Image Tg Id" + }, + "character_bio": { + "type": "string", + "title": "Character Bio" + } + }, + "type": "object", + "required": [ + "id", + "name", + "character_image_doc_tg_id", + "character_image_tg_id", + "character_bio" + ], + "title": "Character" + }, + "GenerationRequest": { + "properties": { + "linked_character_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Linked Character Id" + }, + "aspect_ratio": { + "$ref": "#/components/schemas/AspectRatios", + "default": "NINESIXTEEN" + }, + "quality": { + "$ref": "#/components/schemas/Quality", + "default": "ONEK" + }, + "prompt": { + "type": "string", + "title": "Prompt" + }, + "telegram_id": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Telegram Id" + }, + "use_profile_image": { + "type": "boolean", + "title": "Use Profile Image", + "default": true + }, + "assets_list": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Assets List" + } + }, + "type": "object", + "required": [ + "prompt", + "assets_list" + ], + "title": "GenerationRequest" + }, + "GenerationResponse": { + "properties": { + "id": { + "type": "string", + "title": "Id" + }, + "status": { + "$ref": "#/components/schemas/GenerationStatus" + }, + "failed_reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Failed Reason" + }, + "linked_character_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Linked Character Id" + }, + "aspect_ratio": { + "$ref": "#/components/schemas/AspectRatios" + }, + "quality": { + "$ref": "#/components/schemas/Quality" + }, + "prompt": { + "type": "string", + "title": "Prompt" + }, + "tech_prompt": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Tech Prompt" + }, + "assets_list": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Assets List" + }, + "result_list": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Result List", + "default": [] + }, + "result": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Result" + }, + "execution_time_seconds": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Execution Time Seconds" + }, + "api_execution_time_seconds": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Api Execution Time Seconds" + }, + "token_usage": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Usage" + }, + "input_token_usage": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Input Token Usage" + }, + "output_token_usage": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Output Token Usage" + }, + "progress": { + "type": "integer", + "title": "Progress", + "default": 0 + }, + "created_at": { + "type": "string", + "format": "date-time", + "title": "Created At", + "default": "2026-02-08T17:27:29.368203Z" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "title": "Updated At", + "default": "2026-02-08T17:27:29.368207Z" + } + }, + "type": "object", + "required": [ + "id", + "status", + "aspect_ratio", + "quality", + "prompt", + "assets_list" + ], + "title": "GenerationResponse" + }, + "GenerationStatus": { + "type": "string", + "enum": [ + "running", + "done", + "failed" + ], + "title": "GenerationStatus" + }, + "GenerationsResponse": { + "properties": { + "generations": { + "items": { + "$ref": "#/components/schemas/GenerationResponse" + }, + "type": "array", + "title": "Generations" + }, + "total_count": { + "type": "integer", + "title": "Total Count" + } + }, + "type": "object", + "required": [ + "generations", + "total_count" + ], + "title": "GenerationsResponse" + }, + "HTTPValidationError": { + "properties": { + "detail": { + "items": { + "$ref": "#/components/schemas/ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + }, + "PromptRequest": { + "properties": { + "prompt": { + "type": "string", + "title": "Prompt" + }, + "linked_assets": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Linked Assets", + "default": [] + } + }, + "type": "object", + "required": [ + "prompt" + ], + "title": "PromptRequest" + }, + "PromptResponse": { + "properties": { + "prompt": { + "type": "string", + "title": "Prompt" + } + }, + "type": "object", + "required": [ + "prompt" + ], + "title": "PromptResponse" + }, + "Quality": { + "type": "string", + "enum": [ + "ONEK", + "TWOK", + "FOURK" + ], + "title": "Quality" + }, + "Token": { + "properties": { + "access_token": { + "type": "string", + "title": "Access Token" + }, + "token_type": { + "type": "string", + "title": "Token Type" + } + }, + "type": "object", + "required": [ + "access_token", + "token_type" + ], + "title": "Token" + }, + "UserRegister": { + "properties": { + "username": { + "type": "string", + "title": "Username" + }, + "password": { + "type": "string", + "title": "Password" + }, + "full_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Full Name" + } + }, + "type": "object", + "required": [ + "username", + "password" + ], + "title": "UserRegister" + }, + "UserResponse": { + "properties": { + "username": { + "type": "string", + "title": "Username" + }, + "full_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Full Name" + }, + "status": { + "type": "string", + "title": "Status" + }, + "created_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Created At" + }, + "is_admin": { + "type": "boolean", + "title": "Is Admin" + } + }, + "type": "object", + "required": [ + "username", + "status", + "is_admin" + ], + "title": "UserResponse" + }, + "ValidationError": { + "properties": { + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "api__endpoints__auth__UserResponse": { + "properties": { + "username": { + "type": "string", + "title": "Username" + }, + "full_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Full Name" + }, + "status": { + "type": "string", + "title": "Status" + }, + "is_admin": { + "type": "boolean", + "title": "Is Admin", + "default": false + } + }, + "type": "object", + "required": [ + "username", + "status" + ], + "title": "UserResponse" + } + }, + "securitySchemes": { + "OAuth2PasswordBearer": { + "type": "oauth2", + "flows": { + "password": { + "scopes": {}, + "tokenUrl": "/api/auth/token" + } + } + } + } + } +} \ No newline at end of file diff --git a/src/components/AppSidebar.vue b/src/components/AppSidebar.vue index bbd0dd0..7406a25 100644 --- a/src/components/AppSidebar.vue +++ b/src/components/AppSidebar.vue @@ -24,6 +24,7 @@ const navItems = computed(() => { const items = [ { path: '/', icon: '🏠', tooltip: 'Home' }, { path: '/assets', icon: '📂', tooltip: 'Assets' }, + { path: '/albums', icon: '🖼️', tooltip: 'Albums' }, // { path: '/generation', icon: '🎨', tooltip: 'Image Generation' }, { path: '/flexible', icon: '🖌️', tooltip: 'Flexible Generation' }, { path: '/characters', icon: '👥', tooltip: 'Characters' }, diff --git a/src/router/index.js b/src/router/index.js index 9e0a28a..d6caf71 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -56,6 +56,16 @@ const router = createRouter({ path: '/flexible', name: 'flexible', component: () => import('../views/FlexibleGenerationView.vue') + }, + { + path: '/albums', + name: 'albums', + component: () => import('../views/AlbumsView.vue') + }, + { + path: '/albums/:id', + name: 'album-detail', + component: () => import('../views/AlbumDetailView.vue') } ] }) diff --git a/src/services/albumService.js b/src/services/albumService.js new file mode 100644 index 0000000..75ae913 --- /dev/null +++ b/src/services/albumService.js @@ -0,0 +1,12 @@ +import api from './api'; + +export const albumService = { + getAlbums: (limit = 10, offset = 0) => api.get('/albums', { params: { limit, offset } }), + createAlbum: (data) => api.post('/albums', data), + getAlbum: (id) => api.get(`/albums/${id}`), + updateAlbum: (id, data) => api.put(`/albums/${id}`, data), + deleteAlbum: (id) => api.delete(`/albums/${id}`), + addGenerationToAlbum: (albumId, generationId) => api.post(`/albums/${albumId}/generations/${generationId}`), + removeGenerationFromAlbum: (albumId, generationId) => api.delete(`/albums/${albumId}/generations/${generationId}`), + getAlbumGenerations: (albumId, limit = 10, offset = 0) => api.get(`/albums/${albumId}/generations`, { params: { limit, offset } }) +}; diff --git a/src/stores/albums.js b/src/stores/albums.js new file mode 100644 index 0000000..6e028ab --- /dev/null +++ b/src/stores/albums.js @@ -0,0 +1,153 @@ +import { defineStore } from 'pinia'; +import { ref } from 'vue'; +import { albumService } from '../services/albumService'; + +export const useAlbumStore = defineStore('albums', () => { + const albums = ref([]); + const currentAlbum = ref(null); + const loading = ref(false); + const error = ref(null); + const totalAlbums = ref(0); + + async function fetchAlbums(limit = 10, offset = 0) { + loading.value = true; + error.value = null; + try { + const response = await albumService.getAlbums(limit, offset); + albums.value = response.data; // Assuming response.data is the list or { albums: [], total_count: ... } + // Check if response has total_count structure + if (response.data.albums) { + albums.value = response.data.albums; + totalAlbums.value = response.data.total_count; + } else { + // Fallback if structure is different + albums.value = response.data; + } + } catch (err) { + console.error('Error fetching albums:', err); + error.value = err.response?.data?.detail || 'Failed to fetch albums'; + } finally { + loading.value = false; + } + } + + async function createAlbum(data) { + loading.value = true; + error.value = null; + try { + await albumService.createAlbum(data); + await fetchAlbums(); // Refresh list + return true; + } catch (err) { + console.error('Error creating album:', err); + error.value = err.response?.data?.detail || 'Failed to create album'; + return false; + } finally { + loading.value = false; + } + } + + async function fetchAlbum(id) { + loading.value = true; + error.value = null; + currentAlbum.value = null; + try { + const response = await albumService.getAlbum(id); + currentAlbum.value = response.data; + return response.data; + } catch (err) { + console.error('Error fetching album:', err); + error.value = err.response?.data?.detail || 'Failed to fetch album'; + return null; + } finally { + loading.value = false; + } + } + + async function updateAlbum(id, data) { + loading.value = true; + error.value = null; + try { + await albumService.updateAlbum(id, data); + if (currentAlbum.value && currentAlbum.value.id === id) { + await fetchAlbum(id); + } + await fetchAlbums(); + return true; + } catch (err) { + console.error('Error updating album:', err); + error.value = err.response?.data?.detail || 'Failed to update album'; + return false; + } finally { + loading.value = false; + } + } + + async function deleteAlbum(id) { + loading.value = true; + error.value = null; + try { + await albumService.deleteAlbum(id); + await fetchAlbums(); // Refresh list + return true; + } catch (err) { + console.error('Error deleting album:', err); + error.value = err.response?.data?.detail || 'Failed to delete album'; + return false; + } finally { + loading.value = false; + } + } + + async function addGenerationToAlbum(albumId, generationId) { + loading.value = true; + error.value = null; + try { + await albumService.addGenerationToAlbum(albumId, generationId); + // Optionally refresh current album if it matches + if (currentAlbum.value && currentAlbum.value.id === albumId) { + await fetchAlbum(albumId); + } + return true; + } catch (err) { + console.error('Error adding generation to album:', err); + error.value = err.response?.data?.detail || 'Failed to add generation to album'; + return false; + } finally { + loading.value = false; + } + } + + async function removeGenerationFromAlbum(albumId, generationId) { + loading.value = true; + error.value = null; + try { + await albumService.removeGenerationFromAlbum(albumId, generationId); + if (currentAlbum.value && currentAlbum.value.id === albumId) { + await fetchAlbum(albumId); + } + return true; + } catch (err) { + console.error('Error removing generation from album:', err); + error.value = err.response?.data?.detail || 'Failed to remove generation from album'; + return false; + } finally { + loading.value = false; + } + } + + return { + albums, + currentAlbum, + loading, + error, + totalAlbums, + fetchAlbums, + createAlbum, + fetchAlbum, + updateAlbum, + deleteAlbum, + addGenerationToAlbum, + removeGenerationFromAlbum + }; +}); diff --git a/src/views/AlbumDetailView.vue b/src/views/AlbumDetailView.vue new file mode 100644 index 0000000..37de590 --- /dev/null +++ b/src/views/AlbumDetailView.vue @@ -0,0 +1,274 @@ + + + + + diff --git a/src/views/AlbumsView.vue b/src/views/AlbumsView.vue new file mode 100644 index 0000000..3684595 --- /dev/null +++ b/src/views/AlbumsView.vue @@ -0,0 +1,123 @@ + + +