Compare commits

..

No commits in common. "523bdb24cd9eee4a4641e5197d32c522b05d6060" and "82faacb9ec5218504c7f7be48ca74bd1ba7a5588" have entirely different histories.

3 changed files with 8 additions and 21 deletions

View File

@ -50,17 +50,6 @@ func ServeArticle(c *b.Config, db *b.DB) http.HandlerFunc {
return
}
article.Clicks++
if err = db.UpdateAttributes(&b.Attribute{Table: "articles", ID: article.ID, AttName: "clicks", Value: article.Clicks}); err != nil {
log.Println(err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if _, err = fmt.Fprint(w, content); err != nil {
log.Println(err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
fmt.Fprint(w, content)
}
}

View File

@ -121,7 +121,6 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
Rejected: false,
IsInIssue: r.PostFormValue("issue") == "on",
AutoGenerated: false,
EditedID: 0,
}
if len(article.Title) == 0 {

View File

@ -34,8 +34,7 @@ CREATE TABLE articles (
rejected BOOL NOT NULL,
creator_id INT NOT NULL,
issue_id INT NOT NULL,
edited_id INT NOT NULL,
clicks INT NOT NULL,
edited_id INT,
is_in_issue BOOL NOT NULL,
auto_generated BOOL NOT NULL,
PRIMARY KEY (id),
@ -50,24 +49,24 @@ CREATE TABLE tags (
);
CREATE TABLE articles_authors (
article_id INT NOT NULL,
author_id INT NOT NULL,
article_id INT,
author_id INT,
PRIMARY KEY (article_id, author_id),
FOREIGN KEY (article_id) REFERENCES articles (id),
FOREIGN KEY (author_id) REFERENCES users (id)
);
CREATE TABLE articles_contributors (
article_id INT NOT NULL,
contributor_id INT NOT NULL,
article_id INT,
contributor_id INT,
PRIMARY KEY (article_id, contributor_id),
FOREIGN KEY (article_id) REFERENCES articles (id),
FOREIGN KEY (contributor_id) REFERENCES users (id)
);
CREATE TABLE articles_tags (
article_id INT NOT NULL,
tag_id INT NOT NULL,
article_id INT,
tag_id INT,
PRIMARY KEY (article_id, tag_id),
FOREIGN KEY (article_id) REFERENCES articles (id),
FOREIGN KEY (tag_id) REFERENCES tags (id)