1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 09:32:48 -05:00

organize event models. stub out event services

This commit is contained in:
Kyle Spearrin
2017-12-01 09:22:04 -05:00
parent ba9cca057e
commit f4586002c4
14 changed files with 194 additions and 91 deletions

View File

@ -0,0 +1,11 @@
using System;
using System.Threading.Tasks;
using Bit.Core.Enums;
namespace Bit.Core.Services
{
public interface IEventService
{
Task LogUserEventAsync(Guid userId, EventType type);
}
}

View File

@ -0,0 +1,28 @@
using System.Threading.Tasks;
using System;
using Bit.Core.Enums;
using Bit.Core.Repositories;
using Bit.Core.Models.Data;
namespace Bit.Core.Services
{
public class EventService : IEventService
{
private readonly IEventRepository _eventRepository;
private readonly GlobalSettings _globalSettings;
public EventService(
IEventRepository eventRepository,
GlobalSettings globalSettings)
{
_eventRepository = eventRepository;
_globalSettings = globalSettings;
}
public async Task LogUserEventAsync(Guid userId, EventType type)
{
var userEvent = new UserEvent(userId, type);
await _eventRepository.CreateAsync(userEvent);
}
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Threading.Tasks;
using Bit.Core.Enums;
namespace Bit.Core.Services
{
public class NoopEventService : IEventService
{
public Task LogUserEventAsync(Guid userId, EventType type)
{
return Task.FromResult(0);
}
}
}