feat(create_note): setup note

This commit is contained in:
Kristian Borgwarth 2026-03-22 23:00:21 +01:00
parent 66f03daf83
commit 843b840583
3 changed files with 38 additions and 3 deletions

View file

@ -0,0 +1,26 @@
package handlers
import (
"encoding/json"
"github.com/KristianJBorgwarth/dendrite.daemon/core/rpc"
)
type createNoteCommand struct {
Title string `json:"title"`
TemplatePath string `json:"templatePath"`
Path string `json:"path"`
Vars map[string]string `json:"vars"`
}
type CreateNoteHandler struct{
repository NoteRepository
}
func (h CreateNoteHandler) Handle(params []byte) (any, *rpc.Error) {
var cmd createNoteCommand
if err := json.Unmarshal(params, &cmd); err != nil {
return nil, &rpc.Error{Code: -32602, Message: "invalid params"}
}
}

View file

@ -1,6 +1,3 @@
// Package repositories provides an interface for accessing dendrite index and configuration
package repositories

View file

@ -0,0 +1,12 @@
package repositories
import "database/sql"
type NoteRepository interface {
CreateNote(title string, path string, slug string) error
}
type noteRepository struct {
db *sql.DB
}