A default page size made 60. Deleted fields email and hide_email.

This commit is contained in:
Alexander Andreev 2022-08-27 04:19:11 +04:00
parent bdf5296c69
commit 7e11e3a5e6
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -10,7 +10,7 @@ let connection = mysql.createConnection(config.database);
connection.config.queryFormat = util.mysqlQueryFormat; connection.config.queryFormat = util.mysqlQueryFormat;
exports.pageSize = config.guestbook.pageSize !== undefined exports.pageSize = config.guestbook.pageSize !== undefined
? config.guestbook.pageSize : 20; ? config.guestbook.pageSize : 60;
exports.closeConnection = () => connection.end(); exports.closeConnection = () => connection.end();
@ -21,11 +21,6 @@ exports.getPosts = async (page = 1, page_size = exports.pageSize) => {
guestbook.post_id, guestbook.post_id,
guestbook.created, guestbook.created,
guestbook.name, guestbook.name,
(CASE
WHEN guestbook.hide_email IS false
THEN guestbook.email
ELSE NULL
END) AS email,
(CASE (CASE
WHEN guestbook.hide_website IS false WHEN guestbook.hide_website IS false
THEN guestbook.website THEN guestbook.website
@ -59,8 +54,8 @@ exports.getPostsCount = async () => {
exports.addPost = async (post) => { exports.addPost = async (post) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let query = "INSERT INTO `guestbook` (`name`, `email`, `website`, `message`, `hide_website`, `hide_email`) \ let query = "INSERT INTO `guestbook` (`name`, `website`, `message`, `hide_website`) \
VALUES (:name, :email, :website, :message, :hide_website, :hide_email);"; VALUES (:name, :website, :message, :hide_website);";
if (post.message === undefined || post.message === "") if (post.message === undefined || post.message === "")
return reject("empty message"); return reject("empty message");