diff --git a/odex25_mobile/odex_mobile/controllers/rest_api_v2/__init__.py b/odex25_mobile/odex_mobile/controllers/rest_api_v2/__init__.py index 8a1f3abc0..af62a98fc 100644 --- a/odex25_mobile/odex_mobile/controllers/rest_api_v2/__init__.py +++ b/odex25_mobile/odex_mobile/controllers/rest_api_v2/__init__.py @@ -12,3 +12,4 @@ from . import employee_other_request from . import content_common from . import official_mission from . import atendance_register +from . import fcm \ No newline at end of file diff --git a/odex25_mobile/odex_mobile/controllers/rest_api_v2/fcm.py b/odex25_mobile/odex_mobile/controllers/rest_api_v2/fcm.py new file mode 100644 index 000000000..63a791b42 --- /dev/null +++ b/odex25_mobile/odex_mobile/controllers/rest_api_v2/fcm.py @@ -0,0 +1,17 @@ +from odoo import http +from odoo.http import request + + +class FcmController(http.Controller): + + @http.route('/fcm/update', type='json', auth="public", website=True) + def update_fcm_token(self, **kw): + partner_id = kw.get('partner_id') + fcm_token = kw.get('token') + try: + if partner_id and fcm_token and len(fcm_token): + request.env['res.partner'].search([('id', '=', int(partner_id))]).write({'fcm_token': fcm_token}) + except Exception: + return False + return True + \ No newline at end of file