Skip to content

Commit 0eaad74

Browse files
committed
Remove sort order, rename ucs stuff to be generic, various doc string and comment fixes
1 parent 27a3437 commit 0eaad74

26 files changed

+228
-252
lines changed

.devcontainer/.dev_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mongo_dsn: mongodb://localhost:27017
44
db_name: uos
55
mongo_timeout: 300
66
auth_key: "{}"
7-
ucs_url: http://127.0.0.1/upload
7+
file_box_service_url: http://127.0.0.1/upload
88
access_url: http://127.0.0.1/access
99
audit_record_topic: audit-records
1010
audit_record_type: audit_record_logged

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ The service requires the following configuration parameters:
9494
```
9595

9696

97-
- <a id="properties/ucs_url"></a>**`ucs_url`** *(string, required)*: URL pointing to the UCS API.
97+
- <a id="properties/file_box_service_url"></a>**`file_box_service_url`** *(string, format: uri, required)*: URL pointing to the API of the service that owns FileUploadBoxes (currently the UCS). Length must be between 1 and 2083 (inclusive).
9898

9999

100100
Examples:
@@ -114,7 +114,7 @@ The service requires the following configuration parameters:
114114
```
115115

116116

117-
- <a id="properties/access_url"></a>**`access_url`** *(string, required)*: URL pointing to the internal access API.
117+
- <a id="properties/access_url"></a>**`access_url`** *(string, format: uri, required)*: URL pointing to the internal access API. Length must be between 1 and 2083 (inclusive).
118118

119119

120120
Examples:

