diff options
| author | Leonardo Bishop <me@leonardobishop.net> | 2025-09-09 23:38:41 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.net> | 2025-09-09 23:38:41 +0100 |
| commit | 186a9e267815e7caa62391fdc7b8cbd842922610 (patch) | |
| tree | 325651b43712c0a31dc24ac15a03bfcf78b097ec | |
| parent | e7c7e2aa77fa9b90ef6a114f43510e6bdc3bec76 (diff) | |
Pass config to api and fix bad join
| -rw-r--r-- | api/router.go | 2 | ||||
| -rw-r--r-- | main.go | 2 | ||||
| -rw-r--r-- | pkg/database/query/entries.sql | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/api/router.go b/api/router.go index 9ea7ac0..ec7ac4d 100644 --- a/api/router.go +++ b/api/router.go @@ -14,7 +14,7 @@ type ApiServices struct { EntiresService entries.Service HtmlService html.Service - Config config.Config + Config *config.Config } func NewServer(api ApiServices) *http.ServeMux { @@ -43,6 +43,8 @@ func run() error { api := api.NewServer(api.ApiServices{ EntiresService: entriesService, HtmlService: htmlService, + + Config: c, }) slog.Info("starting HTTP server", "host", c.Server.Host, "port", c.Server.Port) diff --git a/pkg/database/query/entries.sql b/pkg/database/query/entries.sql index 1927468..1f39016 100644 --- a/pkg/database/query/entries.sql +++ b/pkg/database/query/entries.sql @@ -7,5 +7,5 @@ RETURNING *; -- name: GetEntries :many SELECT title, url, description, timestamp, kinds.name as kind_name, kinds.emoji as kind_emoji FROM entries -JOIN kinds ON entries.id == kinds.id +JOIN kinds ON entries.kind == kinds.id ORDER BY timestamp DESC; |
