Compare commits
No commits in common. "523bdb24cd9eee4a4641e5197d32c522b05d6060" and "82faacb9ec5218504c7f7be48ca74bd1ba7a5588" have entirely different histories.
523bdb24cd
...
82faacb9ec
@ -50,17 +50,6 @@ func ServeArticle(c *b.Config, db *b.DB) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
article.Clicks++
|
fmt.Fprint(w, content)
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,6 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
Rejected: false,
|
Rejected: false,
|
||||||
IsInIssue: r.PostFormValue("issue") == "on",
|
IsInIssue: r.PostFormValue("issue") == "on",
|
||||||
AutoGenerated: false,
|
AutoGenerated: false,
|
||||||
EditedID: 0,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(article.Title) == 0 {
|
if len(article.Title) == 0 {
|
||||||
|
@ -34,8 +34,7 @@ CREATE TABLE articles (
|
|||||||
rejected BOOL NOT NULL,
|
rejected BOOL NOT NULL,
|
||||||
creator_id INT NOT NULL,
|
creator_id INT NOT NULL,
|
||||||
issue_id INT NOT NULL,
|
issue_id INT NOT NULL,
|
||||||
edited_id INT NOT NULL,
|
edited_id INT,
|
||||||
clicks INT NOT NULL,
|
|
||||||
is_in_issue BOOL NOT NULL,
|
is_in_issue BOOL NOT NULL,
|
||||||
auto_generated BOOL NOT NULL,
|
auto_generated BOOL NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
@ -50,24 +49,24 @@ CREATE TABLE tags (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE articles_authors (
|
CREATE TABLE articles_authors (
|
||||||
article_id INT NOT NULL,
|
article_id INT,
|
||||||
author_id INT NOT NULL,
|
author_id INT,
|
||||||
PRIMARY KEY (article_id, author_id),
|
PRIMARY KEY (article_id, author_id),
|
||||||
FOREIGN KEY (article_id) REFERENCES articles (id),
|
FOREIGN KEY (article_id) REFERENCES articles (id),
|
||||||
FOREIGN KEY (author_id) REFERENCES users (id)
|
FOREIGN KEY (author_id) REFERENCES users (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE articles_contributors (
|
CREATE TABLE articles_contributors (
|
||||||
article_id INT NOT NULL,
|
article_id INT,
|
||||||
contributor_id INT NOT NULL,
|
contributor_id INT,
|
||||||
PRIMARY KEY (article_id, contributor_id),
|
PRIMARY KEY (article_id, contributor_id),
|
||||||
FOREIGN KEY (article_id) REFERENCES articles (id),
|
FOREIGN KEY (article_id) REFERENCES articles (id),
|
||||||
FOREIGN KEY (contributor_id) REFERENCES users (id)
|
FOREIGN KEY (contributor_id) REFERENCES users (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE articles_tags (
|
CREATE TABLE articles_tags (
|
||||||
article_id INT NOT NULL,
|
article_id INT,
|
||||||
tag_id INT NOT NULL,
|
tag_id INT,
|
||||||
PRIMARY KEY (article_id, tag_id),
|
PRIMARY KEY (article_id, tag_id),
|
||||||
FOREIGN KEY (article_id) REFERENCES articles (id),
|
FOREIGN KEY (article_id) REFERENCES articles (id),
|
||||||
FOREIGN KEY (tag_id) REFERENCES tags (id)
|
FOREIGN KEY (tag_id) REFERENCES tags (id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user