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:
parent
c02f732056
commit
6e4df8cb0b
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Bit.Core.Models.Api.Public;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
@ -8,10 +9,23 @@ namespace Bit.Api.Public.Controllers
|
|||||||
[Authorize("Organization")]
|
[Authorize("Organization")]
|
||||||
public class GroupsController : Controller
|
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}")]
|
[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()
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
src/Core/Models/Api/Public/Response/GroupResponseModel.cs
Normal file
29
src/Core/Models/Api/Public/Response/GroupResponseModel.cs
Normal 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; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user