From 46d8a540c26e881902345f8cf4f473af55611799 Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Mon, 12 Aug 2024 15:42:40 +0200 Subject: [PATCH] feat: reprocess endpoint (#262) * feat(api): endpoint to reprocess a file * refactor(api): no naked return * refactor(api): don't mark folders as rejected * fix: set snapshot.task_id to NULL when deleting a task * chore: format code * chore: fix linter error --- api/docs/index.html | 42 ++++++---- api/docs/swagger.yaml | 39 +++++++++ api/repo/snapshot_repo.go | 12 +++ api/router/file_router.go | 24 +++++- api/service/file_service.go | 126 ++++++++++++++++++++++++++++ api/service/task_service.go | 57 ++++++++++--- conversion/docs/index.html | 20 ++--- conversion/docs/swagger.yaml | 42 +--------- conversion/pipeline/pdf_pipeline.go | 6 +- 9 files changed, 285 insertions(+), 83 deletions(-) diff --git a/api/docs/index.html b/api/docs/index.html index 886582d22..0f844d9cb 100644 --- a/api/docs/index.html +++ b/api/docs/index.html @@ -357,7 +357,7 @@ -

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"
}

Reprocess

Reprocess

+
path Parameters
id
required
string

ID

+

Responses

Response samples

Content type
application/json
{
  • "accepted": [
    ],
  • "rejected": [
    ]
}

Revoke Group Permission

Revoke Group Permission

path Parameters
id
required
string

ID

@@ -585,7 +595,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"
}

Download Segmentation Page

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"
}

Download Segmentation Page

Download Segmentation Page

path Parameters
id
required
string

ID

@@ -599,7 +609,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"
}

Download Segmentation Thumbnail

Response samples

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

Download Segmentation Thumbnail

Download Segmentation Thumbnail

path Parameters
id
required
string

ID

@@ -613,7 +623,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 Size

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

@@ -623,7 +633,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

@@ -635,7 +645,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

@@ -645,7 +655,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

@@ -655,7 +665,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

@@ -681,7 +691,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

@@ -691,7 +701,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

@@ -701,7 +711,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

@@ -711,7 +721,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

@@ -721,7 +731,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

@@ -731,7 +741,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

@@ -1395,7 +1405,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"
}