This commit is contained in:
@@ -57,17 +57,15 @@ namespace AyaNova.Api.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("new-count")]
|
||||
public ActionResult GetNewCount()
|
||||
public async Task<IActionResult> GetNewCount()
|
||||
{
|
||||
//STUB: https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3783
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
System.Random rnd = new System.Random();
|
||||
int RandomNewCount = rnd.Next(20);
|
||||
return Ok(ApiOkResponse.Response(RandomNewCount));
|
||||
var UserId = UserIdFromContext.Id(HttpContext.Items);
|
||||
return Ok(ApiOkResponse.Response(await ct.Notification.CountAsync(z => z.UserId == UserId && z.Fetched == false)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace AyaNova.Models
|
||||
public long Id { get; set; }
|
||||
public uint Concurrency { get; set; }
|
||||
|
||||
[Required]
|
||||
public long UserId { get; set; }
|
||||
[Required]
|
||||
public DateTime Created { get; set; }
|
||||
public AyaType? AyaType { get; set; }
|
||||
@@ -24,12 +26,12 @@ namespace AyaNova.Models
|
||||
public long SubscriptionId { get; set; }
|
||||
public string Message { get; set; }
|
||||
[Required]
|
||||
public bool Fetched {get;set;}
|
||||
public bool Fetched { get; set; }
|
||||
|
||||
public Notification()
|
||||
{
|
||||
Created = DateTime.UtcNow;
|
||||
Fetched=false;
|
||||
Fetched = false;
|
||||
}
|
||||
|
||||
}//eoc
|
||||
|
||||
@@ -690,7 +690,7 @@ $BODY$;
|
||||
await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " +
|
||||
"ayatype integer, objectid bigint, eventtype integer not null, subscriptionid bigint not null, idvalue bigint, decvalue decimal(19,4), eventdate timestamp, message text)");
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, ayatype integer, objectid bigint, eventtype integer not null, " +
|
||||
await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null, created timestamp not null, ayatype integer, objectid bigint, eventtype integer not null, " +
|
||||
"subscriptionid bigint not null, message text, fetched bool not null)");
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed timestamp not null, ayatype integer, objectid bigint, " +
|
||||
|
||||
Reference in New Issue
Block a user