This commit is contained in:
@@ -6,6 +6,8 @@ using Microsoft.Extensions.Logging;
|
||||
using AyaNova.Models;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using AyaNova.Biz;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AyaNova.Api.Controllers
|
||||
{
|
||||
@@ -33,7 +35,7 @@ namespace AyaNova.Api.Controllers
|
||||
serverState = apiServerState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Create NotifySubscription
|
||||
/// </summary>
|
||||
/// <param name="newObject"></param>
|
||||
@@ -122,7 +124,7 @@ namespace AyaNova.Api.Controllers
|
||||
else
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
|
||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -145,6 +147,34 @@ namespace AyaNova.Api.Controllers
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get Subscription list
|
||||
/// </summary>
|
||||
/// <returns>User's notification subscription list </returns>
|
||||
[HttpGet("list")]
|
||||
public async Task<IActionResult> GetQueue()
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
//NOTE: in future if getting list for another user should just duplicate this method but add the parameter for user id
|
||||
//and checking of rights
|
||||
long UserId = UserIdFromContext.Id(HttpContext.Items);
|
||||
|
||||
var ret = await ct.NotifySubscription.Where(z => z.UserId == UserId).Select(z => new
|
||||
{
|
||||
z.Id,
|
||||
z.UserId,
|
||||
z.EventType,
|
||||
z.AyaType,
|
||||
z.DeliveryMethod,
|
||||
z.DeliveryAddress,
|
||||
z.Tags
|
||||
}).ToListAsync();
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
//------------
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user