apps/quotes/app.go 819 B raw
1
package main
2
3
import (
4
	"database/sql"
5
	"embed"
6
	"html/template"
7
	"log/slog"
8
9
	"github.com/stevedylandev/andromeda/pkg/auth"
10
)
11
12
//go:embed templates/*.html static/*
13
var appFS embed.FS
14
15
type App struct {
16
	DB            *sql.DB
17
	Log           *slog.Logger
18
	Templates     *template.Template
19
	Sessions      *auth.Store
20
	AdminPassword string
21
	APIKey        string
22
	CookieSecure  bool
23
	BaseURL       string
24
}
25
26
type quoteView struct {
27
	Text   string
28
	Author string
29
	Source string
30
}
31
32
type indexPageData struct {
33
	BaseURL string
34
	Quote   *quoteView
35
}
36
37
type loginPageData struct {
38
	Error string
39
}
40
41
type adminQuoteRow struct {
42
	ShortID string
43
	Text    string
44
	Author  string
45
	Source  string
46
}
47
48
type adminPageData struct {
49
	Success  string
50
	Error    string
51
	Total    int
52
	Quotes   []adminQuoteRow
53
	Query    string
54
	Searched bool
55
}