1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-15 18:18:12 -05:00

event collection api endpoint

This commit is contained in:
Kyle Spearrin 2019-03-19 17:45:31 -04:00
parent 268b162c0a
commit c29ae6601f
2 changed files with 10 additions and 8 deletions

View File

@ -7,16 +7,17 @@ using Bit.Events.Models;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Events.Controllers namespace Bit.Events.Controllers
{ {
[Route("collect")]
[Authorize("Application")] [Authorize("Application")]
public class EventsController : Controller public class CollectController : Controller
{ {
private readonly CurrentContext _currentContext; private readonly CurrentContext _currentContext;
private readonly IEventService _eventService; private readonly IEventService _eventService;
private readonly ICipherRepository _cipherRepository; private readonly ICipherRepository _cipherRepository;
public EventsController( public CollectController(
CurrentContext currentContext, CurrentContext currentContext,
IEventService eventService, IEventService eventService,
ICipherRepository cipherRepository) ICipherRepository cipherRepository)
@ -26,14 +27,14 @@ namespace Events.Controllers
_cipherRepository = cipherRepository; _cipherRepository = cipherRepository;
} }
[HttpGet("~/collect")] [HttpGet]
public Task<IActionResult> GetCollect([FromQuery]EventModel model) public Task<IActionResult> Get([FromQuery]EventModel model)
{ {
return PostCollect(model); return Post(model);
} }
[HttpPost("~/collect")] [HttpPost]
public async Task<IActionResult> PostCollect([FromBody]EventModel model) public async Task<IActionResult> Post([FromBody]EventModel model)
{ {
switch(model.Type) switch(model.Type)
{ {

View File

@ -48,6 +48,7 @@ namespace Bit.Events
}); });
// Services // Services
services.AddSingleton<IApplicationCacheService, InMemoryApplicationCacheService>();
services.AddScoped<IEventService, EventService>(); services.AddScoped<IEventService, EventService>();
if(!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Events.ConnectionString)) if(!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Events.ConnectionString))
{ {