[ADD] pms_api_rest: module created

This commit is contained in:
miguelpadin
2021-07-26 13:07:37 +02:00
committed by Darío Lodeiros
parent 02f8f126ca
commit 75f453adec
15 changed files with 317 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
from odoo.addons.base_rest.controllers import main
from ..lib.jwt_http import jwt_http
from ..lib.validator import validator
class BaseRestDemoPublicApiController(main.RestController):
_root_path = "/api/"
_collection_name = "pms.reservation.service"
_default_auth = "public"
# RestController OVERRIDE method
def _process_method(self, service_name, method_name, *args, params=None):
http_method, body, headers, token = jwt_http.parse_request()
result = validator.verify_token(token)
if not result["status"]:
return jwt_http.errcode(code=result["code"], message=result["message"])
else:
return super(BaseRestDemoPublicApiController, self)._process_method(
service_name, method_name, *args, params=params
)