From a1eb0f4c9054a1fa8f8990a5ef7c4bae28f10892 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 19 Nov 2020 17:00:30 +0100 Subject: [PATCH] end point receive --- ereuse_devicehub/resources/action/__init__.py | 4 ++-- ereuse_devicehub/resources/action/views.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/action/__init__.py b/ereuse_devicehub/resources/action/__init__.py index 59f49b46..6bbd3937 100644 --- a/ereuse_devicehub/resources/action/__init__.py +++ b/ereuse_devicehub/resources/action/__init__.py @@ -3,7 +3,7 @@ from typing import Callable, Iterable, Tuple from teal.resource import Converters, Resource from ereuse_devicehub.resources.action import schemas -from ereuse_devicehub.resources.action.views import ActionView +from ereuse_devicehub.resources.action.views import ActionView, ReceiveView from ereuse_devicehub.resources.device.sync import Sync @@ -249,7 +249,7 @@ class DisposeProductDef(ActionDef): class ReceiveDef(ActionDef): - VIEW = None + VIEW = ReceiveView SCHEMA = schemas.Receive diff --git a/ereuse_devicehub/resources/action/views.py b/ereuse_devicehub/resources/action/views.py index 2d71b4fd..8bc0f28b 100644 --- a/ereuse_devicehub/resources/action/views.py +++ b/ereuse_devicehub/resources/action/views.py @@ -6,6 +6,7 @@ import shutil from datetime import datetime from distutils.version import StrictVersion from uuid import UUID +from flask.json import jsonify from flask import current_app as app, request, g from sqlalchemy.util import OrderedSet @@ -168,3 +169,11 @@ class ActionView(View): def transfer_ownership(self): """Perform a InitTransfer action to change author_id of device""" pass + +class ReceiveView(View): + + def post(self): + return jsonify('Ok') + + def find(self, args): + return jsonify('Ok find')