fix: run linter
This commit is contained in:
@@ -43,34 +43,7 @@ func TokenIsNotExpired(access_token string) bool {
|
||||
func GetUserProfile(context *gin.Context) {
|
||||
|
||||
session := sessions.Default(context)
|
||||
/* access_token := session.Get("access_token")
|
||||
user_profile_client := http.Client{}
|
||||
|
||||
user_profile_url, err := url.Parse("https://" + os.Getenv("AUTH0_DOMAIN") + os.Getenv("AUTH0_USER_INFO_ENDPOINT"))
|
||||
|
||||
if err != nil {
|
||||
log.Println("Failed to build user profile url " + err.Error())
|
||||
context.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
user_profile_request, user_profile_request_error := http.NewRequest("GET", user_profile_url.String(), nil)
|
||||
if user_profile_request_error != nil {
|
||||
log.Println("Failed to initialize validation request", user_profile_request_error.Error())
|
||||
context.AbortWithStatus(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
user_profile_request.Header.Add("Accept", "application/json")
|
||||
user_profile_request.Header.Add("Authorization", "Bearer "+access_token.(string))
|
||||
|
||||
user_profile_response, user_profile_response_err := user_profile_client.Do(user_profile_request)
|
||||
if user_profile_response_err != nil {
|
||||
log.Println("Failed to validate user")
|
||||
context.AbortWithStatus(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
defer user_profile_response.Body.Close()
|
||||
user_profile_bytes, _ := io.ReadAll(user_profile_response.Body) */
|
||||
var user_profile dto.UserProfileResponse
|
||||
profile_session := session.Get("profile").(map[string]interface{})
|
||||
user_profile.Sub = profile_session["sub"].(string)
|
||||
|
||||
@@ -217,7 +217,7 @@ func CreatePosition(pool *pgxpool.Pool) gin.HandlerFunc {
|
||||
_, exec_err := conn.Exec(context.Background(), queries.CREATE_POSITION, position_name)
|
||||
if exec_err != nil {
|
||||
ctx.JSON(http.StatusInternalServerError, "CreatePosition(): ERROR... exec failed")
|
||||
log.Println("CreatePosition(): ERROR... exec failed... %s", exec_err.Error())
|
||||
log.Printf("CreatePosition(): ERROR... exec failed... %s", exec_err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -248,14 +248,14 @@ func SetUserPosition(pool *pgxpool.Pool) gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusInternalServerError, "SetUserPosition(): ERROR... Failed to query")
|
||||
log.Println("SetUserPosition(): ERROR... Failed to query position table... %s", query_err.Error())
|
||||
log.Printf("SetUserPosition(): ERROR... Failed to query position table... %s", query_err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
_, exec_err := conn.Exec(context.Background(), queries.USER_SET_POSITION, position_id, user_id)
|
||||
if exec_err != nil {
|
||||
ctx.JSON(http.StatusInternalServerError, "SetUserPosition(): ERROR... failed to update user object")
|
||||
log.Println("SetUserPosition(): ERROR... Failed to update user object... %s", exec_err.Error())
|
||||
log.Printf("SetUserPosition(): ERROR... Failed to update user object... %s", exec_err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user