-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
392 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using FluentValidation; | ||
using SiteWatcher.Application.Common.Results; | ||
using SiteWatcher.Domain.Common.Errors; | ||
|
||
namespace SiteWatcher.Application.Common.Command; | ||
|
||
public abstract class BaseHandler<T,R> : IApplicationHandler where R : IResult, new() | ||
{ | ||
private readonly IValidator<T> _validator; | ||
|
||
protected BaseHandler(IValidator<T> validator) | ||
{ | ||
_validator = validator; | ||
} | ||
|
||
public async Task<R> Handle(T command, CancellationToken ct) | ||
{ | ||
var res = _validator.Validate(command); | ||
if (res.IsValid) | ||
return await HandleCommand(command, ct); | ||
|
||
var errors = res.Errors.Select(err => err.ErrorMessage).ToArray(); | ||
var errorResult = new R(); | ||
errorResult.SetError(Error.Validation(errors)); | ||
return errorResult; | ||
} | ||
|
||
protected abstract Task<R> HandleCommand(T command, CancellationToken ct); | ||
} | ||
|
||
public interface IApplicationHandler{} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...Application/Common/Queries/QueryResult.cs → src/Application/Common/Queries/DbQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
1145a27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
site-watcher – ./
site-watcher-git-main-xilapa.vercel.app
site-watcher-xi.vercel.app
site-watcher-xilapa.vercel.app