Skip to content

Commit c43b75f

Browse files
committed
return v2 project info from project versions
1 parent 2183811 commit c43b75f

File tree

2 files changed

+7
-80
lines changed

2 files changed

+7
-80
lines changed

server/mergin/sync/public_api_v2.yaml

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ paths:
370370
content:
371371
application/json:
372372
schema:
373-
$ref: "#/components/schemas/Project"
373+
$ref: "#/components/schemas/ProjectDetail"
374374
"204":
375375
$ref: "#/components/responses/NoContent"
376376
"400":
@@ -845,84 +845,6 @@ components:
845845
type: string
846846
format: date-time
847847
example: 2019-02-26T08:47:58.636074Z
848-
Project:
849-
type: object
850-
required:
851-
- name
852-
properties:
853-
id:
854-
type: string
855-
example: f9ef87ac-1dae-48ab-85cb-062a4784fb83
856-
description: Project UUID
857-
name:
858-
type: string
859-
example: mergin
860-
namespace:
861-
type: string
862-
example: mergin
863-
creator:
864-
nullable: true
865-
type: integer
866-
example: 1
867-
description: Project creator ID
868-
created:
869-
type: string
870-
format: date-time
871-
example: 2018-11-30T08:47:58.636074Z
872-
updated:
873-
type: string
874-
nullable: true
875-
format: date-time
876-
example: 2018-11-30T08:47:58.636074Z
877-
description: Last modified
878-
version:
879-
type: string
880-
nullable: true
881-
example: v2
882-
description: Last project version
883-
disk_usage:
884-
type: integer
885-
example: 25324373
886-
description: Project size in bytes
887-
permissions:
888-
type: object
889-
properties:
890-
delete:
891-
type: boolean
892-
example: false
893-
update:
894-
type: boolean
895-
example: false
896-
upload:
897-
type: boolean
898-
example: true
899-
tags:
900-
type: array
901-
nullable: true
902-
items:
903-
$ref: "#/components/schemas/MerginTag"
904-
uploads:
905-
type: array
906-
nullable: true
907-
items:
908-
type: string
909-
example: 669b838e-a30b-4338-b2b6-3da144742a82
910-
description: UUID for ongoing upload
911-
access:
912-
$ref: "#/components/schemas/Access"
913-
files:
914-
type: array
915-
items:
916-
allOf:
917-
- $ref: "#/components/schemas/FileInfo"
918-
role:
919-
nullable: true
920-
type: string
921-
enum:
922-
- reader
923-
- editor
924-
- writer
925-
- owner
926848
ProjectChangeType:
927849
type: string
928850
enum: [create, update, delete, update_diff]

server/mergin/sync/public_api_v2_controller.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,12 @@ def create_project_version(id):
387387
finally:
388388
# remove artifacts
389389
upload.clear()
390-
return ProjectSchema().dump(project), 201
390+
391+
result = ProjectSchemaV2().dump(project)
392+
result["files"] = ProjectFileSchema(
393+
only=("path", "mtime", "size", "checksum"), many=True
394+
).dump(project.files)
395+
return result, 201
391396

392397

393398
@auth_required

0 commit comments

Comments
 (0)