diff options
author | 2021-06-07 15:43:30 -0400 | |
---|---|---|
committer | 2021-06-07 15:43:30 -0400 | |
commit | 68e660d74131f92337a37362014056e6390d350f (patch) | |
tree | 6223c4445220dd1bc9f15810c9e5549e206c322c | |
parent | ced6bf516bb08073288d4ad0a47d136a504a95c8 (diff) |
Fix optional params in API, change collaborators to use username
Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Change-Id: Icb20015bd389ff7da3519f9eb596c0100609a29a
-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 |