♻️ No idea, but errors all gone
This commit is contained in:
@@ -31,28 +31,28 @@ public class ActionLogService : ServiceBase<IActionLogService>, IActionLogServic
|
||||
// fbs.Enqueue(log);
|
||||
}
|
||||
|
||||
public void CreateActionLogFromRequest(string action, Dictionary<string, object> meta, HttpRequest request,
|
||||
Shared.Models.Account? account = null)
|
||||
public async Task<ActionLog> CreateActionLogFromRequest(string type, Dictionary<string, object> meta, string? ipAddress, string? userAgent, Shared.Models.Account? account = null)
|
||||
{
|
||||
var log = new ActionLog
|
||||
{
|
||||
Action = action,
|
||||
Action = type,
|
||||
Meta = meta,
|
||||
UserAgent = request.Headers.UserAgent,
|
||||
IpAddress = request.HttpContext.Connection.RemoteIpAddress?.ToString(),
|
||||
// Location = geo.GetPointFromIp(request.HttpContext.Connection.RemoteIpAddress?.ToString())
|
||||
UserAgent = userAgent,
|
||||
IpAddress = ipAddress,
|
||||
// Location = geo.GetPointFromIp(ipAddress)
|
||||
};
|
||||
|
||||
if (request.HttpContext.Items["CurrentUser"] is Shared.Models.Account currentUser)
|
||||
log.AccountId = currentUser.Id;
|
||||
else if (account != null)
|
||||
if (account != null)
|
||||
log.AccountId = account.Id;
|
||||
else
|
||||
throw new ArgumentException("No user context was found");
|
||||
|
||||
if (request.HttpContext.Items["CurrentSession"] is Session currentSession)
|
||||
log.SessionId = currentSession.Id;
|
||||
// For MagicOnion, HttpContext.Items["CurrentSession"] is not directly available.
|
||||
// You might need to pass session ID explicitly if needed.
|
||||
// if (request.HttpContext.Items["CurrentSession"] is Session currentSession)
|
||||
// log.SessionId = currentSession.Id;
|
||||
|
||||
// fbs.Enqueue(log);
|
||||
return log;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user