Merge pull request #4726 from expsa/ENS-3756
[IMP] odex_mobile: store fcm token endpoint
This commit is contained in:
commit
4b9a335bc8
|
|
@ -12,3 +12,4 @@ from . import employee_other_request
|
|||
from . import content_common
|
||||
from . import official_mission
|
||||
from . import atendance_register
|
||||
from . import fcm
|
||||
|
|
@ -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
|
||||
|
||||
Loading…
Reference in New Issue