config_schema.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@
3535
"title": "Audit Record Type",
3636
"type": "string"
3737
},
38-
"ucs_url": {
39-
"description": "URL pointing to the UCS API.",
38+
"file_box_service_url": {
39+
"description": "URL pointing to the API of the service that owns FileUploadBoxes (currently the UCS).",
4040
"examples": [
4141
"http://127.0.0.1/upload"
4242
],
43-
"title": "Ucs Url",
43+
"format": "uri",
44+
"maxLength": 2083,
45+
"minLength": 1,
46+
"title": "File Box Service Url",
4447
"type": "string"
4548
},
4649
"work_order_signing_key": {
@@ -58,6 +61,9 @@
5861
"examples": [
5962
"http://127.0.0.1/access"
6063
],
64+
"format": "uri",
65+
"maxLength": 2083,
66+
"minLength": 1,
6167
"title": "Access Url",
6268
"type": "string"
6369
},
@@ -494,7 +500,7 @@
494500
"file_upload_box_topic",
495501
"audit_record_topic",
496502
"audit_record_type",
497-
"ucs_url",
503+
"file_box_service_url",
498504
"work_order_signing_key",
499505
"access_url",
500506
"service_instance_id",

example_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ cors_exposed_headers: null
2121
db_name: uos
2222
docs_url: /docs
2323
enable_opentelemetry: false
24+
file_box_service_url: http://127.0.0.1/upload
2425
file_upload_box_topic: file-upload-boxes
2526
generate_correlation_id: true
2627
host: 127.0.0.1
@@ -48,6 +49,5 @@ port: 8080
4849
research_data_upload_box_topic: research-data-upload-boxes
4950
service_instance_id: '1'
5051
service_name: uos
51-
ucs_url: http://127.0.0.1/upload
5252
work_order_signing_key: '**********'
5353
workers: 1

openapi.yaml

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,6 @@ components:
1919
- boxes
2020
title: BoxRetrievalResults
2121
type: object
22-
ClaimValidity:
23-
description: Start and end dates for validating claims.
24-
properties:
25-
valid_from:
26-
description: Start date of validity
27-
examples:
28-
- '2023-01-01T00:00:00Z'
29-
format: date-time
30-
title: Valid From
31-
type: string
32-
valid_until:
33-
description: End date of validity
34-
examples:
35-
- '2023-12-31T23:59:59Z'
36-
format: date-time
37-
title: Valid Until
38-
type: string
39-
required:
40-
- valid_from
41-
- valid_until
42-
title: ClaimValidity
43-
type: object
4422
CreateUploadBoxRequest:
4523
description: Request model for creating a new research data upload box.
4624
properties:
@@ -83,14 +61,36 @@ components:
8361
title: User Id
8462
type: string
8563
validity:
86-
$ref: '#/components/schemas/ClaimValidity'
64+
$ref: '#/components/schemas/GrantValidity'
8765
required:
8866
- validity
8967
- user_id
9068
- iva_id
9169
- box_id
9270
title: GrantAccessRequest
9371
type: object
72+
GrantValidity:
73+
description: Start and end dates for validating grants.
74+
properties:
75+
valid_from:
76+
description: Start date of validity
77+
examples:
78+
- '2023-01-01T00:00:00Z'
79+
format: date-time
80+
title: Valid From
81+
type: string
82+
valid_until:
83+
description: End date of validity
84+
examples:
85+
- '2023-12-31T23:59:59Z'
86+
format: date-time
87+
title: Valid Until
88+
type: string
89+
required:
90+
- valid_from
91+
- valid_until
92+
title: GrantValidity
93+
type: object
9494
GrantWithBoxInfo:
9595
description: An UploadGrant with the ResearchDataUploadBox title and description.
9696
properties:
@@ -197,7 +197,7 @@ components:
197197
title: File Count
198198
type: integer
199199
file_upload_box_id:
200-
description: The ID of the file upload box.
200+
description: The ID of the corresponding file upload box.
201201
format: uuid4
202202
title: File Upload Box Id
203203
type: string
@@ -251,13 +251,6 @@ components:
251251
- closed
252252
title: ResearchDataUploadBoxState
253253
type: string
254-
SortOrder:
255-
description: Represents the possible sorting orders
256-
enum:
257-
- ascending
258-
- descending
259-
title: SortOrder
260-
type: string
261254
UpdateUploadBoxRequest:
262255
description: Request model for updating a research data upload box.
263256
properties:
@@ -464,14 +457,6 @@ paths:
464457
- type: 'null'
465458
description: Maximum number of research data upload boxes to return
466459
title: Limit
467-
- description: Sort order(s) that shall be used when sorting results
468-
in: query
469-
name: sort
470-
required: false
471-
schema:
472-
$ref: '#/components/schemas/SortOrder'
473-
default: ascending
474-
description: Sort order(s) that shall be used when sorting results
475460
responses:
476461
'200':
477462
content:

scripts/compare_class_defs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import inspect
2020

2121
# Import the abstract base classes and their implementations
22-
from uos.adapters.outbound.http import AccessClient, UCSClient # noqa: F401
22+
from uos.adapters.outbound.http import AccessClient, FileBoxClient # noqa: F401
2323
from uos.core.orchestrator import UploadOrchestrator # noqa: F401
2424
from uos.ports.inbound.orchestrator import UploadOrchestratorPort
25-
from uos.ports.outbound.http import AccessClientPort, UCSClientPort
25+
from uos.ports.outbound.http import AccessClientPort, FileBoxClientPort
2626

2727

2828
def print_links(abc_method: type, imp_method: type):
@@ -68,7 +68,7 @@ def check_implementation(abc_class: type):
6868

6969
def main():
7070
"""Test me"""
71-
ports = [AccessClientPort, UCSClientPort, UploadOrchestratorPort]
71+
ports = [AccessClientPort, FileBoxClientPort, UploadOrchestratorPort]
7272
for port in ports:
7373
check_implementation(port)
7474

src/uos/adapters/inbound/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
"""Subpackage defining a inbound/primary/driving adapters according to the
16+
"""Subpackage defining inbound/primary/driving adapters according to the
1717
Hexagonal Architecture Concept."""

src/uos/adapters/inbound/event_sub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async def changed(self, resource_id: str, update: FileUploadBox) -> None:
6363
await self._upload_orchestrator.upsert_file_upload_box(file_upload_box=update)
6464

6565
async def deleted(self, resource_id: str) -> None:
66-
"""Consume a deleted FileUploadBox event and remove from own storage"""
66+
"""Consume a deleted FileUploadBox event -- these don't exist and are ignored"""
6767
log.warning(
6868
"Encountered 'deleted' event for FileUploadBox %s. Ignoring.", resource_id
6969
)

src/uos/adapters/inbound/fastapi_/dummies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
]
3737

3838
auth_provider = DependencyDummy("auth_provider")
39-
upload_orchestrator_port = DependencyDummy("work_package_repo_port")
39+
upload_orchestrator_port = DependencyDummy("upload_orchestrator_port")
4040

4141
AuthProviderDummy = Annotated[AuthContextProtocol[AuthContext], Depends(auth_provider)]
4242
UploadOrchestratorDummy = Annotated[

src/uos/adapters/inbound/fastapi_/http_exceptions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,18 @@ class DataModel(BaseModel):
102102

103103
skip: int | None
104104
limit: int | None
105-
sort: str
106105

107106
def __init__(
108107
self,
109108
*,
110109
message: str = "There was a problem with the supplied pagination parameters.",
111110
skip: int | None,
112111
limit: int | None,
113-
sort: str,
114112
status_code: int = 422,
115113
):
116114
"""Construct message and init the exception."""
117115
super().__init__(
118116
status_code=status_code,
119117
description=message,
120-
data={"skip": skip, "limit": limit, "sort": sort},
118+
data={"skip": skip, "limit": limit},
121119
)

0 commit comments

Comments
 (0)