diff --git a/server/internal/service/notes.go b/server/internal/service/notes.go index 7b3aeb8..54add84 100644 --- a/server/internal/service/notes.go +++ b/server/internal/service/notes.go @@ -73,7 +73,7 @@ func (rs notesResource) Routes() chi.Router { r.Route(fmt.Sprintf("/{%s}", versionUUIDCtxParameter), func(r chi.Router) { r.Use(uuidCtx(versionUUIDCtxParameter)) r.Use(versionCtx(rs.Notes)) // DB -> req. context (scoped version) - r.Get("/", rs.GetFullVersion) // GET /notes/{id}/{id} - get + r.Get("/", rs.GetFullVersion) // GET /notes/{id}/{id} - get specific version's contents }) }) }) @@ -131,6 +131,8 @@ func (rs *notesResource) Create(w http.ResponseWriter, r *http.Request) { respondJSON(w, http.StatusCreated, res) } +// Handler for listing the metadata of all user's available notes. This metadata contains IDs of +// the note and its owner, its title, and the time it was last updated. func (rs *notesResource) ListMetadata(w http.ResponseWriter, r *http.Request) { user, ok := r.Context().Value(userCtxKey{}).(*userClaims) if !ok { @@ -271,6 +273,7 @@ func (rs *notesResource) CreateVersion(w http.ResponseWriter, r *http.Request) { - Increment `latest_version` - Sync `current_version` with `latest_version` */ + err := rs.Notes.CreateNoteVersion(r.Context(), data.CreateNoteVersionParams{ NoteID: fullNote.NoteID, Title: *req.Title,