Add debug endpoint for getting replies to node id
All checks were successful
/ docker (push) Successful in 4m19s
All checks were successful
/ docker (push) Successful in 4m19s
This commit is contained in:
parent
1b0c63a3b1
commit
c9895bc9af
5 changed files with 20 additions and 5 deletions
|
@ -59,7 +59,7 @@ func postAs(w http.ResponseWriter, r *http.Request) {
|
|||
n := dbgen.Note
|
||||
note := models.Note{
|
||||
ID: shared.NewId(),
|
||||
Creator: *user,
|
||||
Creator: user,
|
||||
CreatorId: user.ID,
|
||||
RawContent: data.Content,
|
||||
Remote: false,
|
||||
|
@ -167,3 +167,17 @@ func notesFrom(w http.ResponseWriter, r *http.Request) {
|
|||
})
|
||||
webutils.SendJson(w, publicNotes)
|
||||
}
|
||||
|
||||
func inReplyTo(w http.ResponseWriter, r *http.Request) {
|
||||
log := hlog.FromRequest(r)
|
||||
noteId := r.PathValue("id")
|
||||
notes, err := dbgen.Note.
|
||||
Where(dbgen.Note.RepliesTo.Eq(sql.NullString{Valid: true, String: noteId})).
|
||||
Find()
|
||||
if err != nil {
|
||||
log.Error().Err(err).Str("id", noteId).Msg("Error getting replies to note with id")
|
||||
webutils.ProblemDetailsStatusOnly(w, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
_ = webutils.SendJson(w, notes)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue