From 8da70ca05cdf1d3c7f615488b0b103b62bf61bd7 Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Sat, 10 Aug 2024 20:43:49 +0200 Subject: [PATCH] chore: improve S3Object data structure - part 2 (#259) feat: further enrichment of snapshot.original field with more properties (see JSON below) feat: further enrichment of snapshot.preview field with more properties (see JSON below) feat: further enrichment of snapshot.segmentation field with more properties (see JSON below) feat: further enrichment of snapshot.mosaic field with more properties (see JSON below) refactor: clients on API microservice look the same like other microservices (preparing for deduplication) --- .../pipeline_client.go | 2 +- .../{ => language_client}/language_client.go | 2 +- .../{ => mosaic_client}/mosaic_client.go | 14 +- api/docs/index.html | 32 +-- api/docs/swagger.yaml | 184 ++++++++++-------- api/model/snapshot_model.go | 45 +++-- api/router/file_router.go | 4 +- api/router/mosaic_router.go | 3 +- api/service/file_service.go | 16 +- api/service/insights_service.go | 41 ++-- api/service/mosaic_service.go | 29 +-- api/service/snapshot_service.go | 74 ++----- .../client/api_client/snapshot_client.go | 45 +++-- conversion/pipeline/mosaic_pipeline.go | 23 ++- conversion/pipeline/pdf_pipeline.go | 46 ++--- ui/src/client/api/snapshot.ts | 31 ++- 16 files changed, 327 insertions(+), 264 deletions(-) rename api/client/{ => conversion_client}/pipeline_client.go (98%) rename api/client/{ => language_client}/language_client.go (98%) rename api/client/{ => mosaic_client}/mosaic_client.go (99%) diff --git a/api/client/pipeline_client.go b/api/client/conversion_client/pipeline_client.go similarity index 98% rename from api/client/pipeline_client.go rename to api/client/conversion_client/pipeline_client.go index 95103d98a..105066de0 100644 --- a/api/client/pipeline_client.go +++ b/api/client/conversion_client/pipeline_client.go @@ -8,7 +8,7 @@ // by the GNU Affero General Public License v3.0 only, included in the file // licenses/AGPL.txt. -package client +package conversion_client import ( "bytes" diff --git a/api/client/language_client.go b/api/client/language_client/language_client.go similarity index 98% rename from api/client/language_client.go rename to api/client/language_client/language_client.go index a6f7f38ae..52419bb65 100644 --- a/api/client/language_client.go +++ b/api/client/language_client/language_client.go @@ -8,7 +8,7 @@ // by the GNU Affero General Public License v3.0 only, included in the file // licenses/AGPL.txt. -package client +package language_client import ( "bytes" diff --git a/api/client/mosaic_client.go b/api/client/mosaic_client/mosaic_client.go similarity index 99% rename from api/client/mosaic_client.go rename to api/client/mosaic_client/mosaic_client.go index 8297af5dc..44fe07761 100644 --- a/api/client/mosaic_client.go +++ b/api/client/mosaic_client/mosaic_client.go @@ -8,7 +8,7 @@ // by the GNU Affero General Public License v3.0 only, included in the file // licenses/AGPL.txt. -package client +package mosaic_client import ( "bytes" @@ -34,6 +34,12 @@ func NewMosaicClient() *MosaicClient { } } +type MosaicCreateOptions struct { + Path string + S3Key string + S3Bucket string +} + type MosaicMetadata struct { Width int `json:"width"` Height int `json:"height"` @@ -58,12 +64,6 @@ type MosaicTile struct { LastRowHeight int `json:"lastRowHeight"` } -type MosaicCreateOptions struct { - Path string - S3Key string - S3Bucket string -} - func (cl *MosaicClient) Create(opts MosaicCreateOptions) (*MosaicMetadata, error) { file, err := os.Open(opts.Path) if err != nil { diff --git a/api/docs/index.html b/api/docs/index.html index ed2ba82a8..886582d22 100644 --- a/api/docs/index.html +++ b/api/docs/index.html @@ -395,7 +395,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"
}

