mirror of
https://github.com/bitwarden/server.git
synced 2025-04-12 16:48:12 -05:00
event collection api endpoint
This commit is contained in:
parent
268b162c0a
commit
c29ae6601f
@ -7,16 +7,17 @@ using Bit.Events.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Events.Controllers
|
||||
namespace Bit.Events.Controllers
|
||||
{
|
||||
[Route("collect")]
|
||||
[Authorize("Application")]
|
||||
public class EventsController : Controller
|
||||
public class CollectController : Controller
|
||||
{
|
||||
private readonly CurrentContext _currentContext;
|
||||
private readonly IEventService _eventService;
|
||||
private readonly ICipherRepository _cipherRepository;
|
||||
|
||||
public EventsController(
|
||||
public CollectController(
|
||||
CurrentContext currentContext,
|
||||
IEventService eventService,
|
||||
ICipherRepository cipherRepository)
|
||||
@ -26,14 +27,14 @@ namespace Events.Controllers
|
||||
_cipherRepository = cipherRepository;
|
||||
}
|
||||
|
||||
[HttpGet("~/collect")]
|
||||
public Task<IActionResult> GetCollect([FromQuery]EventModel model)
|
||||
[HttpGet]
|
||||
public Task<IActionResult> Get([FromQuery]EventModel model)
|
||||
{
|
||||
return PostCollect(model);
|
||||
return Post(model);
|
||||
}
|
||||
|
||||
[HttpPost("~/collect")]
|
||||
public async Task<IActionResult> PostCollect([FromBody]EventModel model)
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Post([FromBody]EventModel model)
|
||||
{
|
||||
switch(model.Type)
|
||||
{
|
@ -48,6 +48,7 @@ namespace Bit.Events
|
||||
});
|
||||
|
||||
// Services
|
||||
services.AddSingleton<IApplicationCacheService, InMemoryApplicationCacheService>();
|
||||
services.AddScoped<IEventService, EventService>();
|
||||
if(!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Events.ConnectionString))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user