Skip to content

Commit

Permalink
Merge pull request #419 from factly/context-issue
Browse files Browse the repository at this point in the history
fix: addDefault application failing issue
  • Loading branch information
vsumit89 committed Feb 8, 2024
2 parents 3a7bfa3 + 519147e commit ad9fe56
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ services:
####### UPLOAD SERVICES #######
###########################################################################
companion:
image: transloadit/companion
image: transloadit/companion:sha-e80a7f7
ports:
- "3020:3020"
env_file:
Expand Down
8 changes: 7 additions & 1 deletion server/action/organisation/application/addDefault.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ func addDefault(w http.ResponseWriter, r *http.Request) {
}

var userContext model.ContextKey = "application_user"
tx := model.DB.WithContext(context.WithValue(r.Context(), userContext, uID)).Begin()
var organisationUserKey model.ContextKey = "organisation_user"

// set context value for user and organisation
ctx := context.WithValue(r.Context(), userContext, uID)
ctx = context.WithValue(ctx, organisationUserKey, uID)

tx := model.DB.WithContext(ctx).Begin()
app := model.Application{}
err = tx.Model(&model.Application{}).Where(&model.Application{
Base: model.Base{
Expand Down
Loading

0 comments on commit ad9fe56

Please sign in to comment.