Create

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

Create

Create

query Parameters
type
required
string

Type

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

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

Delete One

Delete One

path Parameters
id
required
string

ID

@@ -433,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

@@ -445,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

@@ -497,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

@@ -519,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

@@ -553,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

@@ -563,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

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

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

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

Not Found

Response samples

Content type
application/json
{
  • "isAvailable": true,
  • "isOutdated": true,
  • "snapshot": {
    }
}

Download OCR

Response samples

Content type
application/json
{
  • "isAvailable": true,
  • "isOutdated": true,
  • "snapshot": {
    }
}

Download OCR

Download OCR

path Parameters
id
required
string

ID

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

Not Found

Response samples

Content type
application/json
{
  • "isAvailable": true,
  • "isOutdated": true,
  • "metadata": {
    },
  • "snapshot": {
    }
}

Download Tile

Response samples

Content type
application/json
{
  • "isAvailable": true,
  • "isOutdated": true,
  • "metadata": {
    },
  • "snapshot": {
    }
}

Download Tile

Download Tile

path Parameters
id
required
string

ID

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

Not Found

Response samples

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

Patch

Response samples

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

Patch

Patch

path Parameters
id
required
string

ID

@@ -1163,13 +1163,13 @@ " class="sc-eeDSqt sc-eBMFzZ bSgSrX gayXgA">

API Key

Request Body schema: application/json
required

Body

-
object (model.S3Object)
fields
Array of strings
object (model.S3Object)
object (model.S3Object)
object (client.PipelineRunOptions)
object (model.S3Object)
object (model.S3Object)
object (model.S3Object)
status
string
taskId
string
object (model.S3Object)
object (model.S3Object)

Responses

object (model.S3Object)
fields
Array of strings
object (model.S3Object)
object (model.S3Object)
object (conversion_client.PipelineRunOptions)
object (model.S3Object)
object (model.S3Object)
object (model.S3Object)
status
string
taskId
string
object (model.S3Object)
object (model.S3Object)

Responses

Request samples

Content type
application/json
{
  • "entities": {
    },
  • "fields": [
    ],
  • "mosaic": {
    },
  • "ocr": {
    },
  • "options": {
    },
  • "original": {
    },
  • "preview": {
    },
  • "segmentation": {
    },
  • "status": "string",
  • "taskId": "string",
  • "text": {
    },
  • "thumbnail": {
    }
}

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "entities": {
    },
  • "id": "string",
  • "isActive": true,
  • "language": "string",
  • "mosaic": {
    },
  • "ocr": {
    },
  • "original": {
    },
  • "preview": {
    },
  • "segmentation": {
    },
  • "status": "string",
  • "task": {
    },
  • "text": {
    },
  • "thumbnail": {
    },
  • "updateTime": "string",
  • "version": 0
}

Activate

Request samples

Content type
application/json
{
  • "entities": {
    },
  • "fields": [
    ],
  • "mosaic": {
    },
  • "ocr": {
    },
  • "options": {
    },
  • "original": {
    },
  • "preview": {
    },
  • "segmentation": {
    },
  • "status": "string",
  • "taskId": "string",
  • "text": {
    },
  • "thumbnail": {
    }
}

Response samples

Content type
application/json
{
  • "createTime": "string",
  • "entities": {
    },
  • "id": "string",
  • "isActive": true,
  • "language": "string",
  • "mosaic": {
    },
  • "ocr": {
    },
  • "original": {
    },
  • "preview": {
    },
  • "segmentation": {
    },
  • "status": "string",
  • "task": {
    },
  • "text": {
    },
  • "thumbnail": {
    },
  • "updateTime": "string",
  • "version": 0
}

Activate

Activate

path Parameters
id
required
string

ID

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