1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

test group get api for swagger

This commit is contained in:
Kyle Spearrin 2019-02-28 20:51:47 -05:00
parent c02f732056
commit 6e4df8cb0b
2 changed files with 45 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using System;
using Bit.Core.Models.Api.Public;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@ -8,10 +9,23 @@ namespace Bit.Api.Public.Controllers
[Authorize("Organization")]
public class GroupsController : Controller
{
/// <summary>
/// Retrieves a specific product by unique id
/// </summary>
/// <remarks>Awesomeness!</remarks>
/// <response code="200">Group created</response>
/// <response code="400">Group has missing/invalid values</response>
/// <response code="500">Oops! Can't create your product right now</response>
[HttpGet("{id}")]
public JsonResult Get(string id)
[ProducesResponseType(typeof(GroupResponseModel), 200)]
public IActionResult Get(Guid id)
{
return new JsonResult("Hello " + id);
return new JsonResult(new GroupResponseModel(new Core.Models.Table.Group
{
Id = id,
Name = "test",
OrganizationId = Guid.NewGuid()
}));
}
}
}

View File

@ -0,0 +1,29 @@
using System;
using Bit.Core.Models.Table;
namespace Bit.Core.Models.Api.Public
{
public class GroupResponseModel : ResponseModel
{
public GroupResponseModel(Group group, string obj = "group")
: base(obj)
{
if(group == null)
{
throw new ArgumentNullException(nameof(group));
}
Id = group.Id;
OrganizationId = group.OrganizationId;
Name = group.Name;
AccessAll = group.AccessAll;
ExternalId = group.ExternalId;
}
public Guid Id { get; set; }
public Guid OrganizationId { get; set; }
public string Name { get; set; }
public bool AccessAll { get; set; }
public string ExternalId { get; set; }
}
}