Fixed site ownership

This commit is contained in:
Leon Mika 2025-02-01 10:56:59 +11:00
parent cb54057305
commit 50f7e9632e
20 changed files with 192 additions and 78 deletions

View file

@ -41,13 +41,16 @@ func (s *Service) GetSite(ctx context.Context, id int) (models.Site, error) {
return s.db.GetSite(ctx, int64(id))
}
func (s *Service) GetProdTargetOfSite(ctx context.Context, siteID int) (models.PublishTarget, error) {
return s.db.GetPublishTargetBySiteRole(ctx, int64(siteID), models.TargetRoleProduction)
}
func (s *Service) CreateSite(ctx context.Context, user models.User, name string) (models.Site, error) {
newSite := models.Site{
Name: normaliseName(name),
OwnerUserID: user.ID,
Title: name,
Theme: "bear",
URL: "https://meek-meringue-060cfc.netlify.app/",
}
_, ok := s.themes.Lookup(newSite.Theme)