diff --git a/backend/Migrations/001_initial.up.sql b/backend/Migrations/001_initial.up.sql index a8745fe7..8908e8ec 100644 --- a/backend/Migrations/001_initial.up.sql +++ b/backend/Migrations/001_initial.up.sql @@ -406,15 +406,29 @@ VALUES ); INSERT INTO - notifications (user_id, message,status) + notifications (user_id, message, status) VALUES ( 2, - 'Welcome to Virtual Horizon, Thank you for signing up', + 'Welcome to Virtual Horizon, Thank you for signing up', 'unread' ), ( 2, - 'Welcome Again, Thank you for signing up', + 'Welcome Again, Thank you for signing up', + 'unread' + ); + +INSERT INTO + notifications (user_id, message, status) +VALUES + ( + 1, + 'Welcome to Virtual Horizon, Thank you for signing up', + 'unread' + ), + ( + 1, + 'Please Join meeting for MCAT Class', 'unread' ); \ No newline at end of file diff --git a/backend/routes/routes.go b/backend/routes/routes.go index 79db66ed..55e2707a 100644 --- a/backend/routes/routes.go +++ b/backend/routes/routes.go @@ -33,6 +33,7 @@ func SetupRoutes(r *gin.Engine) { studentController := &studentcontrollers.StudentController{} tutorController := &tutorControllers.TutorController{} notificationController := ¬ificationControllers.NotificationController{} + // user routes are being set in this route function courseRoutes.SetupRoutes(r, courseController) enrollmentRoutes.SetupRoutes(r, enrollmentController) diff --git a/backend/src/notifications/controllers/notifications.controller.go b/backend/src/notifications/controllers/notifications.controller.go index 118ea8b6..cfe4cce4 100644 --- a/backend/src/notifications/controllers/notifications.controller.go +++ b/backend/src/notifications/controllers/notifications.controller.go @@ -17,7 +17,7 @@ type NotificationFunctions interface { GetNotifications(*gin.Context) } -func (_ *NotificationController) GetNotifications(ctx *gin.Context) { +func (*NotificationController) GetNotifications(ctx *gin.Context) { user, err := utils.GetUserFromToken(ctx) if err != nil { @@ -28,6 +28,7 @@ func (_ *NotificationController) GetNotifications(ctx *gin.Context) { initializers.DB. Where("user_id = ?", user.ID). + //Order("created_at DESC"). Find(&Notifications) ctx.JSON(http.StatusOK, gin.H{ diff --git a/backend/src/notifications/routes/notifications.routes.go b/backend/src/notifications/routes/notifications.routes.go index 67b0fd88..7cc44129 100644 --- a/backend/src/notifications/routes/notifications.routes.go +++ b/backend/src/notifications/routes/notifications.routes.go @@ -6,7 +6,7 @@ import ( "github.com/gin-gonic/gin" ) -func SetupRoutes(engine *gin.Engine, controller controllers.NotificationFunctions) { - enrollmentRoutes := engine.Group("notification") - enrollmentRoutes.POST("getNotifications", controller.GetNotifications) +func SetupRoutes(r *gin.Engine, controller controllers.NotificationFunctions) { + enrollmentRoutes := r.Group("notification") + enrollmentRoutes.GET("getnotifications", controller.GetNotifications) } diff --git a/docker-compose-ci.yaml b/docker-compose-ci.yaml index 397bdb90..b85193ad 100644 --- a/docker-compose-ci.yaml +++ b/docker-compose-ci.yaml @@ -88,4 +88,4 @@ services: # vh-net: # ipv4_address: 172.19.0.6 volumes: - db-data: + db-data: \ No newline at end of file