debug: logging on tag creates
This commit is contained in:
parent
2081882b41
commit
2b92897803
3 changed files with 10 additions and 5 deletions
|
|
@ -7,11 +7,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type FrontMatter struct {
|
type FrontMatter struct {
|
||||||
Title string `yaml:"Title"`
|
Title string `yaml:"title"`
|
||||||
Tags []string `yaml:"Tags"`
|
Tags []string `yaml:"tags"`
|
||||||
Created string `yaml:"Created"`
|
Created string `yaml:"created"`
|
||||||
Updated string `yaml:"Updated"`
|
Updated string `yaml:"updated"`
|
||||||
Author string `yaml:"Author"`
|
Author string `yaml:"author"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseTags(file []byte) ([]string, error) {
|
func ParseTags(file []byte) ([]string, error) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package handlers
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
"github.com/KristianJBorgwarth/dendrite.daemon/core/frontmatter"
|
"github.com/KristianJBorgwarth/dendrite.daemon/core/frontmatter"
|
||||||
"github.com/KristianJBorgwarth/dendrite.daemon/core/models"
|
"github.com/KristianJBorgwarth/dendrite.daemon/core/models"
|
||||||
|
|
@ -44,6 +45,8 @@ func (h *CreateNoteHandler) Handle(ctx context.Context, raw json.RawMessage) (an
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slog.Debug("parsed tags", "tags", tags)
|
||||||
|
|
||||||
tx, err := h.uow.Begin()
|
tx, err := h.uow.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -59,6 +62,8 @@ func (h *CreateNoteHandler) Handle(ctx context.Context, raw json.RawMessage) (an
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slog.Debug("Creating tags", "tags", tags)
|
||||||
|
|
||||||
if err = tagRepo.Upsert(ctx, tagModels); err != nil {
|
if err = tagRepo.Upsert(ctx, tagModels); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
dendrite
BIN
dendrite
Binary file not shown.
Loading…
Add table
Reference in a new issue