feat: image variants cache panel

This commit is contained in:
fsylvain committed 2026-10-08 21:13:32 +02:00
1 parent 951fef18ba
commit d768668014
53 files changed
+5809 -46

No files matched your search

+17
View File
@@ -5,6 +5,7 @@ import (
"RenewCMS/internal/infrastructure/useCases"
"errors"
"io"
"slices"
"sort"
"strconv"
"strings"
@@ -78,6 +79,8 @@ type mockImageRepo struct {
deleteCalls []uint32
createCalls int
onDelete func(id uint32)
storedNameLookups int
}
func newMockImageRepo() *mockImageRepo {
@@ -257,6 +260,20 @@ func (m *mockImageRepo) ExistsByStoredName(storedName string) (bool, error) {
return false, nil
}
func (m *mockImageRepo) ListByStoredNames(storedNames []string) ([]imageDomain.Image, error) {
if err := m.fail.trigger("ListByStoredNames"); err != nil {
return nil, err
}
m.storedNameLookups++
result := make([]imageDomain.Image, 0)
for _, img := range m.sortedImages() {
if slices.Contains(storedNames, imageDomain.StoredName(img.Path)) {
result = append(result, img)
}
}
return result, nil
}
var _ imageDomain.Repository = &mockImageRepo{}
func TestImageUseCases(t *testing.T) {