From 465d178882b74427c12cc8a245e5e72a757fbf72 Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Tue, 23 Jul 2024 20:31:05 +0200 Subject: [PATCH] perf: fast delete (#211) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf: fast delete * chore(api): generate docs * fix(api): swagger comment * chore(api): generate docs * refactor(api): change order of routes * chore(api): generate docs * fix(api): update api/repo/file_repo.go Co-authored-by: Daniël Sonck * fix(api): query * chore(api): format code --------- Co-authored-by: Daniël Sonck --- api/docs/index.html | 70 ++++++----- api/docs/swagger.yaml | 54 +++++++-- api/repo/file_repo.go | 8 ++ api/repo/snapshot_repo.go | 14 +++ api/router/file_router.go | 41 +++++-- api/service/file_service.go | 158 +++++++++++++++++-------- ui/src/client/api/file.ts | 13 +- ui/src/components/file/file-delete.tsx | 33 +++--- webdav/client/api_client.go | 8 +- webdav/handler/method_delete.go | 2 +- 10 files changed, 271 insertions(+), 130 deletions(-) diff --git a/api/docs/index.html b/api/docs/index.html index e57c72686..b8c4c8622 100644 --- a/api/docs/index.html +++ b/api/docs/index.html @@ -357,7 +357,7 @@ -

Voltaserve API (2.0.0)

Download OpenAPI specification:Download

Files

Delete

Delete

+ " fill="currentColor">

Voltaserve API (2.0.0)

Download OpenAPI specification:Download

Files

Delete Many

Delete Many

Request Body schema: application/json
required

Body

-
ids
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "ids": [
    ]
}

Response samples

Content type
application/json
[
  • "string"
]

Get by Path

Request samples

Content type
application/json
{
  • "sourceIds": [
    ]
}

Response samples

Content type
application/json
[
  • "string"
]

Get by Path

Get by Path

path Parameters
id
required
string

ID

@@ -413,7 +413,17 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Get

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Delete One

Delete One

+
path Parameters
id
required
string

ID

+
targetId
required
string

Target ID

+

Responses

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Get

Get

path Parameters
id
required
string

ID

@@ -423,7 +433,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Patch

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Patch

Patch

path Parameters
id
required
string

ID

@@ -435,7 +445,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Copy One

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Copy One

Copy One

path Parameters
id
required
string

ID

@@ -445,7 +455,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Count

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Count

Count

path Parameters
id
required
string

ID

@@ -455,7 +465,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
0
0

Get Group Permissions

Response samples

Content type
application/json
0
0

Get Group Permissions

Get Group Permissions

path Parameters
id
required
string

ID

@@ -465,7 +475,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
[
  • {
    }
]

List

Response samples

Content type
application/json
[
  • {
    }
]

List

List

path Parameters
id
required
string

ID

@@ -487,7 +497,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "page": 0,
  • "query": {
    },
  • "size": 0,
  • "totalElements": 0,
  • "totalPages": 0
}

Move One

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "page": 0,
  • "query": {
    },
  • "size": 0,
  • "totalElements": 0,
  • "totalPages": 0
}

Move One

Move One

path Parameters
id
required
string

ID

@@ -497,7 +507,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Patch Name

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Patch Name

Patch Name

path Parameters
id
required
string

ID

@@ -509,7 +519,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Download Original

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Download Original

Download Original

path Parameters
id
required
string

ID

@@ -521,7 +531,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Patch from S3

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Patch from S3

Patch from S3

path Parameters
id
required
string

ID

@@ -543,7 +553,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Get Path

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Get Path

Get Path

path Parameters
id
required
string

ID

@@ -553,7 +563,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
[
  • {
    }
]

Download Preview

Response samples

Content type
application/json
[
  • {
    }
]

Download Preview

Download Preview

path Parameters
id
required
string

ID

@@ -565,7 +575,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Revoke Group Permission

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Revoke Group Permission

Revoke Group Permission

path Parameters
id
required
string

ID

@@ -575,7 +585,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Request samples

