From 1205136f412608d7ff5c6ee29b2110bdfed2fac6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mikl=C3=B3s=20T=C3=B3th?= <tothmiklostibor@gmail.com>
Date: Mon, 4 Oct 2021 11:37:54 +0200
Subject: [PATCH] fix user - team assoc

---
 .gitlab-ci.yml               | 2 +-
 k8s/templates/deployment.yml | 3 +--
 k8s/values.yaml              | 2 +-
 model/access.go              | 4 ++++
 web/router.go                | 2 +-
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aabe23b..3d7b7c8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,7 @@
 image: alpine
 
 variables:
-  VERSION: v2
+  VERSION: v2.1
 
 stages:
   - build
diff --git a/k8s/templates/deployment.yml b/k8s/templates/deployment.yml
index 4a82336..b78c4c2 100644
--- a/k8s/templates/deployment.yml
+++ b/k8s/templates/deployment.yml
@@ -19,7 +19,7 @@ spec:
               name: http
           env:
             - name: POSTGRES
-              value: "postgres://feri:almafa@cockroachdb-public.matrix.svc:26257"
+              value: "postgres://feri:almafa@cockroachdb-public.matrix.svc:26257/feri"
           resources:
             requests:
               memory: 50Mi
@@ -31,6 +31,5 @@ spec:
             httpGet:
               path: "/"
               port: 8080
-            initialDelaySeconds: 60
             failureThreshold: 3
             periodSeconds: 60
diff --git a/k8s/values.yaml b/k8s/values.yaml
index 2dee7e5..3bdd0fc 100644
--- a/k8s/values.yaml
+++ b/k8s/values.yaml
@@ -2,5 +2,5 @@ replicas: 1
 
 Domain: keresettaferi.kszk.bme.hu
 Name: keresettaferi
-Tag: "v2"
+Tag: "v2.1"
 REGISTRY_CONF: "${REGISTRY_CONF}"
diff --git a/model/access.go b/model/access.go
index 55b0034..fd967c7 100644
--- a/model/access.go
+++ b/model/access.go
@@ -18,6 +18,10 @@ func SaveUser(u *User) error {
 	return db.Omit(clause.Associations).Save(u).Error
 }
 
+func SaveUserWithGroup(u *User) error {
+	return db.Save(u).Error
+}
+
 func GetGroup(id string) (*Group, error) {
 	var g Group
 	e := db.First(&g, "id = ?", id).Error
diff --git a/web/router.go b/web/router.go
index ca103d2..e7c2328 100644
--- a/web/router.go
+++ b/web/router.go
@@ -88,7 +88,7 @@ func login(c *gin.Context) {
 			Name:  c.PostForm("name"),
 			Group: group,
 		}
-		err = model.SaveUser(user)
+		err = model.SaveUserWithGroup(user)
 		if err != nil {
 			_ = c.Error(err)
 			return
-- 
GitLab