From 48728de4ba333e0ccb2467b718c0bf726f66d99a Mon Sep 17 00:00:00 2001 From: Raajheer1 Date: Mon, 27 May 2024 18:18:25 -0500 Subject: [PATCH] preload roles --- pkg/database/models/roster.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/database/models/roster.go b/pkg/database/models/roster.go index cbc057c..16c64df 100644 --- a/pkg/database/models/roster.go +++ b/pkg/database/models/roster.go @@ -71,7 +71,7 @@ func GetRosters() ([]Roster, error) { func GetRostersByCID(cid uint) ([]Roster, error) { var rosters []Roster - return rosters, database.DB.Where("c_id = ?", cid).Find(&rosters).Error + return rosters, database.DB.Where("c_id = ?", cid).Preload("Roles").Find(&rosters).Error } func GetRostersByFacility(facility constants.FacilityID) ([]Roster, error) {