1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 00:22:50 -05:00

CipherDetails Edit property

This commit is contained in:
Kyle Spearrin
2017-05-06 23:23:01 -04:00
parent 3018655d7e
commit b039461ff4
20 changed files with 96 additions and 150 deletions

View File

@ -52,18 +52,19 @@ namespace Bit.Api.Controllers
}
[HttpGet("{id}/full-details")]
public async Task<CipherFullDetailsResponseModel> GetDetails(string id)
[HttpGet("{id}/details")]
public async Task<CipherDetailsResponseModel> GetDetails(string id)
{
var userId = _userService.GetProperUserId(User).Value;
var cipherId = new Guid(id);
var cipher = await _cipherRepository.GetFullDetailsByIdAsync(cipherId, userId);
var cipher = await _cipherRepository.GetByIdAsync(cipherId, userId);
if(cipher == null)
{
throw new NotFoundException();
}
var collectionCiphers = await _collectionCipherRepository.GetManyByUserIdCipherIdAsync(userId, cipherId);
return new CipherFullDetailsResponseModel(cipher, collectionCiphers);
return new CipherDetailsResponseModel(cipher, collectionCiphers);
}
[HttpGet("")]

View File

@ -41,16 +41,16 @@ namespace Bit.Api.Controllers
}
[HttpGet("{id}")]
public async Task<LoginDetailsResponseModel> Get(string id)
public async Task<LoginResponseModel> Get(string id)
{
var userId = _userService.GetProperUserId(User).Value;
var login = await _cipherRepository.GetFullDetailsByIdAsync(new Guid(id), userId);
var login = await _cipherRepository.GetByIdAsync(new Guid(id), userId);
if(login == null || login.Type != Core.Enums.CipherType.Login)
{
throw new NotFoundException();
}
var response = new LoginDetailsResponseModel(login);
var response = new LoginResponseModel(login);
return response;
}