-
Notifications
You must be signed in to change notification settings - Fork 71
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
210 changed files
with
5,092 additions
and
2,396 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// ========================================================================== | ||
// Notifo.io | ||
// ========================================================================== | ||
// Copyright (c) Sebastian Stehle | ||
// All rights reserved. Licensed under the MIT license. | ||
// ========================================================================== | ||
|
||
namespace Notifo.Domain.Apps; | ||
|
||
public sealed class AppAuthScheme | ||
{ | ||
public string Domain { get; init; } | ||
|
||
public string DisplayName { get; init; } | ||
|
||
public string ClientId { get; init; } | ||
|
||
public string ClientSecret { get; init; } | ||
|
||
public string Authority { get; init; } | ||
|
||
public string? SignoutRedirectUrl { get; init; } | ||
} |
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,53 @@ | ||
// ========================================================================== | ||
// Notifo.io | ||
// ========================================================================== | ||
// Copyright (c) Sebastian Stehle | ||
// All rights reserved. Licensed under the MIT license. | ||
// ========================================================================== | ||
|
||
using FluentValidation; | ||
using Notifo.Infrastructure.Validation; | ||
|
||
namespace Notifo.Domain.Apps; | ||
|
||
public sealed class UpsertAppAuthScheme : AppCommand | ||
{ | ||
public AppAuthScheme? Scheme { get; set; } | ||
|
||
private sealed class Validator : AbstractValidator<UpsertAppAuthScheme> | ||
{ | ||
public Validator() | ||
{ | ||
When(x => x.Scheme != null, () => | ||
{ | ||
RuleFor(x => x.Scheme).SetValidator(new SchemeValidator()!); | ||
}); | ||
} | ||
} | ||
|
||
private sealed class SchemeValidator : AbstractValidator<AppAuthScheme> | ||
{ | ||
public SchemeValidator() | ||
{ | ||
RuleFor(x => x.Domain).NotNull().NotEmpty().Domain(); | ||
RuleFor(x => x.DisplayName).NotNull().NotEmpty(); | ||
RuleFor(x => x.ClientId).NotNull().NotEmpty(); | ||
RuleFor(x => x.ClientSecret).NotNull().NotEmpty(); | ||
RuleFor(x => x.Authority).NotNull().NotEmpty().Url(); | ||
RuleFor(x => x.SignoutRedirectUrl).Url(); | ||
} | ||
} | ||
|
||
public override ValueTask<App?> ExecuteAsync(App target, IServiceProvider serviceProvider, | ||
CancellationToken ct) | ||
{ | ||
Validate<Validator>.It(this); | ||
|
||
if (!Equals(target.AuthScheme, Scheme)) | ||
{ | ||
target = target with { AuthScheme = Scheme }; | ||
} | ||
|
||
return new ValueTask<App?>(target); | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
backend/src/Notifo.Domain/Liquid/LiquidPropertiesProvider.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ========================================================================== | ||
// Notifo.io | ||
// ========================================================================== | ||
// Copyright (c) Sebastian Stehle | ||
// All rights reserved. Licensed under the MIT license. | ||
// ========================================================================== | ||
|
||
#pragma warning disable CA1822 // Mark members as static | ||
|
||
namespace Notifo.Domain.Liquid; | ||
|
||
public sealed class LiquidPropertiesProvider | ||
{ | ||
public LiquidProperties GetProperties() | ||
{ | ||
var properties = new LiquidProperties(); | ||
|
||
properties.AddObject("app", () => | ||
{ | ||
LiquidApp.Describe(properties); | ||
}, "The current app."); | ||
|
||
properties.AddObject("user", () => | ||
{ | ||
LiquidUser.Describe(properties); | ||
}, "The current user."); | ||
|
||
properties.AddObject("notification", () => | ||
{ | ||
LiquidNotification.Describe(properties); | ||
}, "The first and usually single notifications. For emails multiple notifications can be grouped in one template."); | ||
|
||
properties.AddArray("notifications", | ||
"The list of notifications. Usually it is only one, but for emails multiple notifications can be grouped in one template."); | ||
|
||
return properties; | ||
} | ||
} |
Oops, something went wrong.