From c0e2890ffc71e0d887e8e75c0530d8a64e796128 Mon Sep 17 00:00:00 2001 From: Abdurrahman Saber Date: Mon, 22 Sep 2025 11:29:14 +0300 Subject: [PATCH] [IMP] odex_mobile: store fcm token endpoint --- .../controllers/rest_api_v2/__init__.py | 1 + .../odex_mobile/controllers/rest_api_v2/fcm.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 odex25_mobile/odex_mobile/controllers/rest_api_v2/fcm.py 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