Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API endpoints for default delivery channels for a customer #742

Merged
merged 20 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f2bee9d
changes to support using actual payloads
JackLewis-digirati Feb 26, 2024
f3a97fb
Include Thumbnails channel in AssetDeliveryChannels
griffri Feb 16, 2024
d42a29d
initial commit
JackLewis-digirati Feb 15, 2024
47ee34e
adding update
JackLewis-digirati Feb 16, 2024
1d873df
adding in default delivery channel api work
JackLewis-digirati Feb 19, 2024
f56e9df
fixing customer test to use next instead of id
JackLewis-digirati Feb 19, 2024
11ca345
changes prior to code review
JackLewis-digirati Feb 23, 2024
f8ebc17
updating query to use || and fixing some tests
JackLewis-digirati Feb 28, 2024
5256b69
updates to API URL
JackLewis-digirati Feb 28, 2024
5057998
removing unused usings
JackLewis-digirati Feb 28, 2024
bf5a4de
initial code review fixes
JackLewis-digirati Feb 29, 2024
3be59ea
Fixing review comments around reducing duplication of complex LINQ q…
JackLewis-digirati Feb 29, 2024
32f4dad
removing unneccessary usings
JackLewis-digirati Mar 1, 2024
fdc6e86
update to cache calls to call .toList()
JackLewis-digirati Mar 1, 2024
0af35ec
update to use ReferenceHandler.Preserve to break circular references …
JackLewis-digirati Mar 1, 2024
c77e764
removing from preserve from engine client
JackLewis-digirati Mar 1, 2024
416a93a
removing unnecessary whitespace
JackLewis-digirati Mar 5, 2024
896c543
code review changes
JackLewis-digirati Mar 11, 2024
067600e
updating integration tests
JackLewis-digirati Mar 11, 2024
c64777e
remove unnecessary link to API
JackLewis-digirati Mar 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/migrateCustomerDeliveryChannels.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SELECT TP."Id",
current_timestamp,
current_timestamp,
n.new_sizes
FROM (SELECT '{[' || string_agg('"!' || dimension || ',' || dimension, '",') || '"]}' new_sizes,
FROM (SELECT '[' || string_agg('"!' || dimension || ',' || dimension, '",') || '"]' new_sizes,
"Id"
FROM (SELECT unnest(string_to_array("Sizes", ',')) AS dimension, "Id" FROM "ThumbnailPolicies") AS x
GROUP BY "Id") AS n
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using API.Features.DeliveryChannels.Validation;
using DLCS.HydraModel;
using FluentValidation.TestHelper;

namespace API.Tests.Features.DeliveryChannels.Validation;

public class HydraDefaultDeliveryChannelValidatorTests
{
private readonly HydraDefaultDeliveryChannelValidator sut;

public HydraDefaultDeliveryChannelValidatorTests()
{
sut = new HydraDefaultDeliveryChannelValidator();
}

[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("stuff/?")]
public void MediaType_NullEmptyOrInvalid(string mediaType)
{
var model = new DefaultDeliveryChannel("", 1, "iiif-img", null, mediaType, Guid.NewGuid().ToString(), 0);
var result = sut.TestValidate(model);
result.ShouldHaveValidationErrorFor(a => a.MediaType);
result.ShouldNotHaveValidationErrorFor(a => a.Channel);
}

[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("someChannel")]
public void Channel_NullOrEmpty(string channel)
{
var model = new DefaultDeliveryChannel("", 1, channel, null, "image/*", Guid.NewGuid().ToString(), 0);
var result = sut.TestValidate(model);
result.ShouldHaveValidationErrorFor(a => a.Channel);
result.ShouldNotHaveValidationErrorFor(a => a.MediaType);
}

[Fact]
public void No_Errors()
{
var model = new DefaultDeliveryChannel("", 1, "iiif-img", null, "image/*", Guid.NewGuid().ToString(), 0);
var result = sut.TestValidate(model);
result.ShouldNotHaveValidationErrorFor(a => a.Channel);
result.ShouldNotHaveValidationErrorFor(a => a.MediaType);
}
}
Loading
Loading