diff --git a/VERSION b/VERSION index f1547e6..815e68d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.7 +2.0.8 diff --git a/play-life-backend/main.go b/play-life-backend/main.go index 52a59fe..4289511 100644 --- a/play-life-backend/main.go +++ b/play-life-backend/main.go @@ -903,7 +903,7 @@ func (a *App) addWordsHandler(w http.ResponseWriter, r *http.Request) { stmt, err := tx.Prepare(` INSERT INTO words (name, translation, description, dictionary_id, user_id) - VALUES ($1, $2, $3, COALESCE($4, $5), $6) + VALUES ($1, $2, $3, $4, $5) RETURNING id `) if err != nil { @@ -917,10 +917,8 @@ func (a *App) addWordsHandler(w http.ResponseWriter, r *http.Request) { for i, wordReq := range req.Words { var id int dictionaryID := defaultDictID - var dictIDParam interface{} = nil if wordReq.DictionaryID != nil { dictionaryID = *wordReq.DictionaryID - dictIDParam = dictionaryID // Проверяем, что словарь принадлежит пользователю var dictUserID int err := tx.QueryRow(` @@ -941,7 +939,7 @@ func (a *App) addWordsHandler(w http.ResponseWriter, r *http.Request) { return } } - err := stmt.QueryRow(wordReq.Name, wordReq.Translation, wordReq.Description, dictIDParam, dictionaryID, userID).Scan(&id) + err := stmt.QueryRow(wordReq.Name, wordReq.Translation, wordReq.Description, dictionaryID, userID).Scan(&id) if err != nil { log.Printf("Error inserting word %d (name='%s', dict_id=%d, user_id=%d): %v", i, wordReq.Name, dictionaryID, userID, err) sendErrorWithCORS(w, err.Error(), http.StatusInternalServerError)