Initial implementation

This commit is contained in:
2025-12-10 11:10:52 +01:00
parent cff9defc4a
commit 4cb97a25ba
26 changed files with 2714 additions and 1 deletions

30
internal/models/photo.go Normal file
View File

@@ -0,0 +1,30 @@
package models
import (
"path/filepath"
"time"
)
// Photo represents a photo with its metadata.
type Photo struct {
Date time.Time
Year string
Filename string
Description string
FullPath string
}
// DateString returns the date formatted as YYYY-MM-DD.
func (p *Photo) DateString() string {
return p.Date.Format("2006-01-02")
}
// URLPath returns the URL path to access this photo.
func (p *Photo) URLPath() string {
return filepath.Join("/photos", p.Year, p.Filename)
}
// ThumbURLPath returns the URL path to access this photo's thumbnail.
func (p *Photo) ThumbURLPath() string {
return filepath.Join("/photos/thumb", p.Year, p.Filename)
}