Skip to content

Commit

Permalink
fix: request on datetime
Browse files Browse the repository at this point in the history
closes #399
  • Loading branch information
github-actions committed Mar 30, 2021
1 parent f78784b commit ff15d71
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Aguacongas.IdentityServer.EntityFramework.Store
/// <summary>
/// <see cref="ICorsPolicyService"/> implementation
/// </summary>
/// <seealso cref="IdentityServer4.Services.ICorsPolicyService" />
/// <seealso cref="ICorsPolicyService" />
public class CorsPolicyService : ICorsPolicyService
{
private readonly ConfigurationDbContext _context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ public override TSource Visit(SingleValuePropertyAccessNode nodeIn)

public override TSource Visit(ConstantNode nodeIn)
{
if (nodeIn.Value is DateTime || nodeIn.Value is DateTimeOffset)
{
Builder.Append('\'');
Builder.Append(nodeIn.LiteralText);
Builder.Append('\'');
return null;
}

Builder.Append(nodeIn.LiteralText);
return null;
}
Expand Down Expand Up @@ -261,6 +269,7 @@ public override TSource Visit(ConstantNode nodeIn)
Parameters.Add($"'*{nodeIn.Value}*'");
return null;
}

Parameters.Add(nodeIn.LiteralText);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ await s1.StoreAsync(new ProtectResource

var page = await sut.GetAsync(new PageRequest
{
Filter = "Id eq 'test'",
Filter = $"{nameof(ProtectResource.Id)} eq 'test'",
Skip = 0,
Take = 10
});
Expand All @@ -57,7 +57,16 @@ await s1.StoreAsync(new ProtectResource

page = await sut.GetAsync(new PageRequest
{
Filter = "DisplayName eq 'no-test'",
Filter = $"{nameof(ProtectResource.DisplayName)} eq 'no-test'",
Skip = 0,
Take = 10
});

Assert.Empty(page.Items);

page = await sut.GetAsync(new PageRequest
{
Filter = $"{nameof(ProtectResource.CreatedAt)} eq {DateTime.UtcNow.ToString("o")}",
Skip = 0,
Take = 10
});
Expand Down

0 comments on commit ff15d71

Please sign in to comment.