Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions api/routes/class-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ router.get('/conversations/:id', async (req, res) => {
// Create Conversation
router.post('/conversations', async (req, res) => {
try {
const { ageGroup, instructor, schedule } = req.body;
const { ageGroup, instructor, schedule, image } = req.body;

// Check if conversation already exists
const existingConversations = await Class.find({ level: "conversation", ageGroup, instructor });
Expand All @@ -228,7 +228,8 @@ router.post('/conversations', async (req, res) => {
level: "conversation",
ageGroup,
instructor,
schedule
schedule,
image
});

await newConversation.save();
Expand Down Expand Up @@ -353,7 +354,7 @@ router.get('/ielts/:id', async (req, res) => {
// Create IETLS
router.post('/ielts', async (req, res) => {
try {
const { ageGroup, instructor, schedule } = req.body;
const { ageGroup, instructor, schedule, image } = req.body;

// Check if IELTS already exists
const existingIelts = await Class.find({ level: "ielts", ageGroup, instructor });
Expand All @@ -378,7 +379,8 @@ router.post('/ielts', async (req, res) => {
level: "ielts",
ageGroup,
instructor,
schedule
schedule,
image
});

await newIelts.save();
Expand Down
3 changes: 2 additions & 1 deletion api/routes/level-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ router.get("/", async (req, res) => {
// Create Level
router.post('/', async (req, res) => {
try {
const { level, name, description, skills } = req.body;
const { level, name, description, skills, image } = req.body;

// Check if level already exists
const query = { level };
Expand All @@ -39,6 +39,7 @@ router.post('/', async (req, res) => {
name,
description,
skills,
image
});
await newLevel.save();

Expand Down
1 change: 0 additions & 1 deletion api/routes/translation-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ router.put('/:lng/:ns/:key/', async (req, res) => {
res.status(200).json({ message: 'Successfully updated translation', translation: updated });
} catch (error) {
res.status(500).json({ message: "Failed to update translation" });
console.error(error)
}
})

Expand Down
1 change: 1 addition & 0 deletions api/schemas/Class.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ClassSchema = new Schema({
},
ageGroup: { type: String, required: true },
instructor: { type: String, required: true },
image: { type: String, required: true, default: "level_img_0.webp" },
link: { type: String, default: "" },
schedule: { type: [ScheduleSchema], default: [] },
roster: { type: [Schema.Types.ObjectId], default: [] },
Expand Down
1 change: 1 addition & 0 deletions api/schemas/Level.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const LevelSchema = new Schema({
level: { type: Number, required: true, unique: true },
name: { type: String, required: true },
description: { type: String, required: true },
image: { type: String, required: true, default: "level_img_0.webp" },
skills: { type: [String], default: [] }
}, { collection: 'levels' });

Expand Down
Loading