Firebase_Implementation #135
@ -225,6 +225,13 @@ namespace MarcoBMS.Services.Controllers
|
||||
// Return a successful response with the generated tokens.
|
||||
_logger.LogInfo("User {Username} logged in successfully.", user.UserName);
|
||||
|
||||
var existingFCMTokenMapping = await _context.FCMTokenMappings.Where(ft => ft.FcmToken == loginDto.FcmToken).ToListAsync();
|
||||
|
||||
if (existingFCMTokenMapping.Any())
|
||||
{
|
||||
_context.FCMTokenMappings.RemoveRange(existingFCMTokenMapping);
|
||||
}
|
||||
|
||||
var fcmTokenMapping = new FCMTokenMapping
|
||||
{
|
||||
EmployeeId = emp.Id,
|
||||
@ -349,6 +356,13 @@ namespace MarcoBMS.Services.Controllers
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(verifyMPIN.FcmToken))
|
||||
{
|
||||
var existingFCMTokenMapping = await _context.FCMTokenMappings.Where(ft => ft.FcmToken == verifyMPIN.FcmToken).ToListAsync();
|
||||
|
||||
if (existingFCMTokenMapping.Any())
|
||||
{
|
||||
_context.FCMTokenMappings.RemoveRange(existingFCMTokenMapping);
|
||||
}
|
||||
|
||||
var fcmTokenMapping = new FCMTokenMapping
|
||||
{
|
||||
EmployeeId = requestEmployee.Id,
|
||||
@ -943,6 +957,14 @@ namespace MarcoBMS.Services.Controllers
|
||||
public async Task<IActionResult> StoreDeviceToken([FromBody] FCMTokenDto model)
|
||||
{
|
||||
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
|
||||
|
||||
var existingFCMTokenMapping = await _context.FCMTokenMappings.Where(ft => ft.FcmToken == model.FcmToken).ToListAsync();
|
||||
|
||||
if (existingFCMTokenMapping.Any())
|
||||
{
|
||||
_context.FCMTokenMappings.RemoveRange(existingFCMTokenMapping);
|
||||
}
|
||||
|
||||
var fcmTokenMapping = new FCMTokenMapping
|
||||
{
|
||||
EmployeeId = loggedInEmployee.Id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user