We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents eff0606 + 545529a commit ffbfd04Copy full SHA for ffbfd04
backend/internal/handlers/courses.go
@@ -9,6 +9,7 @@ import (
9
"github.com/gofiber/fiber/v2"
10
"github.com/sandbox-science/online-learning-platform/configs/database"
11
"github.com/sandbox-science/online-learning-platform/internal/entity"
12
+ "gorm.io/gorm"
13
)
14
15
// Courses function retrieves enrolled course titles and descriptions based on user_id from the URL
@@ -58,7 +59,9 @@ func Course(c *fiber.Ctx) error {
58
59
if err := database.DB.
60
Preload("Students").
61
Preload("Modules").
- Preload("Modules.Content").
62
+ Preload("Modules.Content", func(db *gorm.DB) *gorm.DB {
63
+ return db.Order("id ASC")
64
+ }).
65
Preload("Tags").
66
Where("id = ?", courseID).
67
First(&course).Error; err != nil {
0 commit comments