feat(api): add endpoint to list guest photos

* implement handleListPhotos to retrieve uploaded photos
* create PhotoFileRecord struct for photo data
* add fetchGuestPhotos function in the UI
* display guest photos in the photo upload page
* remove index.html as it is no longer needed
* add calendar functionality to download wedding event
This commit is contained in:
2026-08-23 10:33:50 +02:00
parent 4eddecea8e
commit f16d280f9a
9 changed files with 198 additions and 46 deletions
+30
View File
@@ -159,6 +159,36 @@ func (s *Store) CreatePhotoUpload(u PhotoUpload) (int64, error) {
return res.LastInsertId()
}
type PhotoFileRecord struct {
URL string
UploaderName string
}
// ListPhotoFiles returns every uploaded photo, most recent first.
func (s *Store) ListPhotoFiles() ([]PhotoFileRecord, error) {
rows, err := s.db.Query(
`SELECT f.url, u.name
FROM photo_files f
JOIN photo_uploads u ON u.id = f.upload_id
ORDER BY f.created_at DESC, f.id DESC
LIMIT 200`,
)
if err != nil {
return nil, err
}
defer rows.Close()
var out []PhotoFileRecord
for rows.Next() {
var rec PhotoFileRecord
if err := rows.Scan(&rec.URL, &rec.UploaderName); err != nil {
return nil, err
}
out = append(out, rec)
}
return out, rows.Err()
}
func (s *Store) AddPhotoFiles(uploadID int64, files []PhotoFile) error {
tx, err := s.db.Begin()
if err != nil {