refactor: initial frontend wiring for new api

This commit is contained in:
2025-12-15 00:13:10 +00:00
parent 528aa943fa
commit 05edf69ca7
63 changed files with 1876 additions and 1991 deletions

View File

@@ -447,10 +447,13 @@ const docTemplate = `{
"BearerAuth": []
}
],
"description": "Move one or more files or directories into this directory. All items must currently be in the same source directory.",
"description": "Move one or more files or directories into this directory. Returns detailed status for each item including which were successfully moved, which had conflicts, and which encountered errors.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"directories"
],
@@ -482,10 +485,10 @@ const docTemplate = `{
}
],
"responses": {
"204": {
"description": "Items moved successfully",
"200": {
"description": "Move operation results with moved, conflict, and error states",
"schema": {
"type": "string"
"$ref": "#/definitions/internal_catalog.moveItemsToDirectoryResponse"
}
},
"400": {
@@ -511,15 +514,6 @@ const docTemplate = `{
"type": "string"
}
}
},
"409": {
"description": "Name conflict in target directory",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
@@ -1433,6 +1427,109 @@ const docTemplate = `{
}
}
},
"internal_catalog.moveItemError": {
"description": "Error details for a failed item move",
"type": "object",
"properties": {
"error": {
"description": "Error message describing what went wrong",
"type": "string",
"example": "permission denied"
},
"id": {
"description": "ID of the item that failed to move",
"type": "string",
"example": "mElnUNCm8F22"
}
}
},
"internal_catalog.moveItemsToDirectoryResponse": {
"description": "Response from moving items to a directory with status for each item",
"type": "object",
"properties": {
"conflicts": {
"description": "Array of IDs of items that conflicted with existing items in the target directory",
"type": "array",
"items": {
"type": "string"
},
"example": [
"xYz123AbC456"
]
},
"errors": {
"description": "Array of errors that occurred during the move operation",
"type": "array",
"items": {
"$ref": "#/definitions/internal_catalog.moveItemError"
}
},
"items": {
"description": "Array of items included in the request (files and directories)",
"type": "array",
"items": {
"$ref": "#/definitions/internal_catalog.moveResponseItem"
}
},
"moved": {
"description": "Array of IDs of successfully moved items",
"type": "array",
"items": {
"type": "string"
},
"example": [
"mElnUNCm8F22",
"kRp2XYTq9A55"
]
}
}
},
"internal_catalog.moveResponseItem": {
"description": "Item included in the move operation. Check \"kind\" field to determine type: \"file\" (has size, mimeType) or \"directory\"",
"type": "object",
"properties": {
"createdAt": {
"description": "When the item was created (ISO 8601)",
"type": "string",
"example": "2024-12-13T15:04:05Z"
},
"deletedAt": {
"description": "When the item was trashed, null if not trashed (ISO 8601)",
"type": "string",
"example": "2024-12-14T10:00:00Z"
},
"id": {
"description": "Unique item identifier",
"type": "string",
"example": "mElnUNCm8F22"
},
"kind": {
"description": "Item type: \"file\" or \"directory\"",
"type": "string",
"example": "file"
},
"mimeType": {
"description": "MIME type (only for files)",
"type": "string",
"example": "application/pdf"
},
"name": {
"description": "Item name",
"type": "string",
"example": "document.pdf"
},
"size": {
"description": "File size in bytes (only for files)",
"type": "integer",
"example": 1048576
},
"updatedAt": {
"description": "When the item was last updated (ISO 8601)",
"type": "string",
"example": "2024-12-13T16:30:00Z"
}
}
},
"internal_catalog.patchDirectoryRequest": {
"description": "Request to update directory properties",
"type": "object",

View File

@@ -187,6 +187,65 @@
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete multiple directories permanently or move them to trash. Deleting directories also affects all their contents. All items must be directories.",
"tags": [
"directories"
],
"summary": "Bulk delete directories",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Account ID",
"name": "accountID",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Comma-separated list of directory IDs to delete",
"name": "id",
"in": "query",
"required": true
},
{
"type": "boolean",
"default": false,
"description": "Move to trash instead of permanent delete",
"name": "trash",
"in": "query"
}
],
"responses": {
"204": {
"description": "Directories deleted",
"schema": {
"type": "string"
}
},
"400": {
"description": "All items must be directories",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"401": {
"description": "Not authenticated",
"schema": {
"type": "string"
}
}
}
}
},
"/accounts/{accountID}/directories/{directoryID}": {
@@ -512,6 +571,67 @@
}
}
},
"/accounts/{accountID}/files": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete multiple files permanently or move them to trash. All items must be files.",
"tags": [
"files"
],
"summary": "Bulk delete files",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Account ID",
"name": "accountID",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Comma-separated list of file IDs to delete",
"name": "id",
"in": "query",
"required": true
},
{
"type": "boolean",
"default": false,
"description": "Move to trash instead of permanent delete",
"name": "trash",
"in": "query"
}
],
"responses": {
"204": {
"description": "Files deleted",
"schema": {
"type": "string"
}
},
"400": {
"description": "All items must be files",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"401": {
"description": "Not authenticated",
"schema": {
"type": "string"
}
}
}
}
},
"/accounts/{accountID}/files/{fileID}": {
"get": {
"security": [

View File

@@ -225,6 +225,85 @@ definitions:
example: kRp2XYTq9A55
type: string
type: object
internal_catalog.moveItemError:
description: Error details for a failed item move
properties:
error:
description: Error message describing what went wrong
example: permission denied
type: string
id:
description: ID of the item that failed to move
example: mElnUNCm8F22
type: string
type: object
internal_catalog.moveItemsToDirectoryResponse:
description: Response from moving items to a directory with status for each item
properties:
conflicts:
description: Array of IDs of items that conflicted with existing items in
the target directory
example:
- xYz123AbC456
items:
type: string
type: array
errors:
description: Array of errors that occurred during the move operation
items:
$ref: '#/definitions/internal_catalog.moveItemError'
type: array
items:
description: Array of items included in the request (files and directories)
items:
$ref: '#/definitions/internal_catalog.moveResponseItem'
type: array
moved:
description: Array of IDs of successfully moved items
example:
- mElnUNCm8F22
- kRp2XYTq9A55
items:
type: string
type: array
type: object
internal_catalog.moveResponseItem:
description: 'Item included in the move operation. Check "kind" field to determine
type: "file" (has size, mimeType) or "directory"'
properties:
createdAt:
description: When the item was created (ISO 8601)
example: "2024-12-13T15:04:05Z"
type: string
deletedAt:
description: When the item was trashed, null if not trashed (ISO 8601)
example: "2024-12-14T10:00:00Z"
type: string
id:
description: Unique item identifier
example: mElnUNCm8F22
type: string
kind:
description: 'Item type: "file" or "directory"'
example: file
type: string
mimeType:
description: MIME type (only for files)
example: application/pdf
type: string
name:
description: Item name
example: document.pdf
type: string
size:
description: File size in bytes (only for files)
example: 1048576
type: integer
updatedAt:
description: When the item was last updated (ISO 8601)
example: "2024-12-13T16:30:00Z"
type: string
type: object
internal_catalog.patchDirectoryRequest:
description: Request to update directory properties
properties:
@@ -616,8 +695,9 @@ paths:
post:
consumes:
- application/json
description: Move one or more files or directories into this directory. All
items must currently be in the same source directory.
description: Move one or more files or directories into this directory. Returns
detailed status for each item including which were successfully moved, which
had conflicts, and which encountered errors.
parameters:
- description: Account ID
format: uuid
@@ -636,11 +716,13 @@ paths:
required: true
schema:
$ref: '#/definitions/internal_catalog.postDirectoryContentRequest'
produces:
- application/json
responses:
"204":
description: Items moved successfully
"200":
description: Move operation results with moved, conflict, and error states
schema:
type: string
$ref: '#/definitions/internal_catalog.moveItemsToDirectoryResponse'
"400":
description: Invalid request or items not in same directory
schema:
@@ -657,12 +739,6 @@ paths:
additionalProperties:
type: string
type: object
"409":
description: Name conflict in target directory
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Move items to directory