mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 08:42:57 -07:00
Fixed duplicate key
This commit is contained in:
parent
7a422cd82e
commit
0ed2c014a8
2 changed files with 22 additions and 2 deletions
|
@ -282,7 +282,6 @@ namespace Ombi.Notifications
|
|||
{nameof(UserPreference),UserPreference},
|
||||
{nameof(DenyReason),DenyReason},
|
||||
{nameof(AvailableDate),AvailableDate},
|
||||
{nameof(RequestId),RequestId},
|
||||
};
|
||||
}
|
||||
}
|
|
@ -56,5 +56,26 @@ namespace Ombi.Controllers.V2
|
|||
}
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
[HttpDelete("Notification")]
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(200)]
|
||||
public async Task<IActionResult> RemoveNotifications()
|
||||
{
|
||||
|
||||
var user = await _userManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase));
|
||||
// Check if we already have this notification id
|
||||
var currentDevices = await _mobileDevices.GetAll().Where(x => x.UserId == user.Id).ToListAsync();
|
||||
|
||||
if (currentDevices == null || !currentDevices.Any())
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
|
||||
await _mobileDevices.DeleteRange(currentDevices);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue