From f25031cf5b32639e80ea3bbba4634eec17b50875 Mon Sep 17 00:00:00 2001 From: Sim-M <40467906+Sim-M@users.noreply.github.com> Date: Sat, 1 Aug 2026 15:53:49 +0530 Subject: [PATCH 1/4] Update note.model.js --- app/models/note.model.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/note.model.js b/app/models/note.model.js index d5523c6..f335113 100644 --- a/app/models/note.model.js +++ b/app/models/note.model.js @@ -3,8 +3,13 @@ const mongoose = require('mongoose'); const NoteSchema = mongoose.Schema({ title: String, content: String + tags: { + type: [String], + default: [] + } + }, { timestamps: true }); -module.exports = mongoose.model('Note', NoteSchema); \ No newline at end of file +module.exports = mongoose.model('Note', NoteSchema); From 610c6b6961f457c4b3b2716f4f5c5c748f4e14d8 Mon Sep 17 00:00:00 2001 From: Sim-M <40467906+Sim-M@users.noreply.github.com> Date: Sat, 1 Aug 2026 16:05:29 +0530 Subject: [PATCH 2/4] Update note.controller.js --- app/controllers/note.controller.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/note.controller.js b/app/controllers/note.controller.js index 7390849..85bd86a 100644 --- a/app/controllers/note.controller.js +++ b/app/controllers/note.controller.js @@ -13,6 +13,7 @@ exports.create = (req, res) => { const note = new Note({ title: req.body.title || "Untitled Note", content: req.body.content + tags: req.body.tags || [] //for tags }); // Save Note in the database @@ -73,6 +74,7 @@ exports.update = (req, res) => { Note.findByIdAndUpdate(req.params.noteId, { title: req.body.title || "Untitled Note", content: req.body.content + tags: req.body.tags || [] //for tags }, {new: true}) .then(note => { if(!note) { From 74203ead5f1b42788dea8389f7f640a392ea152f Mon Sep 17 00:00:00 2001 From: Sim-M <40467906+Sim-M@users.noreply.github.com> Date: Sat, 1 Aug 2026 16:08:46 +0530 Subject: [PATCH 3/4] Update Readme.md --- Readme.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 6fcfbef..8145f7f 100644 --- a/Readme.md +++ b/Readme.md @@ -16,9 +16,19 @@ npm install node server.js ``` +## Note Organization + +3. Notes now support tags and searching. + +Search: +GET /notes?q=python + +Filter by tag: +GET /notes?tag=learning + You can browse the apis at ## Tutorial You can find the tutorial for this application at [The CalliCoder Blog](https://www.callicoder.com) - - \ No newline at end of file + From 732d912ff53bff2f4c08359293130192af328c54 Mon Sep 17 00:00:00 2001 From: Sim-M <40467906+Sim-M@users.noreply.github.com> Date: Sat, 1 Aug 2026 16:11:00 +0530 Subject: [PATCH 4/4] Update note.routes.js --- app/routes/note.routes.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/routes/note.routes.js b/app/routes/note.routes.js index 52809a8..f0a2dad 100644 --- a/app/routes/note.routes.js +++ b/app/routes/note.routes.js @@ -4,6 +4,8 @@ module.exports = (app) => { // Create a new Note app.post('/notes', notes.create); + //notes are getting found by using tags like /notes?q=python & /notes?tag=learning + // Retrieve all Notes app.get('/notes', notes.findAll); @@ -15,4 +17,4 @@ module.exports = (app) => { // Delete a Note with noteId app.delete('/notes/:noteId', notes.delete); -} \ No newline at end of file +}