diff --git a/app/api/resources/device.py b/app/api/resources/device.py index 682e2c8..0dc4cfa 100644 --- a/app/api/resources/device.py +++ b/app/api/resources/device.py @@ -107,6 +107,13 @@ class DeviceRecordingResource(ProtectedResource): return RecordingsWrapperSchema().dump( {'recordings': devices.get_device_recordings(device_id)}), 200 + @swag_from('swagger/create_device_recording_spec.yaml') + def post(self, device_id): + validate_device_ownership(device_id) + success = devices.create_recording(device_id, request.json) + if success: + return '', 201 + class DeviceListResource(ProtectedResource): @use_args(DeviceWrapperSchema()) diff --git a/app/api/resources/swagger/create_device_recording_spec.yaml b/app/api/resources/swagger/create_device_recording_spec.yaml new file mode 100644 index 0000000..77746cf --- /dev/null +++ b/app/api/resources/swagger/create_device_recording_spec.yaml @@ -0,0 +1,24 @@ +Creates new recoding +--- +tags: + - Recording + - Device +parameters: + - in: path + name: device_id + required: true + type: integer + description: Id of the device + - in: body + name: body + required: true + schema: + type: object + required: + - recording + properties: + recording: + $ref: '#/definitions/Recording' +responses: + 201: + description: Successful creation diff --git a/app/api/resources/swagger/update_dashboard_spec.yaml b/app/api/resources/swagger/update_dashboard_spec.yaml index a5ea00e..65ac84f 100644 --- a/app/api/resources/swagger/update_dashboard_spec.yaml +++ b/app/api/resources/swagger/update_dashboard_spec.yaml @@ -7,7 +7,7 @@ parameters: name: dashboard_id required: true type: integer - description: Id of the device + description: Id of the dashboard - in: body name: body required: true