This commit is contained in:
2020-07-10 18:09:01 +00:00
parent 671ab5cf2b
commit 1d529b1e73
3 changed files with 9 additions and 9 deletions

View File

@@ -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)));
}
//------------

View File

@@ -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

View File

@@ -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, " +