Skip to content

Commit 3204c2c

Browse files
committed
return v2 project info from project versions
1 parent 08e99c0 commit 3204c2c

File tree

2 files changed

+8
-81
lines changed

2 files changed

+8
-81
lines changed

server/mergin/sync/public_api_v2.yaml

Lines changed: 2 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ paths:
330330
content:
331331
application/json:
332332
schema:
333-
$ref: "#/components/schemas/Project"
333+
$ref: "#/components/schemas/ProjectDetail"
334334
"204":
335335
$ref: "#/components/responses/NoContent"
336336
"400":
@@ -586,7 +586,7 @@ components:
586586
description: List of files in the project
587587
items:
588588
allOf:
589-
- $ref: '#/components/schemas/File'
589+
- $ref: "#/components/schemas/File"
590590
- type: object
591591
properties:
592592
mtime:
@@ -768,84 +768,6 @@ components:
768768
type: string
769769
format: date-time
770770
example: 2019-02-26T08:47:58.636074Z
771-
Project:
772-
type: object
773-
required:
774-
- name
775-
properties:
776-
id:
777-
type: string
778-
example: f9ef87ac-1dae-48ab-85cb-062a4784fb83
779-
description: Project UUID
780-
name:
781-
type: string
782-
example: mergin
783-
namespace:
784-
type: string
785-
example: mergin
786-
creator:
787-
nullable: true
788-
type: integer
789-
example: 1
790-
description: Project creator ID
791-
created:
792-
type: string
793-
format: date-time
794-
example: 2018-11-30T08:47:58.636074Z
795-
updated:
796-
type: string
797-
nullable: true
798-
format: date-time
799-
example: 2018-11-30T08:47:58.636074Z
800-
description: Last modified
801-
version:
802-
type: string
803-
nullable: true
804-
example: v2
805-
description: Last project version
806-
disk_usage:
807-
type: integer
808-
example: 25324373
809-
description: Project size in bytes
810-
permissions:
811-
type: object
812-
properties:
813-
delete:
814-
type: boolean
815-
example: false
816-
update:
817-
type: boolean
818-
example: false
819-
upload:
820-
type: boolean
821-
example: true
822-
tags:
823-
type: array
824-
nullable: true
825-
items:
826-
$ref: "#/components/schemas/MerginTag"
827-
uploads:
828-
type: array
829-
nullable: true
830-
items:
831-
type: string
832-
example: 669b838e-a30b-4338-b2b6-3da144742a82
833-
description: UUID for ongoing upload
834-
access:
835-
$ref: "#/components/schemas/Access"
836-
files:
837-
type: array
838-
items:
839-
allOf:
840-
- $ref: "#/components/schemas/FileInfo"
841-
role:
842-
nullable: true
843-
type: string
844-
enum:
845-
- reader
846-
- editor
847-
- writer
848-
- owner
849771
VersionName:
850772
type: string
851773
pattern: '^$|^v\d+$'

server/mergin/sync/public_api_v2_controller.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,12 @@ def create_project_version(id):
360360
finally:
361361
# remove artifacts
362362
upload.clear()
363-
return ProjectSchema().dump(project), 201
363+
364+
result = ProjectSchemaV2().dump(project)
365+
result["files"] = ProjectFileSchema(
366+
only=("path", "mtime", "size", "checksum"), many=True
367+
).dump(project.files)
368+
return result, 201
364369

365370

366371
@auth_required

0 commit comments

Comments
 (0)