Skip to content

Commit

Permalink
fix: addDefault application failing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
elliot14A committed Feb 8, 2024
1 parent 3a7bfa3 commit acd3c62
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 58 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
20 changes: 10 additions & 10 deletions server/config/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ func SetupVars() {
log.Fatal("please provide dynamic_mande_template id in config")
}

if !viper.IsSet("dynamic_sendgrid_api_key") {
log.Fatal("please provide dynamic_sendgrid_api key in config")
}
// if !viper.IsSet("dynamic_sendgrid_api_key") {
// log.Fatal("please provide dynamic_sendgrid_api key in config")
// }
}

if !viper.IsSet("kratos_admin_url") {
Expand Down Expand Up @@ -116,13 +116,13 @@ func SetupVars() {
log.Fatal("please provide keto_read_api_url in config")
}

if !viper.IsSet("sendgrid_from_email") {
log.Fatal("please provide sendgrid_from_email in config")
}

if !viper.IsSet("sendgrid_from_name") {
log.Fatal("please provide sendgrid_from_name in config")
}
// if !viper.IsSet("sendgrid_from_email") {
// log.Fatal("please provide sendgrid_from_email in config")
// }
//
// if !viper.IsSet("sendgrid_from_name") {
// log.Fatal("please provide sendgrid_from_name in config")
// }

}

Expand Down
Loading

0 comments on commit acd3c62

Please sign in to comment.