אנחנו מתקרבים לסיום הפרויקט 🚀
כעת נממש את כל ה-API עבור שירות ה־Notes – בדומה למה שעשינו עם Notebooks.
ודאו שכל השירותים פועלים:
docker compose up --build --watch
ובדקו שהמערכת זמינה דרך:
<http://localhost:8080/api/notes>
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const noteSchema = new Schema(
{
title: {
type: String,
required: true,
},
content: {
type: String,
required: true,
},
notebookId: {
type: Schema.Types.ObjectId,
required: false,
default: null,
},
},
{
timestamps: true,
}
);
const Note = mongoose.model("Note", noteSchema);
module.exports = Note;
title – חובהcontent – חובהnotebookId – אופציונלי
ObjectIdnulltimestamps: true מוסיף:
createdAtupdatedAt⚠️ בשלב הזה לא נבדוק אם ה-notebookId קיים בשירות Notebooks.
נחזור לזה בהמשך.