This is an automated email from the git hooks/post-receive script. New commit to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git commit 62a3fb8d33a06ce7dd94b494da1e583713a36ba3 Author: Benjamin <poussin@codelutin.com> Date: Mon Apr 6 01:49:13 2020 +0200 repackaging on utilise bow et non pas bookmarks --- cmd/bow/main.go | 4 ++-- go.mod | 2 +- http/bookmarkResource.go | 4 ++-- http/userResource.go | 4 ++-- repository/bookmarkRepository.go | 6 +++--- repository/database.go | 2 +- repository/userRepository.go | 10 +++++----- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cmd/bow/main.go b/cmd/bow/main.go index 20fba7c..d60282d 100644 --- a/cmd/bow/main.go +++ b/cmd/bow/main.go @@ -4,8 +4,8 @@ import ( "log" "os" - "gitlab.chorem.org/chorem/bookmarks/http" - "gitlab.chorem.org/chorem/bookmarks/repository" + "gitlab.chorem.org/chorem/bow/http" + "gitlab.chorem.org/chorem/bow/repository" ) func main() { diff --git a/go.mod b/go.mod index b8aff7e..6adf0de 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gitlab.chorem.org/chorem/bookmarks +module gitlab.chorem.org/chorem/bow go 1.14 diff --git a/http/bookmarkResource.go b/http/bookmarkResource.go index 663036b..602328d 100644 --- a/http/bookmarkResource.go +++ b/http/bookmarkResource.go @@ -7,8 +7,8 @@ import ( "net/http" "github.com/gorilla/mux" - "gitlab.chorem.org/chorem/bookmarks/model" - "gitlab.chorem.org/chorem/bookmarks/repository" + "gitlab.chorem.org/chorem/bow/model" + "gitlab.chorem.org/chorem/bow/repository" ) func addBookmark(w http.ResponseWriter, r *http.Request) { diff --git a/http/userResource.go b/http/userResource.go index 9b2618b..58b9c8c 100644 --- a/http/userResource.go +++ b/http/userResource.go @@ -7,8 +7,8 @@ import ( "net/http" "github.com/gorilla/mux" - "gitlab.chorem.org/chorem/bookmarks/model" - "gitlab.chorem.org/chorem/bookmarks/repository" + "gitlab.chorem.org/chorem/bow/model" + "gitlab.chorem.org/chorem/bow/repository" ) /* diff --git a/repository/bookmarkRepository.go b/repository/bookmarkRepository.go index a84dee1..acdb831 100644 --- a/repository/bookmarkRepository.go +++ b/repository/bookmarkRepository.go @@ -6,7 +6,7 @@ import ( "encoding/json" "github.com/jackc/pgtype" - "gitlab.chorem.org/chorem/bookmarks/model" + "gitlab.chorem.org/chorem/bow/model" ) /* @@ -58,7 +58,7 @@ func UpdateBookmark(bookmark model.Bookmark) error { bookmarkAsJSON, err := json.Marshal(bookmark) if err != nil { return err - } + } _, err = db.Exec(context.Background(), ` UPDATE bookmark AS t @@ -68,7 +68,7 @@ func UpdateBookmark(bookmark model.Bookmark) error { WHERE id=$1`, bookmark.ID, string(bookmarkAsJSON)) return err - + } /* diff --git a/repository/database.go b/repository/database.go index 6f10dea..e949afa 100644 --- a/repository/database.go +++ b/repository/database.go @@ -99,7 +99,7 @@ func migrateDatabase(databaseURL string) { if err != nil { log.Fatalf("Unable to get current version:\n %v\n", err) } - log.Printf("Migrate database from %s to last version\n", currentVersion) + log.Printf("Migrate database from %d to last version\n", currentVersion) ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/repository/userRepository.go b/repository/userRepository.go index 60aa042..8987cd4 100644 --- a/repository/userRepository.go +++ b/repository/userRepository.go @@ -9,8 +9,8 @@ import ( "time" "github.com/jackc/pgtype" - "gitlab.chorem.org/chorem/bookmarks/model" - "gitlab.chorem.org/chorem/bookmarks/utils" + "gitlab.chorem.org/chorem/bow/model" + "gitlab.chorem.org/chorem/bow/utils" ) /* @@ -33,7 +33,7 @@ func UserJSON(id string) (string, error) { /* UserJSON retourne l'id de l'utilisateur (string) si le mot de passe est le bon et que l'utilisateur est retrouve */ -func checkPassword(loginOrEmail string, password string) string, error { +func checkPassword(loginOrEmail string, password string) (string, error) { var uuid pgtype.UUID var hash string row := db.QueryRow(context.Background(), `select id, password from bowuser where login=$1 or emails @> $2::text[]`, loginOrEmail, fmt.Sprintf(`{"%s"}`, loginOrEmail)) @@ -47,12 +47,12 @@ func checkPassword(loginOrEmail string, password string) string, error { } var result string - err = pgjson.AssignTo(&result) + err = uuid.AssignTo(&result) if err != nil { return "", err } - return result + return result, nil } /* -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.