func DeleteSite(db *gorm.DB, id int) Site {
	site := FetchSite(db, id)
	db.Delete(&site)
	return site
}
DeleteSite removes a site from the database based on the provided id
package structs
import (
	"fmt"
	"gorm.io/gorm"
)
type Site struct {
	gorm.Model
	Title             string `gorm:"size:255"`
	Domain            string `gorm:"size:255;unique_index"`
	DestinationDomain string
	Type              int
	Theme             Theme
	ThemeID           int
	Users             []*User `gorm:"many2many:user_sites;"`
}
func CreateSite(db *gorm.DB, title string, domain string, siteType int, themeID int, destinationDomain string) Site {
	site := Site{
		Title:             title,
		Domain:            domain,
		Type:              siteType,
		ThemeID:           themeID,
		DestinationDomain: destinationDomain,
	}
	if err := db.Create(&site).Error; err != nil {
		fmt.Println("Could not create site")
		return site
	}
	return site
}
func FetchSite(db *gorm.DB, id int) (site Site) {
	site = Site{}
	db.Preload("Theme").First(&site, id)
	return site
}
func FetchSites(db *gorm.DB) (sites []Site) {
	sites = []Site{}
	db.Find(&sites)
	return sites
}
func FetchSiteByHost(db *gorm.DB, host string) Site {
	site := Site{}
	db.Preload("Theme").Where("domain = ?", host).First(&site)
	return site
}
func UpdateSite(db *gorm.DB, id int, title string, domain string, siteType int, themeID int, destinationDomain string) bool {
	site := FetchSite(db, id)
	site.Title = title
	site.Domain = domain
	site.Type = siteType
	site.ThemeID = themeID
	site.DestinationDomain = destinationDomain
	if err := db.Save(&site).Error; err != nil {
		fmt.Println("Could not create site")
		return false
	}
	return true
}