This commit is contained in:
@@ -8,6 +8,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
internal static class EventLogProcessor
|
internal static class EventLogProcessor
|
||||||
{
|
{
|
||||||
|
private const int DEFAULT_EVENT_LIMIT = 20;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add an entry to the log
|
/// Add an entry to the log
|
||||||
@@ -53,9 +54,9 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
q = q.Where(m => m.AyId == opt.AyId);
|
q = q.Where(m => m.AyId == opt.AyId);
|
||||||
q = q.OrderBy(m => m.Created);
|
q = q.OrderBy(m => m.Created);
|
||||||
var limit = opt.Limit ?? 100;
|
var limit = opt.Limit ?? DEFAULT_EVENT_LIMIT;
|
||||||
var offset = opt.Offset ?? 0;
|
var offset = opt.Offset ?? 0;
|
||||||
q = q.OrderBy(m => m.Created);
|
q = q.Skip(offset).Take(limit);
|
||||||
|
|
||||||
//Execute the query
|
//Execute the query
|
||||||
var EventItems = await q.ToArrayAsync();
|
var EventItems = await q.ToArrayAsync();
|
||||||
@@ -89,14 +90,19 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
AyaNova.Api.Controllers.EventLogController.UserEventLog ret = new Api.Controllers.EventLogController.UserEventLog();
|
AyaNova.Api.Controllers.EventLogController.UserEventLog ret = new Api.Controllers.EventLogController.UserEventLog();
|
||||||
|
|
||||||
//Set up the query
|
// var user = "johndoe";
|
||||||
var q = ct.Event.Select(m => m);
|
|
||||||
|
|
||||||
q = q.Where(m => m.UserId == opt.UserId);
|
// var blogs = context.Blogs
|
||||||
var limit = opt.Limit ?? 100;
|
// .FromSqlInterpolated($"EXECUTE dbo.GetMostPopularBlogsForUser {user}")
|
||||||
|
// .ToList();
|
||||||
|
// var qLimitOffset = $"LIMIT {listOptions.Limit} OFFSET {listOptions.Offset}";
|
||||||
|
var limit = opt.Limit ?? DEFAULT_EVENT_LIMIT;
|
||||||
var offset = opt.Offset ?? 0;
|
var offset = opt.Offset ?? 0;
|
||||||
|
//Set up the query
|
||||||
|
var q = ct.Event.Select(m => m).Skip(offset).Take(limit);
|
||||||
|
q = q.Where(m => m.UserId == opt.UserId);
|
||||||
q = q.OrderBy(m => m.Created);
|
q = q.OrderBy(m => m.Created);
|
||||||
q.Skip(offset).Take(limit);
|
|
||||||
|
|
||||||
//Execute the query
|
//Execute the query
|
||||||
var EventItems = await q.ToArrayAsync();
|
var EventItems = await q.ToArrayAsync();
|
||||||
|
|||||||
Reference in New Issue
Block a user