feat: implement shared-album multi-user photo album

Backend (Go/Gin/pgx): env config, pgx pool with retries, Garage S3 client
(path-style, region garage), embedded golang-migrate migrations, JWT auth with
refresh rotation, albums CRUD, members/roles/invites with no-escalation matrix,
photo upload + async imaging/goexif WebP variants, cursor pagination, presigned
URLs, likes/comments, SSE hub (album + personal), notifications, share links.

Frontend (SvelteKit 2 + Svelte 5 + Tailwind v4): API wrapper with 401 refresh,
auth store, all screens, Uploader/PhotoGrid/Lightbox/Comments, SSE client with
reconnect + REST catch-up, three themes + system via data-theme.

Deploy without Docker: Makefile builds the frontend into backend/static and
embeds it (go:embed) into a single statically linked binary; systemd unit and
nginx SSE example included.

Use gen2brain/webp (-tags nodynamic) instead of cgo kolesa-team/go-webp to keep
CGO_ENABLED=0 static builds; design.md/proposal.md updated accordingly.
This commit is contained in:
iu
2026-10-10 12:50:33 +03:00
commit 2b2b342492
105 changed files with 12494 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
package notifications
import (
"context"
"shared-album/internal/auth"
"shared-album/internal/httpx"
"shared-album/internal/models"
"shared-album/internal/sse"
)
type Service struct {
store *Store
hub *sse.Hub
}
func NewService(store *Store, hub *sse.Hub) *Service {
return &Service{store: store, hub: hub}
}
func (s *Service) Create(ctx context.Context, userID, typ string, payload map[string]any) error {
n := &models.Notification{
ID: auth.NewID(),
UserID: userID,
Type: typ,
PayloadJSON: payload,
}
if err := s.store.Create(ctx, n); err != nil {
return err
}
s.hub.PublishUser(userID, "notification", n)
return nil
}
func (s *Service) List(ctx context.Context, userID string, limit int) ([]models.Notification, error) {
return s.store.List(ctx, userID, limit)
}
func (s *Service) MarkRead(ctx context.Context, id, userID string) error {
if err := s.store.MarkRead(ctx, id, userID); err != nil {
return httpx.NotFound("notification_not_found", "notification not found")
}
return nil
}