mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 01:22:50 -05:00
api for requesting installation ids
This commit is contained in:
32
src/Api/Controllers/InstallationsController.cs
Normal file
32
src/Api/Controllers/InstallationsController.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Api.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
[Route("installations")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public class InstallationsController : Controller
|
||||
{
|
||||
private readonly IInstallationRepository _installationRepository;
|
||||
|
||||
public InstallationsController(
|
||||
IInstallationRepository installationRepository)
|
||||
{
|
||||
_installationRepository = installationRepository;
|
||||
}
|
||||
|
||||
[HttpPost("")]
|
||||
[AllowAnonymous]
|
||||
public async Task<InstallationResponseModel> Post([FromBody] InstallationRequestModel model)
|
||||
{
|
||||
var installation = model.ToInstallation();
|
||||
await _installationRepository.CreateAsync(installation);
|
||||
return new InstallationResponseModel(installation);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user