Skip to content

Commit 583d864

Browse files
committed
slight renaming
1 parent 0e386d0 commit 583d864

File tree

5 files changed

+121
-121
lines changed

5 files changed

+121
-121
lines changed

services/api-server/openapi.json

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -451,13 +451,13 @@
451451
"schema": {
452452
"anyOf": [
453453
{
454-
"$ref": "#/components/schemas/ClientFileToProgramJob"
454+
"$ref": "#/components/schemas/UserFileToProgramJob"
455455
},
456456
{
457-
"$ref": "#/components/schemas/ClientFile"
457+
"$ref": "#/components/schemas/UserFile"
458458
}
459459
],
460-
"title": "User File"
460+
"title": "Client File"
461461
}
462462
}
463463
}
@@ -6045,44 +6045,44 @@
60456045
"schemas": {
60466046
"Body_abort_multipart_upload_v0_files__file_id__abort_post": {
60476047
"properties": {
6048-
"user_file": {
6048+
"client_file": {
60496049
"anyOf": [
60506050
{
6051-
"$ref": "#/components/schemas/ClientFileToProgramJob"
6051+
"$ref": "#/components/schemas/UserFileToProgramJob"
60526052
},
60536053
{
6054-
"$ref": "#/components/schemas/ClientFile"
6054+
"$ref": "#/components/schemas/UserFile"
60556055
}
60566056
],
6057-
"title": "User File"
6057+
"title": "Client File"
60586058
}
60596059
},
60606060
"type": "object",
60616061
"required": [
6062-
"user_file"
6062+
"client_file"
60636063
],
60646064
"title": "Body_abort_multipart_upload_v0_files__file_id__abort_post"
60656065
},
60666066
"Body_complete_multipart_upload_v0_files__file_id__complete_post": {
60676067
"properties": {
6068-
"user_file": {
6068+
"client_file": {
60696069
"anyOf": [
60706070
{
6071-
"$ref": "#/components/schemas/ClientFileToProgramJob"
6071+
"$ref": "#/components/schemas/UserFileToProgramJob"
60726072
},
60736073
{
6074-
"$ref": "#/components/schemas/ClientFile"
6074+
"$ref": "#/components/schemas/UserFile"
60756075
}
60766076
],
6077-
"title": "User File"
6077+
"title": "Client File"
60786078
},
60796079
"uploaded_parts": {
60806080
"$ref": "#/components/schemas/FileUploadCompletionBody"
60816081
}
60826082
},
60836083
"type": "object",
60846084
"required": [
6085-
"user_file",
6085+
"client_file",
60866086
"uploaded_parts"
60876087
],
60886088
"title": "Body_complete_multipart_upload_v0_files__file_id__complete_post"
@@ -6101,93 +6101,6 @@
61016101
],
61026102
"title": "Body_upload_file_v0_files_content_put"
61036103
},
6104-
"ClientFile": {
6105-
"properties": {
6106-
"filename": {
6107-
"type": "string",
6108-
"title": "Filename",
6109-
"description": "File name"
6110-
},
6111-
"filesize": {
6112-
"type": "integer",
6113-
"minimum": 0,
6114-
"title": "Filesize",
6115-
"description": "File size in bytes"
6116-
},
6117-
"sha256_checksum": {
6118-
"type": "string",
6119-
"pattern": "^[a-fA-F0-9]{64}$",
6120-
"title": "Sha256 Checksum",
6121-
"description": "SHA256 checksum"
6122-
}
6123-
},
6124-
"type": "object",
6125-
"required": [
6126-
"filename",
6127-
"filesize",
6128-
"sha256_checksum"
6129-
],
6130-
"title": "ClientFile",
6131-
"description": "Represents a file stored on the client side"
6132-
},
6133-
"ClientFileToProgramJob": {
6134-
"properties": {
6135-
"filename": {
6136-
"type": "string",
6137-
"pattern": ".+",
6138-
"title": "Filename",
6139-
"description": "File name"
6140-
},
6141-
"filesize": {
6142-
"type": "integer",
6143-
"minimum": 0,
6144-
"title": "Filesize",
6145-
"description": "File size in bytes"
6146-
},
6147-
"sha256_checksum": {
6148-
"type": "string",
6149-
"pattern": "^[a-fA-F0-9]{64}$",
6150-
"title": "Sha256 Checksum",
6151-
"description": "SHA256 checksum"
6152-
},
6153-
"program_key": {
6154-
"type": "string",
6155-
"pattern": "^simcore/services/dynamic/([a-z0-9][a-z0-9_.-]*/)*([a-z0-9-_]+[a-z0-9])$",
6156-
"title": "Program Key",
6157-
"description": "Program identifier"
6158-
},
6159-
"program_version": {
6160-
"type": "string",
6161-
"pattern": "^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){2}(-(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*)(\\.(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*))*)?(\\+[-\\da-zA-Z]+(\\.[-\\da-zA-Z-]+)*)?$",
6162-
"title": "Program Version",
6163-
"description": "Program version"
6164-
},
6165-
"job_id": {
6166-
"type": "string",
6167-
"format": "uuid",
6168-
"title": "Job Id",
6169-
"description": "Job identifier"
6170-
},
6171-
"workspace_path": {
6172-
"type": "string",
6173-
"pattern": "^workspace/.*",
6174-
"format": "path",
6175-
"title": "Workspace Path",
6176-
"description": "The file's relative path within the job's workspace directory. E.g. 'workspace/myfile.txt'"
6177-
}
6178-
},
6179-
"type": "object",
6180-
"required": [
6181-
"filename",
6182-
"filesize",
6183-
"sha256_checksum",
6184-
"program_key",
6185-
"program_version",
6186-
"job_id",
6187-
"workspace_path"
6188-
],
6189-
"title": "ClientFileToProgramJob"
6190-
},
61916104
"ClientFileUploadData": {
61926105
"properties": {
61936106
"file_id": {
@@ -8186,6 +8099,93 @@
81868099
],
81878100
"title": "UploadedPart"
81888101
},
8102+
"UserFile": {
8103+
"properties": {
8104+
"filename": {
8105+
"type": "string",
8106+
"title": "Filename",
8107+
"description": "File name"
8108+
},
8109+
"filesize": {
8110+
"type": "integer",
8111+
"minimum": 0,
8112+
"title": "Filesize",
8113+
"description": "File size in bytes"
8114+
},
8115+
"sha256_checksum": {
8116+
"type": "string",
8117+
"pattern": "^[a-fA-F0-9]{64}$",
8118+
"title": "Sha256 Checksum",
8119+
"description": "SHA256 checksum"
8120+
}
8121+
},
8122+
"type": "object",
8123+
"required": [
8124+
"filename",
8125+
"filesize",
8126+
"sha256_checksum"
8127+
],
8128+
"title": "UserFile",
8129+
"description": "Represents a file stored on the client side"
8130+
},
8131+
"UserFileToProgramJob": {
8132+
"properties": {
8133+
"filename": {
8134+
"type": "string",
8135+
"pattern": ".+",
8136+
"title": "Filename",
8137+
"description": "File name"
8138+
},
8139+
"filesize": {
8140+
"type": "integer",
8141+
"minimum": 0,
8142+
"title": "Filesize",
8143+
"description": "File size in bytes"
8144+
},
8145+
"sha256_checksum": {
8146+
"type": "string",
8147+
"pattern": "^[a-fA-F0-9]{64}$",
8148+
"title": "Sha256 Checksum",
8149+
"description": "SHA256 checksum"
8150+
},
8151+
"program_key": {
8152+
"type": "string",
8153+
"pattern": "^simcore/services/dynamic/([a-z0-9][a-z0-9_.-]*/)*([a-z0-9-_]+[a-z0-9])$",
8154+
"title": "Program Key",
8155+
"description": "Program identifier"
8156+
},
8157+
"program_version": {
8158+
"type": "string",
8159+
"pattern": "^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){2}(-(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*)(\\.(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*))*)?(\\+[-\\da-zA-Z]+(\\.[-\\da-zA-Z-]+)*)?$",
8160+
"title": "Program Version",
8161+
"description": "Program version"
8162+
},
8163+
"job_id": {
8164+
"type": "string",
8165+
"format": "uuid",
8166+
"title": "Job Id",
8167+
"description": "Job identifier"
8168+
},
8169+
"workspace_path": {
8170+
"type": "string",
8171+
"pattern": "^workspace/.*",
8172+
"format": "path",
8173+
"title": "Workspace Path",
8174+
"description": "The file's relative path within the job's workspace directory. E.g. 'workspace/myfile.txt'"
8175+
}
8176+
},
8177+
"type": "object",
8178+
"required": [
8179+
"filename",
8180+
"filesize",
8181+
"sha256_checksum",
8182+
"program_key",
8183+
"program_version",
8184+
"job_id",
8185+
"workspace_path"
8186+
],
8187+
"title": "UserFileToProgramJob"
8188+
},
81898189
"UserRoleEnum": {
81908190
"type": "string",
81918191
"enum": [

services/api-server/src/simcore_service_api_server/api/routes/files.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
from ...models.pagination import Page, PaginationParams
4141
from ...models.schemas.errors import ErrorGet
4242
from ...models.schemas.files import (
43-
ClientFile,
4443
ClientFileUploadData,
4544
)
4645
from ...models.schemas.files import File as OutputFile
4746
from ...models.schemas.files import (
4847
FileUploadData,
4948
UploadLinks,
49+
UserFile,
5050
)
51-
from ...models.schemas.jobs import ClientFileToProgramJob
51+
from ...models.schemas.jobs import UserFileToProgramJob
5252
from ...services_http.storage import StorageApi, StorageFileMetaData, to_file_api_model
5353
from ...services_http.webserver import AuthSession
5454
from ..dependencies.authentication import get_current_user_id
@@ -108,11 +108,11 @@ async def _get_file(
108108

109109

110110
async def _create_domain_file(
111-
webserver_api: AuthSession, client_file: ClientFile | ClientFileToProgramJob
111+
webserver_api: AuthSession, client_file: UserFile | UserFileToProgramJob
112112
) -> DomainFile:
113-
if isinstance(client_file, ClientFile):
113+
if isinstance(client_file, UserFile):
114114
file = client_file.to_domain_model()
115-
elif isinstance(client_file, ClientFileToProgramJob):
115+
elif isinstance(client_file, UserFileToProgramJob):
116116
project = await webserver_api.get_project(project_id=client_file.job_id)
117117
if len(project.workbench) > 1:
118118
raise HTTPException(
@@ -270,21 +270,21 @@ async def upload_files(files: list[UploadFile] = FileParam(...)):
270270
@cancel_on_disconnect
271271
async def get_upload_links(
272272
request: Request,
273-
user_file: ClientFileToProgramJob | ClientFile,
273+
client_file: UserFileToProgramJob | UserFile,
274274
user_id: Annotated[PositiveInt, Depends(get_current_user_id)],
275275
webserver_api: Annotated[AuthSession, Depends(get_webserver_session)],
276276
):
277277
"""Get upload links for uploading a file to storage"""
278278
assert request # nosec
279-
file_meta = await _create_domain_file(webserver_api, user_file)
279+
file_meta = await _create_domain_file(webserver_api, client_file)
280280
_, upload_links = await get_upload_links_from_s3(
281281
user_id=user_id,
282282
store_name=None,
283283
store_id=SIMCORE_LOCATION,
284284
s3_object=file_meta.storage_file_id,
285285
client_session=None,
286286
link_type=LinkType.PRESIGNED,
287-
file_size=ByteSize(user_file.filesize),
287+
file_size=ByteSize(client_file.filesize),
288288
is_directory=False,
289289
sha256_checksum=file_meta.sha256_checksum,
290290
)
@@ -382,7 +382,7 @@ async def delete_file(
382382
async def abort_multipart_upload(
383383
request: Request,
384384
file_id: UUID,
385-
user_file: Annotated[ClientFileToProgramJob | ClientFile, Body(..., embed=True)],
385+
client_file: Annotated[UserFileToProgramJob | UserFile, Body(..., embed=True)],
386386
storage_client: Annotated[StorageApi, Depends(get_api_client(StorageApi))],
387387
user_id: Annotated[PositiveInt, Depends(get_current_user_id)],
388388
webserver_api: Annotated[AuthSession, Depends(get_webserver_session)],
@@ -391,7 +391,7 @@ async def abort_multipart_upload(
391391
assert request # nosec
392392
assert user_id # nosec
393393

394-
file = await _create_domain_file(webserver_api, user_file)
394+
file = await _create_domain_file(webserver_api, client_file)
395395
abort_link: URL = await storage_client.create_abort_upload_link(
396396
file=file, query={"user_id": str(user_id)}
397397
)
@@ -409,7 +409,7 @@ async def abort_multipart_upload(
409409
async def complete_multipart_upload(
410410
request: Request,
411411
file_id: UUID,
412-
user_file: Annotated[ClientFileToProgramJob | ClientFile, Body(...)],
412+
client_file: Annotated[UserFileToProgramJob | UserFile, Body(...)],
413413
uploaded_parts: Annotated[FileUploadCompletionBody, Body(...)],
414414
storage_client: Annotated[StorageApi, Depends(get_api_client(StorageApi))],
415415
user_id: Annotated[PositiveInt, Depends(get_current_user_id)],
@@ -418,7 +418,7 @@ async def complete_multipart_upload(
418418
assert file_id # nosec
419419
assert request # nosec
420420
assert user_id # nosec
421-
file = await _create_domain_file(webserver_api, user_file)
421+
file = await _create_domain_file(webserver_api, client_file)
422422
complete_link: URL = await storage_client.create_complete_upload_link(
423423
file=file, query={"user_id": str(user_id)}
424424
)

services/api-server/src/simcore_service_api_server/models/schemas/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from ._utils import ApiServerInputSchema, ApiServerOutputSchema
1919

2020

21-
class ClientFile(ApiServerInputSchema):
21+
class UserFile(ApiServerInputSchema):
2222
"""Represents a file stored on the client side"""
2323

2424
filename: FileName = Field(..., description="File name")

0 commit comments

Comments
 (0)