Skip to content

Commit

Permalink
EES-5047: Remove shared backend validation messaging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Jones committed Dec 18, 2024
1 parent 2c3c986 commit dd4f0b8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Threading.Tasks;
using static GovUk.Education.ExploreEducationStatistics.Common.Constants.ValidationConstants;

namespace GovUk.Education.ExploreEducationStatistics.Admin.Controllers.Api
{
Expand Down Expand Up @@ -109,7 +108,7 @@ public async Task<ActionResult<List<DataFileInfo>>> ReorderDataFiles(Guid releas
public async Task<ActionResult<DataFileInfo>> UploadDataSet(Guid releaseVersionId,
[FromQuery(Name = "replacingFileId")] Guid? replacingFileId,
[FromQuery(Name = "title")]
[MaxLength(SubjectTitleMaxLength, ErrorMessage = SubjectTitleMaxLengthMessage)]
[MaxLength(120)]
string title,
IFormFile file,
IFormFile metaFile)
Expand All @@ -129,7 +128,7 @@ public async Task<ActionResult<DataFileInfo>> UploadDataSet(Guid releaseVersionI
public async Task<ActionResult<DataFileInfo>> UploadDataSetAsZip(Guid releaseVersionId,
[FromQuery(Name = "replacingFileId")] Guid? replacingFileId,
[FromQuery(Name = "title")]
[MaxLength(SubjectTitleMaxLength, ErrorMessage = SubjectTitleMaxLengthMessage)]
[MaxLength(120)]
string title,
IFormFile zipFile)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using GovUk.Education.ExploreEducationStatistics.Common.Model.Data;
using GovUk.Education.ExploreEducationStatistics.Common.Requests;
using System.Collections.Generic;
using static GovUk.Education.ExploreEducationStatistics.Common.Constants.ValidationConstants;

namespace GovUk.Education.ExploreEducationStatistics.Admin.Requests;

Expand All @@ -28,8 +27,7 @@ public Validator()
{
RuleFor(request => request.Heading)
.NotEmpty()
.MaximumLength(TableTitleMaxLength)
.WithMessage(TableTitleMaxLengthMessage);
.MaximumLength(120);

RuleFor(request => request.Name)
.NotEmpty();
Expand Down Expand Up @@ -60,8 +58,7 @@ public Validator()
{
RuleFor(request => request.Heading)
.NotEmpty()
.MaximumLength(TableTitleMaxLength)
.WithMessage(TableTitleMaxLengthMessage);
.MaximumLength(120);

RuleFor(request => request.Name)
.NotEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using FluentValidation;
using System;
using System.Collections.Generic;
using static GovUk.Education.ExploreEducationStatistics.Common.Constants.ValidationConstants;

namespace GovUk.Education.ExploreEducationStatistics.Admin.Requests;

Expand Down Expand Up @@ -40,8 +39,7 @@ public Validator()

RuleFor(request => request.Content)
.NotEmpty()
.MaximumLength(FileGuidanceContentMaxLength)
.WithMessage(FileGuidanceContentMaxLengthMessage);
.MaximumLength(250);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#nullable enable
using FluentValidation;
using System;
using static GovUk.Education.ExploreEducationStatistics.Common.Constants.ValidationConstants;

namespace GovUk.Education.ExploreEducationStatistics.Admin.Requests;

Expand All @@ -19,13 +18,11 @@ public Validator()
{
RuleFor(request => request.Name)
.NotEmpty()
.MaximumLength(FeaturedTableNameMaxLength)
.WithMessage(FeaturedTableNameMaxLengthMessage);
.MaximumLength(120);

RuleFor(request => request.Description)
.NotEmpty()
.MaximumLength(FeaturedTableDescriptionMaxLength)
.WithMessage(FeaturedTableDescriptionMaxLengthMessage);
.MaximumLength(200);
}
}
}
Expand All @@ -42,13 +39,11 @@ public Validator()
{
RuleFor(request => request.Name)
.NotEmpty()
.MaximumLength(FeaturedTableNameMaxLength)
.WithMessage(FeaturedTableNameMaxLengthMessage);
.MaximumLength(120);

RuleFor(request => request.Description)
.NotEmpty()
.MaximumLength(FeaturedTableDescriptionMaxLength)
.WithMessage(FeaturedTableDescriptionMaxLengthMessage);
.MaximumLength(200);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#nullable enable
using FluentValidation;
using Microsoft.AspNetCore.Http;
using static GovUk.Education.ExploreEducationStatistics.Common.Constants.ValidationConstants;

namespace GovUk.Education.ExploreEducationStatistics.Admin.Requests;

Expand All @@ -16,8 +15,7 @@ public class Validator : AbstractValidator<ReleaseDataFileUpdateRequest>
public Validator()
{
RuleFor(request => request.Title)
.MaximumLength(SubjectTitleMaxLength)
.WithMessage(SubjectTitleMaxLengthMessage);
.MaximumLength(120);
}
}
}
Expand All @@ -36,13 +34,11 @@ public Validator()
{
RuleFor(request => request.Title)
.NotEmpty()
.MaximumLength(TitleMaxLength)
.WithMessage(TitleMaxLengthMessage);
.MaximumLength(120);

RuleFor(request => request.Summary)
.NotEmpty()
.MaximumLength(SummaryMaxLength)
.WithMessage(SummaryMaxLengthMessage);
.MaximumLength(250);

RuleFor(request => request.File)
.NotEmpty();
Expand All @@ -64,13 +60,11 @@ public Validator()
{
RuleFor(request => request.Title)
.NotEmpty()
.MaximumLength(TitleMaxLength)
.WithMessage(TitleMaxLengthMessage);
.MaximumLength(120);

RuleFor(request => request.Summary)
.NotEmpty()
.MaximumLength(SummaryMaxLength)
.WithMessage(SummaryMaxLengthMessage);
.MaximumLength(250);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using static GovUk.Education.ExploreEducationStatistics.Common.Constants.ValidationConstants;

namespace GovUk.Education.ExploreEducationStatistics.Admin.Services
{
Expand Down Expand Up @@ -143,7 +142,7 @@ public async Task<Either<ActionResult, List<ArchiveDataSetFile>>> ValidateBulkDa
var filename = row[fileNameIndex];
var datasetName = row[datasetNameIndex].Trim();

if (datasetName.Length > SubjectTitleMaxLength)
if (datasetName.Length > 120)
{
errors.Add(ValidationMessages.GenerateErrorDataSetTitleTooLong(datasetName));
}
Expand Down

This file was deleted.

0 comments on commit dd4f0b8

Please sign in to comment.