summaryrefslogtreecommitdiff
path: root/internal/server/handler/handler.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-05-19 13:16:28 +0300
committerPaul Buetow <paul@buetow.org>2024-05-19 13:16:28 +0300
commitc06422b0727a4c6520d715e4be9a49a612afacfb (patch)
tree95565f8ac555f04b87bc2cb4482984d8cc649615 /internal/server/handler/handler.go
parent3e55b77c042c8436f93347f26cdd3196c1cb7f25 (diff)
initial equality test for the entries
Diffstat (limited to 'internal/server/handler/handler.go')
-rw-r--r--internal/server/handler/handler.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/internal/server/handler/handler.go b/internal/server/handler/handler.go
index c45f7d5..25a4b49 100644
--- a/internal/server/handler/handler.go
+++ b/internal/server/handler/handler.go
@@ -7,7 +7,6 @@ import (
"net/http"
"os"
"regexp"
- "time"
"codeberg.org/snonux/gos/internal/config/server"
"codeberg.org/snonux/gos/internal/easyhttp"
@@ -42,7 +41,7 @@ func (h Handler) Submit(w http.ResponseWriter, r *http.Request) error {
if err != nil {
return err
}
- return entry.SaveFile(fmt.Sprintf("%s/%s/%s.json", h.conf.DataDir, time.Now().Format("2006"), entry.ID))
+ return repository.Instance(h.conf.DataDir).Merge(entry)
}
func (h Handler) List(w http.ResponseWriter, r *http.Request) error {
@@ -124,7 +123,7 @@ func (h Handler) mergeFromPartner(partner string) error {
continue
}
- repo.Merge(entry)
+ errs = append(errs, repo.Merge(entry))
}
return errors.Join(errs...)