19 lines
446 B
Go
19 lines
446 B
Go
package handlers
|
|
|
|
import (
|
|
"Yimaru-Backend/internal/domain"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
// lmsBlockIfInaccessible returns a 403 response when a learner is blocked; otherwise nil.
|
|
func lmsBlockIfInaccessible(c *fiber.Ctx, a *domain.LMSEntityAccess) error {
|
|
if a == nil || a.IsAccessible {
|
|
return nil
|
|
}
|
|
return c.Status(fiber.StatusForbidden).JSON(domain.ErrorResponse{
|
|
Message: a.Reason,
|
|
Error: "LMS_PREREQUISITE_NOT_MET",
|
|
})
|
|
}
|