Content type
application/json
{
  • "groupId": "string",
  • "ids": [
    ]
}

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Get Size

Request samples

Content type
application/json
{
  • "groupId": "string",
  • "ids": [
    ]
}

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Get Size

Get Size

path Parameters
id
required
string

ID

@@ -585,7 +595,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
0
0

Download Thumbnail

Response samples

Content type
application/json
0
0

Download Thumbnail

Download Thumbnail

path Parameters
id
required
string

ID

@@ -597,7 +607,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Get User Permissions

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Get User Permissions

Get User Permissions

path Parameters
id
required
string

ID

@@ -607,7 +617,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
[
  • {
    }
]

Copy Many

Response samples

Content type
application/json
[
  • {
    }
]

Copy Many

Copy Many

Request Body schema: application/json
required

Body

@@ -617,7 +627,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Request samples

Content type
application/json
{
  • "sourceIds": [
    ],
  • "targetId": "string"
}

Response samples

Content type
application/json
{
  • "failed": [
    ],
  • "new": [
    ],
  • "succeeded": [
    ]
}

Create from S3

Request samples

Content type
application/json
{
  • "sourceIds": [
    ],
  • "targetId": "string"
}

Response samples

Content type
application/json
{
  • "failed": [
    ],
  • "new": [
    ],
  • "succeeded": [
    ]
}

Create from S3

Create from S3

query Parameters
api_key
required
string

API Key

@@ -643,7 +653,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Grant Group Permission

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "isShared": true,
  • "name": "string",
  • "parentId": "string",
  • "permission": "string",
  • "snapshot": {
    },
  • "type": "string",
  • "updateTime": "string",
  • "workspaceId": "string"
}

Grant Group Permission

Grant Group Permission

path Parameters
id
required
string

ID

@@ -653,7 +663,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Request samples

Content type
application/json
{
  • "groupId": "string",
  • "ids": [
    ],
  • "permission": "viewer"
}

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Grant User Permission

Request samples

Content type
application/json
{
  • "groupId": "string",
  • "ids": [
    ],
  • "permission": "viewer"
}

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Grant User Permission

Grant User Permission

path Parameters
id
required
string

ID

@@ -663,7 +673,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Request samples

Content type
application/json
{
  • "ids": [
    ],
  • "permission": "viewer",
  • "userId": "string"
}

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

List by Path

Request samples

Content type
application/json
{
  • "ids": [
    ],
  • "permission": "viewer",
  • "userId": "string"
}

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

List by Path

List by Path

query Parameters
path
required
string

Path

@@ -673,7 +683,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Response samples

Content type
application/json
[
  • {
    }
]

Move Many

Response samples

Content type
application/json
[
  • {
    }
]

Move Many

Move Many

Request Body schema: application/json
required

Body

@@ -683,7 +693,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Request samples

Content type
application/json
{
  • "sourceIds": [
    ],
  • "targetId": "string"
}

Response samples

Content type
application/json
{
  • "failed": [
    ],
  • "succeeded": [
    ]
}

Revoke User Permission

Request samples

Content type
application/json
{
  • "sourceIds": [
    ],
  • "targetId": "string"
}

Response samples

Content type
application/json
{
  • "failed": [
    ],
  • "succeeded": [
    ]
}

Revoke User Permission

Revoke User Permission

path Parameters
id
required
string

ID

@@ -693,7 +703,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Not Found

Request samples

Content type
application/json
{
  • "ids": [
    ],
  • "userId": "string"
}

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Groups

List

Request samples

Content type
application/json
{
  • "ids": [
    ],
  • "userId": "string"
}

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "moreInfo": "string",
  • "status": 0,
  • "userMessage": "string"
}

Groups

List

List

query Parameters
query
string

Query

@@ -1357,7 +1367,7 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX cWARBq sc-dCFGXG gKOXES">

Internal Server Error

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "id": "string",
  • "image": "string",
  • "name": "string",
  • "organization": {
    },
  • "permission": "string",
  • "rootId": "string",
  • "storageCapacity": 0,
  • "updateTime": "string"
}