Added user authentication
This commit is contained in:
parent
d7e7af5a10
commit
cb54057305
40 changed files with 710 additions and 218 deletions
|
|
@ -41,11 +41,13 @@ func (s *Service) GetSite(ctx context.Context, id int) (models.Site, error) {
|
|||
return s.db.GetSite(ctx, int64(id))
|
||||
}
|
||||
|
||||
func (s *Service) CreateSite(ctx context.Context, name string) (models.Site, error) {
|
||||
func (s *Service) CreateSite(ctx context.Context, user models.User, name string) (models.Site, error) {
|
||||
newSite := models.Site{
|
||||
Name: normaliseName(name),
|
||||
Title: name,
|
||||
Theme: "bear",
|
||||
Name: normaliseName(name),
|
||||
OwnerUserID: user.ID,
|
||||
Title: name,
|
||||
Theme: "bear",
|
||||
URL: "https://meek-meringue-060cfc.netlify.app/",
|
||||
}
|
||||
|
||||
_, ok := s.themes.Lookup(newSite.Theme)
|
||||
|
|
@ -62,7 +64,7 @@ func (s *Service) CreateSite(ctx context.Context, name string) (models.Site, err
|
|||
SiteID: newSite.ID,
|
||||
Role: models.TargetRoleProduction,
|
||||
Type: models.TargetTypeNetlify,
|
||||
URL: "https://meek-meringue-060cfc.netlify.app",
|
||||
URL: "https://meek-meringue-060cfc.netlify.app/",
|
||||
TargetRef: "e628dc6e-e6e1-45a9-847a-982adef940a8",
|
||||
}); err != nil {
|
||||
return models.Site{}, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue