1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Revert "[SM-1197] - Duplicate GUIDS Show a more detailed error message if dup…" (#4190)

This reverts commit 43b34c433c.
This commit is contained in:
cd-bitwarden
2024-06-14 13:45:17 -04:00
committed by GitHub
parent 43b34c433c
commit 41ed38080f
2 changed files with 2 additions and 56 deletions

View File

@ -1,22 +1,9 @@
using System.ComponentModel.DataAnnotations;
namespace Bit.Api.SecretsManager.Models.Request;
public class GetSecretsRequestModel : IValidatableObject
public class GetSecretsRequestModel
{
[Required]
public IEnumerable<Guid> Ids { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var isDistinct = Ids.Distinct().Count() == Ids.Count();
if (!isDistinct)
{
var duplicateGuids = Ids.GroupBy(x => x)
.Where(g => g.Count() > 1)
.Select(g => g.Key);
yield return new ValidationResult(
$"The following GUIDs were duplicated {string.Join(", ", duplicateGuids)} ",
new[] { nameof(GetSecretsRequestModel) });
}
}
}