Uhh, things?
This commit is contained in:
parent
e5e0b54035
commit
4e54012ae5
5 changed files with 77 additions and 4 deletions
|
@ -2,9 +2,11 @@ package server
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"git.mstar.dev/mstar/goutils/other"
|
||||
"git.mstar.dev/mstar/linstrom/storage"
|
||||
"git.mstar.dev/mstar/linstrom/util"
|
||||
"github.com/google/jsonapi"
|
||||
"github.com/rs/zerolog/hlog"
|
||||
)
|
||||
|
@ -59,7 +61,7 @@ func linstromGetNote(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
func linstromUpdateNote(w http.ResponseWriter, r *http.Request) {}
|
||||
func linstromNewNote(w http.ResponseWriter, r *http.Request) {
|
||||
// store := StorageFromRequest(r)
|
||||
store := StorageFromRequest(r)
|
||||
actorId, ok := ActorIdFromRequest(r)
|
||||
log := hlog.FromRequest(r)
|
||||
|
||||
|
@ -95,7 +97,32 @@ func linstromNewNote(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
// _, _ = store.CreateNoteLocal(creatorId string, rawContent string, contentWarning *string, timestamp time.Time, attachmentIds []string, emoteIds []string, repliesToId *string, quotesId *string, accessLevel storage.NoteAccessLevel, tags []string)
|
||||
rawTags := util.TagsFromText(newNote.RawContent)
|
||||
|
||||
note, err := store.CreateNoteLocal(
|
||||
actorId,
|
||||
newNote.RawContent,
|
||||
newNote.ContentWarning,
|
||||
time.Now(),
|
||||
newNote.AttachmentIds,
|
||||
newNote.EmoteIds,
|
||||
newNote.InReplyToId,
|
||||
newNote.QuotesId,
|
||||
storage.NoteAccessLevel(newNote.AccessLevel),
|
||||
rawTags,
|
||||
// tags []string
|
||||
)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Any("note", newNote).Msg("Failed to insert new note into storage")
|
||||
other.HttpErr(
|
||||
w,
|
||||
HttpErrIdDbFailure,
|
||||
"Failed to insert new note into db",
|
||||
http.StatusInternalServerError,
|
||||
)
|
||||
return
|
||||
}
|
||||
_ = note
|
||||
}
|
||||
func linstromDeleteNote(w http.ResponseWriter, r *http.Request) {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue