Skip to content

Commit

Permalink
Replace value objects with strings (#757)
Browse files Browse the repository at this point in the history
* refactor: use strings instead of value objects in challenges module

* refactor: use strings instead of value objects and add validators

* feat: extension method for fluent validation and commands and query validators added

* refactor: revert unnecessary changes

* fix: compilation error due to list

* test: add unit tests for validators

* test: add missing unit tests for devices module

* test: unit tests for validators in files module

* refactor: remove json converters

* fix: add mappings after removing json converters

* fix: mappings for value objects in synchronization module

* fix: mapping for value objects in relationships module

* refactor: updates to DTOs after removing json converters while also removing auto mapper

* refactor: remove automapper from relationships and adjust DTOs

* refactor: remove automapper completely from solution

* refactor: make number of identities nullable

* refactor: use validator extension method for unit tests

* refactor: change validation due to collection properties containing index in property name

* refactor: simplify null check

* refactor: add cache for reflection

* refactor: revert nullable property

* refactor: introduce validator extensions class file and adjust namespaces

* refactor: extension methods

* refactor: changes after code review

* chore: formatting

* chore: fix formatting

* refactor: simplify extension method

* test: add arch unit test to ensure isValid method for strongly typed ids

* test: add parameter validation to arch unit test

* refactor: manually call fluent validation of payload

* test: add more conditions to StronglyTypedIds ArchUnit test

* chore: add validation for ExternalEventResult.ErrorCode length

* refactor: throw validation exception given invalid model state

* refactor: remove commented out code block

* test: add arch unit test to ensure not value objects in mediatr commands and queries

* refactor: owner validation should be performed on the mediatr command only

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Timo Notheisen <[email protected]>
  • Loading branch information
3 people authored Aug 27, 2024
1 parent 6f1ee18 commit 707babf
Show file tree
Hide file tree
Showing 306 changed files with 2,532 additions and 1,720 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Backbone.Modules.Devices.Application.Devices.Commands.RegisterDevice;
using Backbone.Modules.Devices.Application.Devices.DTOs;
using FluentValidation;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OData;
using Microsoft.OData.ModelBuilder;
Expand All @@ -21,13 +20,9 @@ public static class IServiceCollectionExtensions
{
public static IServiceCollection AddCustomFluentValidation(this IServiceCollection services)
{
services.AddFluentValidationAutoValidation(config => { config.DisableDataAnnotationsValidation = true; });

ValidatorOptions.Global.DisplayNameResolver = (_, member, _) =>
member != null ? char.ToLowerInvariant(member.Name[0]) + member.Name[1..] : null;

services.AddValidatorsFromAssemblyContaining<Program>();

return services;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Backbone.Modules.Devices.Infrastructure.Persistence.Database;
using Backbone.Modules.Devices.Infrastructure.PushNotifications.Connectors.Sse;
using FluentValidation;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Diagnostics.HealthChecks;
Expand Down Expand Up @@ -154,13 +153,9 @@ public static IServiceCollection AddCustomOpenIddict(this IServiceCollection ser

public static IServiceCollection AddCustomFluentValidation(this IServiceCollection services)
{
services.AddFluentValidationAutoValidation(config => { config.DisableDataAnnotationsValidation = true; });

ValidatorOptions.Global.DisplayNameResolver = (_, member, _) =>
member != null ? char.ToLowerInvariant(member.Name[0]) + member.Name[1..] : null;

services.AddValidatorsFromAssemblyContaining<Program>();

return services;
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 707babf

Please sign in to comment.