From 7570d523f915b5a33be9316f27a985ef4b23c8ed Mon Sep 17 00:00:00 2001 From: Laurent Luce Date: Mon, 26 Aug 2024 11:03:15 -0400 Subject: [PATCH] Prelload flows and templates in GetTenant similar to GetOrCreateTenant (#6) --- kontrol-service/database/tenant.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kontrol-service/database/tenant.go b/kontrol-service/database/tenant.go index f3b720d..153a12e 100644 --- a/kontrol-service/database/tenant.go +++ b/kontrol-service/database/tenant.go @@ -46,7 +46,7 @@ func (db *Db) GetTenant( tenantId string, ) (*Tenant, error) { var tenant Tenant - result := db.db.Where("tenant_id = ?", tenantId).First(&tenant) + result := db.db.Where("tenant_id = ?", tenantId).Preload("Flows").Preload("Templates").First(&tenant) if result.Error != nil { if result.Error == gorm.ErrRecordNotFound { return nil, nil