public async Task PostNotification(int teamId, APSAlert alert, CancellationToken ct = default) { ICollection <User> users = await _userService.GetAllAsync(teamId : teamId); foreach (User user in users) { ICollection <string> apns = await _context.UserAPNS.Where(u => u.UserUUID == user.UserUUID).Select(u => u.APNSToken).ToListAsync(ct); foreach (string token in apns) { await _userService.PostNotification(token, Notification.CreateNotification(alert)); } } }
public async Task <IActionResult> PostNotificiation([FromBody] APSAlert notification, int teamId = 0, CancellationToken ct = default) { await _staffService.PostNotification(teamId, notification, ct); return(Ok()); }