Skip to content

Commit c630ff8

Browse files
Merge pull request #415 from factly/fix/go-lint
Update docker-compose.yml and server files
2 parents cf18cc1 + 2476c40 commit c630ff8

File tree

8 files changed

+21
-17
lines changed

8 files changed

+21
-17
lines changed

docker-compose.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ services:
240240
- REACT_APP_PUBLIC_PATH_DEVELOPMENT=/.factly/kavach/web/
241241
- REACT_APP_KAVACH_TITLE=Kavach
242242
- REACT_APP_COMPANION_URL=http://127.0.0.1:3020
243+
243244
- REACT_APP_API_URL=http://127.0.0.1:4455/.factly/kavach/server
244245
- REACT_APP_KRATOS_PUBLIC_URL=http://127.0.0.1:4455/.ory/kratos/public
245246
- REACT_APP_ENABLE_MULTITENANCY=true
@@ -250,7 +251,10 @@ services:
250251
- type: bind
251252
source: ./web
252253
target: /app
253-
- /app/node_modules
254+
- type: bind
255+
source: ./web/node_modules
256+
target: /app/node_modules
257+
# - /app/node_modules
254258
restart: unless-stopped
255259
networks:
256260
- kavach

server/action/admin/organisation/create.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ func create(w http.ResponseWriter, r *http.Request) {
118118
return
119119
}
120120

121-
result := model.Organisation{}
121+
var result model.Organisation
122122

123-
result = *organisation
123+
if organisation != nil {
124+
result = *organisation
125+
}
124126

125127
result.OrganisationUsers = []model.OrganisationUser{permission}
126128

server/action/admin/organisation/update.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,11 @@ func update(w http.ResponseWriter, r *http.Request) {
9494
errorx.Render(w, errorx.Parser(errorx.RecordNotFound()))
9595
return
9696
}
97-
result := model.Organisation{}
98-
result = *organisation
97+
var result model.Organisation
98+
if organisation != nil {
99+
result = *organisation
100+
}
101+
99102
result.OrganisationUsers = []model.OrganisationUser{*permission}
100103

101104
tx.Commit()

server/action/organisation/application/addDefault.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ func addDefault(w http.ResponseWriter, r *http.Request) {
9999
errorx.Render(w, errorx.Parser(errorx.DBError()))
100100
return
101101
}
102-
newOrganisations := make([]model.Organisation, 0)
103-
newOrganisations = append(app.Organisations, *org)
102+
103+
newOrganisations := append(app.Organisations, *org)
104104
err = tx.Model(&app).Association("Organisations").Replace(&newOrganisations)
105105
if err != nil {
106106
tx.Rollback()

server/action/organisation/application/roles/user/create.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ func create(w http.ResponseWriter, r *http.Request) {
145145
return
146146
}
147147

148-
users := make([]model.User, 0)
149-
users = append(appRole.Users, user)
148+
users := append(appRole.Users, user)
150149
appRole.Users = users
151150
if err = model.DB.Model(&appRole).Association("Users").Replace(&users); err != nil {
152151
tx.Rollback()

server/action/organisation/application/space/roles/user/create.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ func create(w http.ResponseWriter, r *http.Request) {
154154
errorx.Render(w, errorx.Parser(errorx.DBError()))
155155
return
156156
}
157-
users := make([]model.User, 0)
158-
users = append(spaceRole.Users, user)
157+
158+
users := append(spaceRole.Users, user)
159159
spaceRole.Users = users
160160
if err = tx.Model(&spaceRole).Association("Users").Replace(&users); err != nil {
161161
tx.Rollback()

server/action/organisation/user/list.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ func list(w http.ResponseWriter, r *http.Request) {
5656
errorx.Render(w, errorx.Parser(errorx.RecordNotFound()))
5757
return
5858
}
59-
userIDs := []string{}
59+
60+
var userIDs []string
6061

6162
if role == "owner" || role == "member" {
6263
userIDs, err = keto.ListSubjectsByObjectID(namespace, role, fmt.Sprintf("org:%d", orgID))

server/action/user/checker.go

-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ type matchContext struct {
2626
URL *url.URL `json:"url"`
2727
}
2828

29-
type templateContent struct {
30-
From map[string]interface{} `json:"from"`
31-
Personalizations []interface{} `json:"personalizations"`
32-
TemplateID string `json:"template_id"`
33-
}
3429

3530
// create organisation
3631
func checker(w http.ResponseWriter, r *http.Request) {

0 commit comments

Comments
 (0)