diff options
-rw-r--r-- | laas_api_documentation.yaml | 49 | ||||
-rw-r--r-- | src/booking/quick_deployer.py | 4 |
2 files changed, 49 insertions, 4 deletions
diff --git a/laas_api_documentation.yaml b/laas_api_documentation.yaml index 5528e5a..d16497d 100644 --- a/laas_api_documentation.yaml +++ b/laas_api_documentation.yaml @@ -226,6 +226,9 @@ securityDefinitions: definitions: Lab: type: object + required: + - id + - name properties: id: type: integer @@ -234,6 +237,14 @@ definitions: type: string MakeBookingTemplate: type: object + required: + - templateID + - purpose + - project + - collaborators + - hostname + - length + - imageLabID properties: templateID: type: integer @@ -244,15 +255,27 @@ definitions: collaborators: type: array items: - type: integer + type: string + description: username of the referred user hostname: type: string length: type: integer + description: length of the booking in days (max 21, min 1) imageLabID: type: integer Booking: type: object + required: + - id + - owner + - collaborators + - start + - end + - lab + - purpose + - project + - resourceBundle properties: id: type: integer @@ -260,7 +283,9 @@ definitions: owner: type: string collaborators: - $ref: '#/definitions/UserProfile' + type: array + items: + $ref: '#/definitions/UserProfile' start: type: string format: date-time @@ -277,6 +302,9 @@ definitions: type: string Image: type: object + required: + - labID + - resources properties: labID: type: integer @@ -285,6 +313,9 @@ definitions: type: string ResourceBundle: type: object + required: + - id + - resources properties: id: type: integer @@ -295,6 +326,9 @@ definitions: $ref: '#/definitions/Server' ResourceProfile: type: object + required: + - id + - name properties: id: type: integer @@ -303,6 +337,9 @@ definitions: type: string UserProfile: type: object + required: + - id + - name properties: id: type: integer @@ -311,6 +348,10 @@ definitions: type: string ResourceTemplate: type: object + required: + - id + - name + - resourceProfiles properties: id: type: integer @@ -323,6 +364,10 @@ definitions: $ref: '#/definitions/ResourceProfile' Server: type: object + required: + - id + - labid + - profile properties: id: type: integer diff --git a/src/booking/quick_deployer.py b/src/booking/quick_deployer.py index 65dd9b2..5e5bc8b 100644 --- a/src/booking/quick_deployer.py +++ b/src/booking/quick_deployer.py @@ -219,8 +219,8 @@ def create_from_API(body, user): data = {} data['purpose'] = booking_info['purpose'] data['project'] = booking_info['project'] - data['users'] = [UserProfile.objects.get(pk=user_id) - for user_id in booking_info['collaborators']] + data['users'] = [UserProfile.objects.get(user__username=username) + for username in booking_info['collaborators']] data['hostname'] = booking_info['hostname'] data['length'] = booking_info['length'] data['installer'] = None |