feat: image variants cache panel
This commit is contained in:
1 parent
951fef18ba
commit
d768668014
53 files changed
+5809
-46
No files matched your search
@@ -107,6 +107,21 @@ func (i ImageRepository) ExistsByStoredName(storedName string) (bool, error) {
|
||||
return matches > 0, err
|
||||
}
|
||||
|
||||
func (i ImageRepository) ListByStoredNames(storedNames []string) ([]domain.Image, error) {
|
||||
if len(storedNames) == 0 {
|
||||
return []domain.Image{}, nil
|
||||
}
|
||||
paths := make([]string, 0, len(storedNames))
|
||||
for _, storedName := range storedNames {
|
||||
paths = append(paths, domain.PublicPath(storedName))
|
||||
}
|
||||
var models []entity.Image
|
||||
if err := i.db.Where("path IN ?", paths).Order("id asc").Find(&models).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return imagesToDomain(models), nil
|
||||
}
|
||||
|
||||
func (i ImageRepository) duplicatedHashes() *gorm.DB {
|
||||
return i.db.Model(&entity.Image{}).
|
||||
Select("sha256").
|
||||
|
||||
Reference in new issue
Block a user