fix/feat: primary photo auto set and auto-set primary photo (#651)

* fix error when item doesn't have photo attachment

* automatically detect image types and set primary photo if first

* remove charts.js from libs

Former-commit-id: 321a83b6344461233979e4f45e60f3121b1ffcef
This commit is contained in:
Hayden 2023-12-01 11:57:29 -06:00 committed by GitHub
parent bd1a241be1
commit 81e76d9dd4
13 changed files with 41 additions and 424 deletions

View file

@ -845,6 +845,7 @@ func (e *ItemsRepository) SetPrimaryPhotos(ctx context.Context, GID uuid.UUID) (
Where(
item.HasGroupWith(group.ID(GID)),
item.HasAttachmentsWith(
attachment.TypeEQ(attachment.TypePhoto),
attachment.Not(
attachment.And(
attachment.Primary(true),