This commit is contained in:
2020-12-15 15:49:27 +00:00
parent 9c65341b49
commit 477c0e90b1
6 changed files with 24 additions and 11 deletions

View File

@@ -60,7 +60,7 @@ namespace AyaNova.Biz
}
}
// ////////////////////////////////////////////////////////////////////////////////////////////////
// //DUPLICATE
@@ -100,14 +100,24 @@ namespace AyaNova.Biz
//
internal async Task<Memo> GetAsync(long id, bool logTheGetEvent = true)
{
var ret = await ct.Memo.SingleOrDefaultAsync(m => m.Id == id && m.ToId==UserId);//## SECURITY, if need general purpose then make new method
var ret = await ct.Memo.SingleOrDefaultAsync(m => m.Id == id && m.ToId == UserId);//## SECURITY, if need general purpose then make new method
if (logTheGetEvent && ret != null)
{
//Hijack this method to also flag as read
//batch ops will get but will set logthegetevent as false which is helpful for also setting read or not
if (!ret.Viewed)
{
//FLAG VIEWED
ret.Viewed = true;
await ct.SaveChangesAsync();
}
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
}
return ret;
}
////////////////////////////////////////////////////////////////////////////////////////////////
//UPDATE - ## NOTE: only internally, not exposed to controller route only here for batch ops
//