branch bow-v2-go updated (a859577 -> 61712a1)
This is an automated email from the git hooks/post-receive script. New change to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git from a859577 Nouvelle UI - Améliorations d'affichage new 61712a1 correction des types de date en base pour (TIMESTAMP WITH TIME ZONE) pour etre compatible avec les dates go edition fonctionnelle correction du fetcher pour les reponses vides The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 61712a13f041ce7fad25c9249b7d56ee0a61dec5 Author: Benjamin <poussin@codelutin.com> Date: Tue Apr 14 19:27:46 2020 +0200 correction des types de date en base pour (TIMESTAMP WITH TIME ZONE) pour etre compatible avec les dates go edition fonctionnelle correction du fetcher pour les reponses vides Summary of changes: migrate/001_init_schema.sql | 34 +++++++++++++++++----------------- pkg/repository/bookmarkRepository.go | 5 +++-- web/src/utils/FetchHelper.js | 8 +++++++- web/src/views/BookmarkEdit.vue | 15 +++++++++++---- 4 files changed, 38 insertions(+), 24 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 61712a13f041ce7fad25c9249b7d56ee0a61dec5 Author: Benjamin <poussin@codelutin.com> Date: Tue Apr 14 19:27:46 2020 +0200 correction des types de date en base pour (TIMESTAMP WITH TIME ZONE) pour etre compatible avec les dates go edition fonctionnelle correction du fetcher pour les reponses vides --- migrate/001_init_schema.sql | 34 +++++++++++++++++----------------- pkg/repository/bookmarkRepository.go | 5 +++-- web/src/utils/FetchHelper.js | 8 +++++++- web/src/views/BookmarkEdit.vue | 15 +++++++++++---- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/migrate/001_init_schema.sql b/migrate/001_init_schema.sql index 415c082..ba0b1a0 100644 --- a/migrate/001_init_schema.sql +++ b/migrate/001_init_schema.sql @@ -15,7 +15,7 @@ CREATE OR REPLACE FUNCTION text(text[]) CREATE TYPE Token AS ( name TEXT, token UUID, - validity timestamp + validity TIMESTAMP WITH TIME ZONE ); CREATE TYPE AuthenticationInfo AS ( @@ -39,18 +39,18 @@ CREATE TYPE Action AS ( CREATE TABLE bowUser ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), - creationDate timestamp DEFAULT current_timestamp, - updateDate timestamp DEFAULT current_timestamp, - login Text, - password Text, + creationDate TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp, + updateDate TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp, + login TEXT, + password TEXT, tokens jsonb, -- [{name: sring, token: string, expire: date}] emails TEXT[], unconfirmedEmails jsonb, -- [{email: string, token: string, creationDate: date}] authenticationInfo jsonb, -- AuthenticationInfo, - autoScreenshot boolean, - autoFavicon boolean, - maxTagInCloud smallint, - maxResult smallint, + autoScreenshot BOOLEAN, + autoFavicon BOOLEAN, + maxTagInCloud SMALLINT, + maxResult SMALLINT, actions jsonb -- [{"action": string, "prefix": string, "suggest": string}] ); @@ -61,8 +61,8 @@ CREATE INDEX bowUser_unconfirmedEmails_idx ON BowUser USING gin (unconfirmedEmai CREATE TABLE bowgroup ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), - creationDate timestamp DEFAULT current_timestamp, - updateDate timestamp DEFAULT current_timestamp, + creationDate TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp, + updateDate TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp, name TEXT, description TEXT, tokens jsonb, -- [{name: sring, token: string, expiration: date}] @@ -82,10 +82,10 @@ CREATE TABLE bookmark ( owner UUID REFERENCES bowUser(id) ON DELETE CASCADE ON UPDATE CASCADE, uri TEXT, description TEXT, - tags text[], - creationDate TIMESTAMP, - updateDate timestamp DEFAULT current_timestamp, - importDate TIMESTAMP, + tags TEXT[], + creationDate TIMESTAMP WITH TIME ZONE, + updateDate TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp, + importDate TIMESTAMP WITH TIME ZONE, privateAlias TEXT[], publicAlias TEXT[], authenticationInfo jsonb, -- AuthenticationInfo, @@ -106,7 +106,7 @@ CREATE INDEX bookmark_publicAlias_idx ON bookmark USING gin (publicAlias); -- TO CREATE TABLE pageHistory ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), uri TEXT, - creationDate TIMESTAMP, + creationDate TIMESTAMP WITH TIME ZONE, content TEXT, lang regconfig NOT NULL DEFAULT 'english'::regconfig ); @@ -117,7 +117,7 @@ CREATE INDEX pageHistory_content_idx ON pageHistory USING GIN (to_tsvector(lang, CREATE TABLE actionHistory ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), owner UUID REFERENCES bowUser(id) ON DELETE CASCADE ON UPDATE CASCADE, - creationDate TIMESTAMP, + creationDate TIMESTAMP WITH TIME ZONE, Action action, request TEXT, lang regconfig NOT NULL DEFAULT 'english'::regconfig diff --git a/pkg/repository/bookmarkRepository.go b/pkg/repository/bookmarkRepository.go index 4801257..2bf838c 100644 --- a/pkg/repository/bookmarkRepository.go +++ b/pkg/repository/bookmarkRepository.go @@ -107,10 +107,11 @@ func UpdateBookmark(currentUserID string, bookmark model.Bookmark) error { return utils.NewHTTPError500(err, currentUserID) } + log.Println("Update bookmark", bookmarkAsJSON) q := &query{sql: ` UPDATE bookmark AS t - SET (uri, description, privateAlias, publicAlias, lang) = - (SELECT uri, description, privateAlias, publicAlias, lang + SET (uri, description, tags, privateAlias, publicAlias, lang) = + (SELECT uri, description, tags, privateAlias, publicAlias, lang FROM json_populate_record(NULL::bookmark, $2::json)) WHERE id=$1`} err = q.execOnOneRow(currentUserID, bookmark.ID, string(bookmarkAsJSON)) diff --git a/web/src/utils/FetchHelper.js b/web/src/utils/FetchHelper.js index 1c89a60..a0d487a 100644 --- a/web/src/utils/FetchHelper.js +++ b/web/src/utils/FetchHelper.js @@ -22,7 +22,13 @@ let FetchHelper = { } if (response.status === 200 || response.status === 201) { - return response.json() + if ((response.headers.get('Content-Type') || '').toLowerCase() === 'application/json') { + return response.json() + } else if (parseInt(response.headers.get('Content-Length')) > 0) { + return response.text() + } else { + return null + } } if (response.status === 503) { diff --git a/web/src/views/BookmarkEdit.vue b/web/src/views/BookmarkEdit.vue index c5dca60..00ed3e8 100644 --- a/web/src/views/BookmarkEdit.vue +++ b/web/src/views/BookmarkEdit.vue @@ -13,6 +13,7 @@ <br /> public alias: <input type="text" v-model.trim="bookmark.publicalias" /> <br /> + <button @click.prevent="cancel">Cancel</button> <button @click.prevent="save">Save</button> </form> </div> @@ -44,9 +45,15 @@ class BookmarkEdit extends Vue { } } + cancel() { + this.$router.go(-1) + } + save() { - let promise; - this.bookmark.tags = this.bookmark.tags.split(/[,\s]/) + let promise + if (!Array.isArray(this.bookmark.tags)) { + this.bookmark.tags = this.bookmark.tags.split(/[,\s]/) + } if (this.bookmark.id) { promise = this.$fetch.put(`/bookmarks/${this.bookmark.id}`, this.bookmark) } else { @@ -54,11 +61,11 @@ class BookmarkEdit extends Vue { } promise.then( - (data) => { + data => { console.log('ok') let query = {} query.id = this.bookmark.id || data.id - this.$router.push({ name: 'Home', query}) + this.$router.push({ name: 'Home', query }) }, err => { console.log('ko', err) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm