1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

Explore making responses required and nullable

This commit is contained in:
Hinton 2024-02-09 12:44:04 +01:00
parent 0766806279
commit dfd1c22bae
No known key found for this signature in database
GPG Key ID: 5F7295599C5D965C
2 changed files with 16 additions and 21 deletions

View File

@ -1,4 +1,7 @@
using Bit.Core.Models.Api;
#nullable enable
using System.ComponentModel.DataAnnotations;
using Bit.Core.Models.Api;
using Bit.Core.SecretsManager.Entities;
namespace Bit.Api.SecretsManager.Models.Response;
@ -24,29 +27,25 @@ public class BaseSecretResponseModel : ResponseModel
Projects = secret.Projects?.Select(p => new SecretResponseInnerProject(p));
}
public BaseSecretResponseModel(string objectName = _objectName) : base(objectName)
{
}
[Required]
public Guid Id { get; }
public BaseSecretResponseModel() : base(_objectName)
{
}
[Required]
public Guid OrganizationId { get; }
public Guid Id { get; set; }
public string? Key { get; }
public Guid OrganizationId { get; set; }
public string? Value { get; }
public string Key { get; set; }
public string? Note { get; }
public string Value { get; set; }
[Required]
public DateTime CreationDate { get; }
public string Note { get; set; }
[Required]
public DateTime RevisionDate { get; }
public DateTime CreationDate { get; set; }
public DateTime RevisionDate { get; set; }
public IEnumerable<SecretResponseInnerProject> Projects { get; set; }
public IEnumerable<SecretResponseInnerProject>? Projects { get; init; }
public class SecretResponseInnerProject
{

View File

@ -12,10 +12,6 @@ public class SecretResponseModel : BaseSecretResponseModel
Write = write;
}
public SecretResponseModel() : base(_objectName)
{
}
public bool Read { get; set; }
public bool Write { get; set; }