summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2024-10-11 22:47:16 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2024-10-11 22:47:39 +0200
commitb46012f212a4302b4d1325d8fdf9634e7083e76a (patch)
tree095d00491c385c33674f5a0a11128a543a48c485 /main.go
parente79d3d7163657f7a540530dddb319f984885e864 (diff)
downloadgosten-b46012f212a4302b4d1325d8fdf9634e7083e76a.tar.gz
gosten-b46012f212a4302b4d1325d8fdf9634e7083e76a.tar.bz2
gosten-b46012f212a4302b4d1325d8fdf9634e7083e76a.zip
First draft of recurrent costs and categories
Diffstat (limited to 'main.go')
-rw-r--r--main.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/main.go b/main.go
index 84dcd6e..29c85da 100644
--- a/main.go
+++ b/main.go
@@ -64,6 +64,8 @@ func main() {
// handlers that required authentification
authMux.Handle("GET /{$}", indexPage())
+ authMux.Handle("GET /recur/{$}", recurPage())
+ authMux.Handle("GET /categories/{$}", categoriesPage())
authMux.Handle("GET /", notfound())
log.Fatal(http.ListenAndServe(os.Getenv("GOSTEN_ADDRESS"), handler))
@@ -83,6 +85,22 @@ func indexPage() http.HandlerFunc {
}
}
+func recurPage() http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ uid := userId(r)
+ exps, _ := Q.GetRecurExpenses(r.Context(), uid)
+ showTemplate(w, "recur", exps)
+ }
+}
+
+func categoriesPage() http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ uid := userId(r)
+ cats, _ := Q.GetCategories(r.Context(), uid)
+ showTemplate(w, "categories", cats)
+ }
+}
+
func notfound() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
showTemplate(w, "404", r.RequestURI)