From 0935f81b3305f5dd961dad223b378029e0b2843c Mon Sep 17 00:00:00 2001 From: Kyle Vann Date: Fri, 28 Jun 2024 20:51:22 +0100 Subject: [PATCH 1/7] nearly done. --- db/index.js | 24 ++- package-lock.json | 500 ++++++++++++++++++++++++------------------- package.json | 5 +- src/routers/books.js | 3 +- 4 files changed, 302 insertions(+), 230 deletions(-) diff --git a/db/index.js b/db/index.js index af723442..66e6fd6d 100644 --- a/db/index.js +++ b/db/index.js @@ -2,23 +2,35 @@ require('dotenv').config() // Require Client obj from the postgres node module -const { Client } = require("pg"); +const knex = require("knex")({ + client: "mysql", + connection: { + host: 'nassydev.synology.me', + user: 'kyle', + password: 'Kyleisnowanerd1!', + database:'api-express-database', + timezone: 'utc', + }, + debug: false, +}); const client = { query: async (str, values) => { // Get the connection string from process.env - // the dotenv library sets this variable based + // on the contents of our env file + // Create a new connection to the database using the Client + // object provided by the postgres node module - const dbClient = new Client(process.env.PGURL) + // connect a connection - await dbClient.connect() + // execute the query - const result = await dbClient.query(str, values) + const result = await knex.raw(str, values) // close the connection - await dbClient.end() - return result + return result[0] } } diff --git a/package-lock.json b/package-lock.json index 37ccdff8..7c8367fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,9 +13,10 @@ "dotenv": "^16.3.1", "express": "^4.18.2", "faker": "^5.5.3", + "knex": "^3.1.0", + "mariadb": "^3.3.1", "morgan": "1.10.0", - "pg": "8.6.0", - "pg-promise": "^11.5.4" + "mysql": "^2.18.1" }, "devDependencies": { "jest": "^28.1.3", @@ -1112,6 +1113,11 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/geojson": { + "version": "7946.0.14", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", + "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==" + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -1146,10 +1152,9 @@ } }, "node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, + "version": "20.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", + "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", "dependencies": { "undici-types": "~5.26.4" } @@ -1271,14 +1276,6 @@ "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", "dev": true }, - "node_modules/assert-options": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/assert-options/-/assert-options-0.8.1.tgz", - "integrity": "sha512-5lNGRB5g5i2bGIzb+J1QQE1iKU/WEMVBReFIc5pPDWjcPj23otPL0eI6PB2v7QPi0qU6Mhym5D3y0ZiSIOf3GA==", - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1398,6 +1395,14 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==", + "engines": { + "node": "*" + } + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -1499,14 +1504,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "node_modules/buffer-writer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", - "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==", - "engines": { - "node": ">=4" - } - }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -1687,6 +1684,11 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/colorette": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", + "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -1699,6 +1701,14 @@ "node": ">= 0.8" } }, + "node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "engines": { + "node": ">=14" + } + }, "node_modules/component-emitter": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz", @@ -1758,6 +1768,11 @@ "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", "dev": true }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, "node_modules/cors": { "version": "2.8.5", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", @@ -1829,6 +1844,14 @@ "node": ">=0.4.0" } }, + "node_modules/denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "engines": { + "node": ">=0.10" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -1935,7 +1958,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, "engines": { "node": ">=6" } @@ -1954,6 +1976,14 @@ "node": ">=8" } }, + "node_modules/esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "engines": { + "node": ">=6" + } + }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2278,7 +2308,6 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true, "engines": { "node": ">=8.0.0" } @@ -2295,6 +2324,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/getopts": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/getopts/-/getopts-2.3.0.tgz", + "integrity": "sha512-5eDf9fuSXwxBL6q5HX+dhDj+dslFGWzU5thZ9kNKUkcPtaPdatmUFKwHFrLb/uf/WpA4BHET+AX3Scl56cAjpA==" + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -2505,6 +2539,14 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -2535,7 +2577,6 @@ "version": "2.13.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", - "dev": true, "dependencies": { "hasown": "^2.0.0" }, @@ -2603,6 +2644,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -3344,6 +3390,77 @@ "node": ">=6" } }, + "node_modules/knex": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/knex/-/knex-3.1.0.tgz", + "integrity": "sha512-GLoII6hR0c4ti243gMs5/1Rb3B+AjwMOfjYm97pu0FOQa7JH56hgBxYf5WK2525ceSbBY1cjeZ9yk99GPMB6Kw==", + "dependencies": { + "colorette": "2.0.19", + "commander": "^10.0.0", + "debug": "4.3.4", + "escalade": "^3.1.1", + "esm": "^3.2.25", + "get-package-type": "^0.1.0", + "getopts": "2.3.0", + "interpret": "^2.2.0", + "lodash": "^4.17.21", + "pg-connection-string": "2.6.2", + "rechoir": "^0.8.0", + "resolve-from": "^5.0.0", + "tarn": "^3.0.2", + "tildify": "2.0.0" + }, + "bin": { + "knex": "bin/cli.js" + }, + "engines": { + "node": ">=16" + }, + "peerDependenciesMeta": { + "better-sqlite3": { + "optional": true + }, + "mysql": { + "optional": true + }, + "mysql2": { + "optional": true + }, + "pg": { + "optional": true + }, + "pg-native": { + "optional": true + }, + "sqlite3": { + "optional": true + }, + "tedious": { + "optional": true + } + } + }, + "node_modules/knex/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/knex/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -3371,6 +3488,11 @@ "node": ">=8" } }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -3437,6 +3559,40 @@ "tmpl": "1.0.5" } }, + "node_modules/mariadb": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/mariadb/-/mariadb-3.3.1.tgz", + "integrity": "sha512-L8bh4iuZU3J8H7Co7rQ6OY9FDLItAN1rGy8kPA7Dyxo8AiHADuuONoypKKp1pE09drs6e5LR7UW9luLZ/A4znA==", + "dependencies": { + "@types/geojson": "^7946.0.14", + "@types/node": "^20.11.17", + "denque": "^2.1.0", + "iconv-lite": "^0.6.3", + "lru-cache": "^10.2.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/mariadb/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mariadb/node_modules/lru-cache": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.3.0.tgz", + "integrity": "sha512-CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==", + "engines": { + "node": "14 || >=16.14" + } + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -3559,6 +3715,25 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/mysql": { + "version": "2.18.1", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz", + "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==", + "dependencies": { + "bignumber.js": "9.0.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mysql/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -3836,11 +4011,6 @@ "node": ">=6" } }, - "node_modules/packet-reader": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", - "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==" - }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -3897,144 +4067,18 @@ "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, - "node_modules/pg": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.6.0.tgz", - "integrity": "sha512-qNS9u61lqljTDFvmk/N66EeGq3n6Ujzj0FFyNMGQr6XuEv4tgNTXvJQTfJdcvGit5p5/DWPu+wj920hAJFI+QQ==", - "dependencies": { - "buffer-writer": "2.0.0", - "packet-reader": "1.0.0", - "pg-connection-string": "^2.5.0", - "pg-pool": "^3.3.0", - "pg-protocol": "^1.5.0", - "pg-types": "^2.1.0", - "pgpass": "1.x" - }, - "engines": { - "node": ">= 8.0.0" - }, - "peerDependencies": { - "pg-native": ">=2.0.0" - }, - "peerDependenciesMeta": { - "pg-native": { - "optional": true - } - } - }, - "node_modules/pg-cloudflare": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz", - "integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==", - "optional": true - }, "node_modules/pg-connection-string": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.2.tgz", "integrity": "sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==" }, - "node_modules/pg-int8": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", - "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/pg-minify": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/pg-minify/-/pg-minify-1.6.3.tgz", - "integrity": "sha512-NoSsPqXxbkD8RIe+peQCqiea4QzXgosdTKY8p7PsbbGsh2F8TifDj/vJxfuR8qJwNYrijdSs7uf0tAe6WOyCsQ==", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/pg-pool": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.1.tgz", - "integrity": "sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og==", - "peerDependencies": { - "pg": ">=8.0" - } - }, - "node_modules/pg-promise": { - "version": "11.5.4", - "resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-11.5.4.tgz", - "integrity": "sha512-esYSkDt2h6NQOkfotGAm1Ld5OjoITJLpB88Z1PIlcAU/RQ0XQE2PxW0bLJEOMHPGV5iaRnj1Y7ARznXbgN4FNw==", - "dependencies": { - "assert-options": "0.8.1", - "pg": "8.11.3", - "pg-minify": "1.6.3", - "spex": "3.3.0" - }, - "engines": { - "node": ">=14.0" - } - }, - "node_modules/pg-promise/node_modules/pg": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.11.3.tgz", - "integrity": "sha512-+9iuvG8QfaaUrrph+kpF24cXkH1YOOUeArRNYIxq1viYHZagBxrTno7cecY1Fa44tJeZvaoG+Djpkc3JwehN5g==", - "dependencies": { - "buffer-writer": "2.0.0", - "packet-reader": "1.0.0", - "pg-connection-string": "^2.6.2", - "pg-pool": "^3.6.1", - "pg-protocol": "^1.6.0", - "pg-types": "^2.1.0", - "pgpass": "1.x" - }, - "engines": { - "node": ">= 8.0.0" - }, - "optionalDependencies": { - "pg-cloudflare": "^1.1.1" - }, - "peerDependencies": { - "pg-native": ">=3.0.1" - }, - "peerDependenciesMeta": { - "pg-native": { - "optional": true - } - } - }, - "node_modules/pg-protocol": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.0.tgz", - "integrity": "sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==" - }, - "node_modules/pg-types": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", - "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", - "dependencies": { - "pg-int8": "1.0.1", - "postgres-array": "~2.0.0", - "postgres-bytea": "~1.0.0", - "postgres-date": "~1.0.4", - "postgres-interval": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pgpass": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", - "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", - "dependencies": { - "split2": "^4.1.0" - } - }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -4074,41 +4118,6 @@ "node": ">=8" } }, - "node_modules/postgres-array": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", - "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/postgres-bytea": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", - "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postgres-date": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", - "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postgres-interval": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", - "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", - "dependencies": { - "xtend": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/pretty-format": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", @@ -4136,6 +4145,11 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -4209,6 +4223,25 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, + "node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -4221,6 +4254,17 @@ "node": ">=8.10.0" } }, + "node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "dependencies": { + "resolve": "^1.20.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -4234,7 +4278,6 @@ "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, "dependencies": { "is-core-module": "^2.13.0", "path-parse": "^1.0.7", @@ -4263,7 +4306,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, "engines": { "node": ">=8" } @@ -4505,28 +4547,20 @@ "source-map": "^0.6.0" } }, - "node_modules/spex": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/spex/-/spex-3.3.0.tgz", - "integrity": "sha512-VNiXjFp6R4ldPbVRYbpxlD35yRHceecVXlct1J4/X80KuuPnW2AXMq3sGwhnJOhKkUsOxAT6nRGfGE5pocVw5w==", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/split2": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", - "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", - "engines": { - "node": ">= 10.x" - } - }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, + "node_modules/sqlstring": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", + "integrity": "sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -4547,6 +4581,19 @@ "node": ">= 0.8" } }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -4747,7 +4794,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -4755,6 +4801,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/tarn": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tarn/-/tarn-3.0.2.tgz", + "integrity": "sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ==", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/terminal-link": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", @@ -4785,6 +4839,14 @@ "node": ">=8" } }, + "node_modules/tildify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tildify/-/tildify-2.0.0.tgz", + "integrity": "sha512-Cc+OraorugtXNfs50hU9KS369rFXCfgGLpfCfvlc+Ud5u6VWmUQsOAa9HbTvheQdYnrdJqqv1e5oIqXppMYnSw==", + "engines": { + "node": ">=8" + } + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -4874,8 +4936,7 @@ "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/unpipe": { "version": "1.0.0", @@ -4915,6 +4976,11 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -5011,14 +5077,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "engines": { - "node": ">=0.4" - } - }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 57d8b4fb..5b902287 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,10 @@ "dotenv": "^16.3.1", "express": "^4.18.2", "faker": "^5.5.3", + "knex": "^3.1.0", + "mariadb": "^3.3.1", "morgan": "1.10.0", - "pg": "8.6.0", - "pg-promise": "^11.5.4" + "mysql": "^2.18.1" }, "devDependencies": { "jest": "^28.1.3", diff --git a/src/routers/books.js b/src/routers/books.js index 1551dd87..66148df1 100644 --- a/src/routers/books.js +++ b/src/routers/books.js @@ -3,7 +3,8 @@ const router = express.Router() const db = require("../../db"); router.get('/', async (req, res) => { - + const response = await db.query("select * FROM books", []) + res.json({response}) }) module.exports = router From 211ca99ab4b32c2ee9ac9fbe9ceb05d4268319f2 Mon Sep 17 00:00:00 2001 From: Kyle Vann Date: Fri, 28 Jun 2024 21:02:18 +0100 Subject: [PATCH 2/7] couple more requests --- src/routers/books.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/routers/books.js b/src/routers/books.js index 66148df1..fcac389e 100644 --- a/src/routers/books.js +++ b/src/routers/books.js @@ -6,5 +6,9 @@ router.get('/', async (req, res) => { const response = await db.query("select * FROM books", []) res.json({response}) }) +router.get('/:id', async (req, res) => { + const response = await db.query("select * FROM books WHERE id = ? ", [req.params.id]) + res.json({response}) +}) module.exports = router From 366924e2578775494dcb286dcc427e7883410759 Mon Sep 17 00:00:00 2001 From: Kyle Vann Date: Sun, 30 Jun 2024 13:56:45 +0100 Subject: [PATCH 3/7] first push --- sql/insert-books.sql | 190 +++++++++++++++++++------------------- src/routers/books.js | 4 +- test/fixtures/bookData.js | 6 +- 3 files changed, 100 insertions(+), 100 deletions(-) diff --git a/sql/insert-books.sql b/sql/insert-books.sql index b6712d59..b4f3419e 100644 --- a/sql/insert-books.sql +++ b/sql/insert-books.sql @@ -1,107 +1,107 @@ -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptatem eligendi cupiditate et', 'Fiction', 'Carolyn Donnelly', 'western', '2020-11-16T21:38:54.789+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('blanditiis consequatur in accusantium autem voluptatem', 'Fiction', 'Carolyn Donnelly', 'western', '2017-05-01T14:06:32.789+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eligendi consequatur et', 'Fiction', 'Carolyn Donnelly', 'western', '2016-12-24T07:16:51.420+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut dolor', 'Fiction', 'Colt Dibbert', 'fantasy', '2012-02-04T04:27:29.083+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('excepturi sed nam recusandae ut sed', 'Fiction', 'Colt Dibbert', 'fantasy', '2017-11-13T12:39:13.886+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptatem voluptas ut occaecati', 'Fiction', 'Colt Dibbert', 'fantasy', '2021-09-18T12:40:54.153+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea provident quisquam aut inventore', 'Fiction', 'Karli Kiehn', 'historical', '2016-02-09T16:22:06.082+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea et', 'Fiction', 'Kim Hand', 'thriller', '2020-01-30T11:51:58.233+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('aliquam totam est quasi', 'Fiction', 'Kim Hand', 'thriller', '2011-06-03T16:34:20.912+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facere dolor velit eaque', 'Fiction', 'Kim Hand', 'thriller', '2007-03-03T06:10:13.134+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non vel', 'Fiction', 'Hildegard Lesch', 'thriller', '2017-01-02T22:19:37.659+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('adipisci perferendis ea', 'Fiction', 'Kamron Senger', 'science fiction', '2019-12-09T11:53:10.136+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptatem eligendi cupiditate et', 'Fiction', 'Carolyn Donnelly', 'western', '2020-11-16 21:38:54', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('blanditiis consequatur in accusantium autem voluptatem', 'Fiction', 'Carolyn Donnelly', 'western', '2017-05-01 14:06:32', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eligendi consequatur et', 'Fiction', 'Carolyn Donnelly', 'western', '2016-12-24 07:16:51', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut dolor', 'Fiction', 'Colt Dibbert', 'fantasy', '2012-02-04 04:27:29', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('excepturi sed nam recusandae ut sed', 'Fiction', 'Colt Dibbert', 'fantasy', '2017-11-13 12:39:13', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptatem voluptas ut occaecati', 'Fiction', 'Colt Dibbert', 'fantasy', '2021-09-18 12:40:54', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea provident quisquam aut inventore', 'Fiction', 'Karli Kiehn', 'historical', '2016-02-09 16:22:06', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea et', 'Fiction', 'Kim Hand', 'thriller', '2020-01-30 11:51:58', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('aliquam totam est quasi', 'Fiction', 'Kim Hand', 'thriller', '2011-06-03 16:34:20', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facere dolor velit eaque', 'Fiction', 'Kim Hand', 'thriller', '2007-03-03 06:10:13', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non vel', 'Fiction', 'Hildegard Lesch', 'thriller', '2017-01-02 22:19:37', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('adipisci perferendis ea', 'Fiction', 'Kamron Senger', 'science fiction', '2019-12-09 11:53:10', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ipsa enim quis', 'Fiction', 'Adella Hackett', 'historical', -'2002-11-19T06:31:24.205+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('omnis et', 'Fiction', 'Maribel Fritsch', 'fantasy', '2013-07-14T14:18:59.458+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('labore rerum ut', 'Fiction', 'Maribel Fritsch', 'fantasy', '2019-02-19T23:45:51.633+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui tempore sed sint provident ut', 'Fiction', 'Maribel Fritsch', 'fantasy', '2016-02-27T01:12:56.194+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('optio et quia iure quia at', 'Fiction', 'Ardith Dietrich', 'horror', '2011-05-21T16:04:59.862+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('at placeat quisquam fugiat', 'Fiction', 'Chelsie Gerlach', 'dystopian', '2003-05-03T12:38:10.051+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit alias', 'Fiction', 'Chelsie Gerlach', 'dystopian', '2019-02-22T09:59:23.732+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('laudantium voluptas', 'Fiction', 'Zackery Dickinson', 'mystery', '2006-03-25T18:33:41.908+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('laborum quia soluta aut rerum sed', 'Fiction', 'Zackery Dickinson', 'mystery', '2009-12-01T14:08:06.654+00:00', 400); +'2002-11-19 06:31:24', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('omnis et', 'Fiction', 'Maribel Fritsch', 'fantasy', '2013-07-14 14:18:59', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('labore rerum ut', 'Fiction', 'Maribel Fritsch', 'fantasy', '2019-02-19 23:45:51', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui tempore sed sint provident ut', 'Fiction', 'Maribel Fritsch', 'fantasy', '2016-02-27 01:12:56', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('optio et quia iure quia at', 'Fiction', 'Ardith Dietrich', 'horror', '2011-05-21 16:04:59', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('at placeat quisquam fugiat', 'Fiction', 'Chelsie Gerlach', 'dystopian', '2003-05-03 12:38:10', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit alias', 'Fiction', 'Chelsie Gerlach', 'dystopian', '2019-02-22 09:59:23', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('laudantium voluptas', 'Fiction', 'Zackery Dickinson', 'mystery', '2006-03-25 18:33:41', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('laborum quia soluta aut rerum sed', 'Fiction', 'Zackery Dickinson', 'mystery', '2009-12-01 14:08:06', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('consectetur quibusdam placeat facilis voluptas', 'Fiction', -'Eda Lubowitz', 'science fiction', '2020-09-26T02:33:43.174+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et adipisci necessitatibus aperiam commodi', 'Fiction', 'Haven Lehner', 'science fiction', '2011-04-27T08:26:47.669+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non vel', 'Fiction', 'Haven Lehner', 'science fiction', '2012-01-31T13:38:40.465+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quisquam nihil quibusdam doloribus molestiae', 'Fiction', 'Jairo Flatley', 'fantasy', '2011-06-07T07:05:31.616+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('autem voluptas soluta molestiae quae', 'Fiction', 'Jairo Flatley', 'fantasy', '2010-05-27T05:46:04.053+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit excepturi', 'Fiction', 'Jairo Flatley', 'fantasy', '2003-08-22T12:07:46.886+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('iste praesentium rerum maxime', 'Fiction', 'Shayna Shields', 'literary fiction', '2011-03-23T16:12:05.844+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sed sapiente nisi nihil laborum', 'Fiction', 'Shayna Shields', 'literary fiction', '2021-09-03T00:44:40.909+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('rerum dolor', 'Fiction', 'Shayna Shields', 'literary fiction', '2017-08-31T13:18:14.009+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('illum est molestias velit quis iure', 'Fiction', 'Monroe Hahn', 'mystery', '2009-10-07T23:47:34.840+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea aliquid blanditiis', 'Fiction', 'Monroe Hahn', 'mystery', '2004-09-10T15:57:20.058+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('nisi quia delectus autem in', 'Fiction', 'Monroe Hahn', 'mystery', '2018-02-19T19:43:27.830+00:00', 400); +'Eda Lubowitz', 'science fiction', '2020-09-26 02:33:43', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et adipisci necessitatibus aperiam commodi', 'Fiction', 'Haven Lehner', 'science fiction', '2011-04-27 08:26:47', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non vel', 'Fiction', 'Haven Lehner', 'science fiction', '2012-01-31 13:38:40', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quisquam nihil quibusdam doloribus molestiae', 'Fiction', 'Jairo Flatley', 'fantasy', '2011-06-07 07:05:31', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('autem voluptas soluta molestiae quae', 'Fiction', 'Jairo Flatley', 'fantasy', '2010-05-27 05:46:04', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit excepturi', 'Fiction', 'Jairo Flatley', 'fantasy', '2003-08-22 12:07:46', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('iste praesentium rerum maxime', 'Fiction', 'Shayna Shields', 'literary fiction', '2011-03-23 16:12:05', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sed sapiente nisi nihil laborum', 'Fiction', 'Shayna Shields', 'literary fiction', '2021-09-03 00:44:40', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('rerum dolor', 'Fiction', 'Shayna Shields', 'literary fiction', '2017-08-31 13:18:14', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('illum est molestias velit quis iure', 'Fiction', 'Monroe Hahn', 'mystery', '2009-10-07 23:47:34', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea aliquid blanditiis', 'Fiction', 'Monroe Hahn', 'mystery', '2004-09-10 15:57:20', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('nisi quia delectus autem in', 'Fiction', 'Monroe Hahn', 'mystery', '2018-02-19 19:43:27', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('natus quia ut quas', 'Fiction', 'Jaren Schaefer', 'literary -fiction', '2002-05-08T14:54:57.508+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptas labore aliquam ut et earum', 'Fiction', 'Stefanie Bednar', 'historical', '2019-04-28T18:11:41.200+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('rerum error est qui', 'Fiction', 'Stefanie Bednar', 'historical', '2019-06-06T01:28:32.178+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et voluptatem aliquid repellendus', 'Fiction', 'Stefanie Bednar', 'historical', '2010-01-11T11:48:26.297+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('necessitatibus et minus earum', 'Fiction', 'Devon Grady', 'western', '2010-09-22T15:57:55.046+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('aut quo dolorem', 'Fiction', 'Devon Grady', 'western', '2015-07-30T19:04:58.514+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et atque recusandae rerum quae', 'Fiction', 'Sister Klocko', 'mystery', '2016-06-19T11:53:10.083+01:00', 400); +fiction', '2002-05-08 14:54:57', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptas labore aliquam ut et earum', 'Fiction', 'Stefanie Bednar', 'historical', '2019-04-28 18:11:41', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('rerum error est qui', 'Fiction', 'Stefanie Bednar', 'historical', '2019-06-06 01:28:32', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et voluptatem aliquid repellendus', 'Fiction', 'Stefanie Bednar', 'historical', '2010-01-11 11:48:26', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('necessitatibus et minus earum', 'Fiction', 'Devon Grady', 'western', '2010-09-22 15:57:55', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('aut quo dolorem', 'Fiction', 'Devon Grady', 'western', '2015-07-30 19:04:58', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et atque recusandae rerum quae', 'Fiction', 'Sister Klocko', 'mystery', '2016-06-19 11:53:10', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('est veniam similique hic soluta veniam', 'Fiction', 'Sister -Klocko', 'mystery', '2021-01-20T11:51:51.482+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non quasi sit dolores laborum', 'Fiction', 'Ola Hilll', 'mystery', '2003-03-21T22:22:49.630+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quaerat molestiae autem voluptates distinctio', 'Fiction', 'Ola Hilll', 'mystery', '2013-02-08T08:37:12.789+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('nihil autem veniam quo cupiditate suscipit', 'Fiction', 'Ola Hilll', 'mystery', '2006-07-25T20:33:43.191+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('minima et', 'Fiction', 'Johanna Hahn', 'thriller', '2006-01-17T05:44:02.267+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et repellat', 'Fiction', 'Luther Lehner', 'historical', '2020-02-12T15:35:18.982+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quos ea', 'Fiction', 'Luther Lehner', 'historical', '2005-09-28T02:59:16.221+01:00', 400); +Klocko', 'mystery', '2021-01-20 11:51:51', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non quasi sit dolores laborum', 'Fiction', 'Ola Hilll', 'mystery', '2003-03-21 22:22:49', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quaerat molestiae autem voluptates distinctio', 'Fiction', 'Ola Hilll', 'mystery', '2013-02-08 08:37:12', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('nihil autem veniam quo cupiditate suscipit', 'Fiction', 'Ola Hilll', 'mystery', '2006-07-25 20:33:43', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('minima et', 'Fiction', 'Johanna Hahn', 'thriller', '2006-01-17 05:44:02', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et repellat', 'Fiction', 'Luther Lehner', 'historical', '2020-02-12 15:35:18', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quos ea', 'Fiction', 'Luther Lehner', 'historical', '2005-09-28 02:59:16', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('excepturi suscipit perspiciatis animi deserunt', 'Fiction', -'Ardith Schaden', 'literary fiction', '2010-03-12T11:12:09.214+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('pariatur vel dolores', 'Fiction', 'Ardith Schaden', 'literary fiction', '2019-10-07T16:41:00.370+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('autem natus et nihil magnam facilis', 'Fiction', 'Ardith Schaden', 'literary fiction', '2020-09-13T01:03:23.774+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('vitae nemo laboriosam et voluptatibus', 'Fiction', 'Ahmad Pagac', 'horror', '2016-05-01T13:23:50.408+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('in modi ut totam ea', 'Fiction', 'Gwen Goyette', 'horror', '2005-06-14T14:54:50.097+01:00', 400); +'Ardith Schaden', 'literary fiction', '2010-03-12 11:12:09', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('pariatur vel dolores', 'Fiction', 'Ardith Schaden', 'literary fiction', '2019-10-07 16:41:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('autem natus et nihil magnam facilis', 'Fiction', 'Ardith Schaden', 'literary fiction', '2020-09-13 01:03:23', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('vitae nemo laboriosam et voluptatibus', 'Fiction', 'Ahmad Pagac', 'horror', '2016-05-01 13:23:50', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('in modi ut totam ea', 'Fiction', 'Gwen Goyette', 'horror', '2005-06-14 14:54:50', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae quia porro', 'Fiction', 'Gwen Goyette', 'horror', -'2005-01-13T22:58:00.899+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et soluta aut', 'Fiction', 'Gwen Goyette', 'horror', '2013-10-26T06:36:26.645+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('hic impedit aspernatur', 'Fiction', 'Mohammed Fritsch', 'dystopian', '2008-07-24T04:24:04.037+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('assumenda consequatur', 'Fiction', 'Claudia Quitzon', 'horror', '2019-01-29T04:51:53.005+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('atque nostrum eos ipsa aut provident', 'Fiction', 'Claudia Quitzon', 'horror', '2017-08-09T10:31:52.709+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('totam ex adipisci nesciunt itaque', 'Fiction', 'Claudia Quitzon', 'horror', '2016-09-08T23:48:13.245+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('officiis voluptatum consequatur', 'Non-Fiction', 'Katelin Koch', 'humour', '2020-05-30T06:46:51.314+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('consectetur consequatur', 'Non-Fiction', 'Katelin Koch', 'humour', '2014-12-30T06:56:28.717+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('at omnis aut commodi vel neque', 'Non-Fiction', 'Archibald Mertz', 'business', '2004-03-31T02:14:37.980+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('culpa hic dolore consequatur', 'Non-Fiction', 'Archibald Mertz', 'business', '2012-08-14T18:40:20.333+01:00', 400); +'2005-01-13 22:58:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et soluta aut', 'Fiction', 'Gwen Goyette', 'horror', '2013-10-26 06:36:26', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('hic impedit aspernatur', 'Fiction', 'Mohammed Fritsch', 'dystopian', '2008-07-24 04:24:04', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('assumenda consequatur', 'Fiction', 'Claudia Quitzon', 'horror', '2019-01-29 04:51:53', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('atque nostrum eos ipsa aut provident', 'Fiction', 'Claudia Quitzon', 'horror', '2017-08-09 10:31:52', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('totam ex adipisci nesciunt itaque', 'Fiction', 'Claudia Quitzon', 'horror', '2016-09-08 23:48:13', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('officiis voluptatum consequatur', 'Non-Fiction', 'Katelin Koch', 'humour', '2020-05-30 06:46:51', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('consectetur consequatur', 'Non-Fiction', 'Katelin Koch', 'humour', '2014-12-30 06:56:28', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('at omnis aut commodi vel neque', 'Non-Fiction', 'Archibald Mertz', 'business', '2004-03-31 02:14:37', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('culpa hic dolore consequatur', 'Non-Fiction', 'Archibald Mertz', 'business', '2012-08-14 18:40:20', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eaque id eligendi expedita', 'Non-Fiction', 'Gino Flatley', -'history', '2017-08-28T04:44:22.075+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eveniet aut omnis quasi vitae voluptas', 'Non-Fiction', 'Gino Flatley', 'history', '2013-05-06T02:18:11.750+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui quam adipisci alias atque', 'Non-Fiction', 'Gino Flatley', 'history', '2008-04-09T13:51:36.809+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae in', 'Non-Fiction', 'Heber Williamson', 'travel guide', '2017-02-07T18:37:25.992+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('corrupti tenetur', 'Non-Fiction', 'Heber Williamson', 'travel guide', '2019-07-14T17:06:36.761+01:00', 400); +'history', '2017-08-28 04:44:22', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eveniet aut omnis quasi vitae voluptas', 'Non-Fiction', 'Gino Flatley', 'history', '2013-05-06 02:18:11', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui quam adipisci alias atque', 'Non-Fiction', 'Gino Flatley', 'history', '2008-04-09 13:51:36', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae in', 'Non-Fiction', 'Heber Williamson', 'travel guide', '2017-02-07 18:37:25', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('corrupti tenetur', 'Non-Fiction', 'Heber Williamson', 'travel guide', '2019-07-14 17:06:36', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut quisquam officia qui nemo sunt', 'Non-Fiction', 'Yesenia -Nicolas', 'business', '2015-12-20T00:58:31.725+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('natus laboriosam', 'Non-Fiction', 'Gilberto Walter', 'history', '2017-01-02T14:19:33.875+00:00', 400); +Nicolas', 'business', '2015-12-20 00:58:31', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('natus laboriosam', 'Non-Fiction', 'Gilberto Walter', 'history', '2017-01-02 14:19:33', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('corporis quos repellendus sapiente eveniet', 'Non-Fiction', -'Gilberto Walter', 'history', '2013-10-11T14:35:26.738+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facilis ut', 'Non-Fiction', 'Alexandro Schuster', 'travel guide', '2012-01-11T02:32:36.994+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('harum hic', 'Non-Fiction', 'Libbie Bradtke', 'humour', '2007-04-10T20:39:16.323+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae quaerat', 'Non-Fiction', 'Libbie Bradtke', 'humour', '2018-10-07T03:18:51.903+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facere repellendus', 'Non-Fiction', 'Dewitt Hauck', 'history', '2016-05-14T13:30:58.198+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('est quia neque molestias', 'Non-Fiction', 'Nick Russel', 'history', '2019-07-07T09:52:06.577+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolorum inventore est veniam id', 'Non-Fiction', 'Nick Russel', 'history', '2006-01-06T17:38:24.318+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae rerum in voluptas commodi', 'Non-Fiction', 'Isabelle Auer', 'philosophy', '2009-02-01T00:39:20.149+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('id fugit quia est ipsa quibusdam', 'Non-Fiction', 'Holly Greenholt', 'history', '2008-12-09T23:30:23.552+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('minima voluptatem quis ut quidem perferendis', 'Non-Fiction', 'Elwyn Stanton', 'business', '2006-06-03T21:05:25.445+01:00', 400); +'Gilberto Walter', 'history', '2013-10-11 14:35:26', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facilis ut', 'Non-Fiction', 'Alexandro Schuster', 'travel guide', '2012-01-11 02:32:36', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('harum hic', 'Non-Fiction', 'Libbie Bradtke', 'humour', '2007-04-10 20:39:16', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae quaerat', 'Non-Fiction', 'Libbie Bradtke', 'humour', '2018-10-07 03:18:51', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facere repellendus', 'Non-Fiction', 'Dewitt Hauck', 'history', '2016-05-14 13:30:58', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('est quia neque molestias', 'Non-Fiction', 'Nick Russel', 'history', '2019-07-07 09:52:06', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolorum inventore est veniam id', 'Non-Fiction', 'Nick Russel', 'history', '2006-01-06 17:38:24', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae rerum in voluptas commodi', 'Non-Fiction', 'Isabelle Auer', 'philosophy', '2009-02-01 00:39:20', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('id fugit quia est ipsa quibusdam', 'Non-Fiction', 'Holly Greenholt', 'history', '2008-12-09 23:30:23', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('minima voluptatem quis ut quidem perferendis', 'Non-Fiction', 'Elwyn Stanton', 'business', '2006-06-03 21:05:25', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('incidunt ex rerum pariatur temporibus amet', 'Non-Fiction', -'Elwyn Stanton', 'business', '2016-03-07T15:29:17.406+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolorum et nostrum natus', 'Non-Fiction', 'Elwyn Stanton', 'business', '2021-06-29T17:30:00.115+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eaque est cupiditate ad nemo', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2021-06-11T10:43:17.356+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et voluptate laboriosam', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2011-01-18T04:34:41.382+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ducimus porro quae aut aspernatur', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2019-02-01T14:45:32.868+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui quisquam', 'Non-Fiction', 'Timothy Jast', 'biography', '2011-09-08T06:02:45.369+01:00', 400); +'Elwyn Stanton', 'business', '2016-03-07 15:29:17', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolorum et nostrum natus', 'Non-Fiction', 'Elwyn Stanton', 'business', '2021-06-29 17:30:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eaque est cupiditate ad nemo', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2021-06-11 10:43:17', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et voluptate laboriosam', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2011-01-18 04:34:41', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ducimus porro quae aut aspernatur', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2019-02-01 14:45:32', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui quisquam', 'Non-Fiction', 'Timothy Jast', 'biography', '2011-09-08 06:02:45', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('neque sunt nobis assumenda', 'Non-Fiction', 'Timothy Jast', -'biography', '2019-09-20T04:03:48.308+01:00', 400); +'biography', '2019-09-20 04:03:48', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit suscipit qui repudiandae quia', 'Non-Fiction', 'Samantha -Beahan', 'philosophy', '2016-12-12T01:38:27.401+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sapiente alias impedit', 'Non-Fiction', 'Samantha Beahan', 'philosophy', '2014-07-15T18:15:14.711+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('odio recusandae', 'Non-Fiction', 'Wilma Jast', 'biography', '2017-12-30T11:44:38.638+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('iste aut nemo', 'Non-Fiction', 'Everette Cormier', 'self-help', '2019-10-23T21:48:24.119+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut eveniet non', 'Non-Fiction', 'Everette Cormier', 'self-help', '2021-05-10T19:55:28.240+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('placeat eius consectetur architecto', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2018-02-20T07:56:03.841+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quia cumque maiores illum', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2021-04-24T05:10:20.766+01:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ratione laudantium voluptas nihil voluptatem', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2014-02-26T03:05:12.242+00:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolore qui accusamus sed', 'Non-Fiction', 'Arianna Dietrich', 'biography', '2004-06-23T09:29:19.212+01:00', 400); +Beahan', 'philosophy', '2016-12-12 01:38:27', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sapiente alias impedit', 'Non-Fiction', 'Samantha Beahan', 'philosophy', '2014-07-15 18:15:14', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('odio recusandae', 'Non-Fiction', 'Wilma Jast', 'biography', '2017-12-30 11:44:38', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('iste aut nemo', 'Non-Fiction', 'Everette Cormier', 'self-help', '2019-10-23 21:48:24', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut eveniet non', 'Non-Fiction', 'Everette Cormier', 'self-help', '2021-05-10 19:55:28', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('placeat eius consectetur architecto', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2018-02-20 07:56:03', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quia cumque maiores illum', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2021-04-24 05:10:20', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ratione laudantium voluptas nihil voluptatem', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2014-02-26 03:05:12', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolore qui accusamus sed', 'Non-Fiction', 'Arianna Dietrich', 'biography', '2004-06-23 09:29:19', 400); \ No newline at end of file diff --git a/src/routers/books.js b/src/routers/books.js index fcac389e..a236be72 100644 --- a/src/routers/books.js +++ b/src/routers/books.js @@ -4,11 +4,11 @@ const db = require("../../db"); router.get('/', async (req, res) => { const response = await db.query("select * FROM books", []) - res.json({response}) + res.json({books: response}) }) router.get('/:id', async (req, res) => { const response = await db.query("select * FROM books WHERE id = ? ", [req.params.id]) - res.json({response}) + res.json({books: response}) }) module.exports = router diff --git a/test/fixtures/bookData.js b/test/fixtures/bookData.js index f337b765..09b346b6 100644 --- a/test/fixtures/bookData.js +++ b/test/fixtures/bookData.js @@ -4,7 +4,7 @@ module.exports = { type: "test1", author: "test1", topic: "test1", - publication_date: "2020-11-16T00:00:00.000Z", + publication_date: "2020-11-16 00:00:00", pages: 1 }, book2: { @@ -12,7 +12,7 @@ module.exports = { type: "test2", author: "test2", topic: "test2", - publication_date: "2020-11-17T00:00:00.000Z", + publication_date: "2020-11-17 00:00:00", pages: 2 }, book3: { @@ -20,7 +20,7 @@ module.exports = { type: "test3", author: "test3", topic: "test3", - publication_date: "2020-11-18T00:00:00.000Z", + publication_date: "2020-11-18 00:00:00", pages: 3 } } From 7a3d69d0e633f06566d814cf3fbcc1fff81249c5 Mon Sep 17 00:00:00 2001 From: Kyle Vann Date: Sun, 30 Jun 2024 14:41:48 +0100 Subject: [PATCH 4/7] need to gwet tests passing --- src/routers/books.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/routers/books.js b/src/routers/books.js index a236be72..71184131 100644 --- a/src/routers/books.js +++ b/src/routers/books.js @@ -10,5 +10,35 @@ router.get('/:id', async (req, res) => { const response = await db.query("select * FROM books WHERE id = ? ", [req.params.id]) res.json({books: response}) }) +router.put('/:id', async (req, res) => { + console.log("BumbaClap", req.body) + const update = await db.query( + `UPDATE books + SET title = ?, + type = ?, + author = ?, + topic = ?, + publication_date = ?, + pages = ? + WHERE id = ?; +`, [req.body.title, req.body.type, req.body.author, req.body.topic, req.body.publication_date, req.body.pages, req.params.id ]) + const response = await db.query("select * FROM books WHERE id = ? ", [req.params.id]) + res.json({books: response}) +}) +router.delete('/:id', async (req, res) => { + const response = await db.query("select * FROM books WHERE id = ? ", [req.params.id]) + await db.query("DELETE FROM books WHERE id = ?", [req.params.id]) + res.json({books: response}) +}) +router.post('/', async (req, res) => { + console.log("BumbaClap", req.body) + const update = await db.query( + `INSERT INTO books (title, type, author, topic, publication_date, pages) +VALUES (?, ?, ?, ?, ?, ?); +`, [req.body.title, req.body.type, req.body.author, req.body.topic, req.body.publication_date, req.body.pages]) + console.log("test", update.insertId) +const response = await db.query("select * FROM books WHERE id = ? ", [update.insertId]) + res.json({books: response}) +}) module.exports = router From 93383038d14c6b7315be9c3703637c460e600776 Mon Sep 17 00:00:00 2001 From: Kyle Vann Date: Thu, 4 Jul 2024 19:59:20 +0100 Subject: [PATCH 5/7] erroring currently --- db/index.js | 2 +- src/routers/pets.js | 43 +++++++++++++++++++++++++++++++++++++++++++ src/server.js | 2 ++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/routers/pets.js diff --git a/db/index.js b/db/index.js index 66e6fd6d..1ca146af 100644 --- a/db/index.js +++ b/db/index.js @@ -7,7 +7,7 @@ const knex = require("knex")({ connection: { host: 'nassydev.synology.me', user: 'kyle', - password: 'Kyleisnowanerd1!', + password: process.env.DB_PASSWORD, database:'api-express-database', timezone: 'utc', }, diff --git a/src/routers/pets.js b/src/routers/pets.js new file mode 100644 index 00000000..0ef4b571 --- /dev/null +++ b/src/routers/pets.js @@ -0,0 +1,43 @@ +const express = require('express') +const router = express.Router() +const db = require("../../db"); + +router.get('/', async (req, res) => { + const response = await db.query("select * FROM pets", []) + res.json({pets: response}) +}) +router.get('/:id', async (req, res) => { + const response = await db.query("select * FROM pets WHERE id = ? ", [req.params.id]) + res.json({pets: response}) +}) +router.put('/:id', async (req, res) => { + console.log("BumbaClap", req.body) + const update = await db.query( + `UPDATE pets + SET name = ?, + age = ?, + type = ?, + breed = ?, + has_microchip = ? + WHERE id = ?; +`, [req.body.name, req.body.age, req.body.type, req.body.breed, req.body.has_microchip, req.params.id ]) + const response = await db.query("select * FROM pets WHERE id = ? ", [req.params.id]) + res.json({pets: response}) +}) +router.delete('/:id', async (req, res) => { + const response = await db.query("select * FROM pets WHERE id = ? ", [req.params.id]) + await db.query("DELETE FROM pets WHERE id = ?", [req.params.id]) + res.json({pets: response}) +}) +router.post('/', async (req, res) => { + console.log("BumbaClap", req.body) + const update = await db.query( + `INSERT INTO pets (name, age, type, breed, has_microchip) +VALUES (?, ?, ?, ?, ?); +`, [req.body.name, req.body.age, req.body.type, req.body.breed, req.body.has_microchip]) + console.log("test", update.insertId) +const response = await db.query("select * FROM pets WHERE id = ? ", [update.insertId]) + res.json({books: response}) +}) + +module.exports = router diff --git a/src/server.js b/src/server.js index dac55e5d..233ceb88 100644 --- a/src/server.js +++ b/src/server.js @@ -10,7 +10,9 @@ app.use(express.json()); //TODO: Implement books and pets APIs using Express Modular Routers const booksRouter = require('./routers/books.js') +const petsRouter = require('./routers/pets.js') app.use('/books', booksRouter) +app.use('/pets', petsRouter) module.exports = app From b9dc54a1f51c748e60ded4330c72a0e170b0b216 Mon Sep 17 00:00:00 2001 From: Kyle Vann Date: Thu, 4 Jul 2024 20:39:43 +0100 Subject: [PATCH 6/7] mariaDB issues --- sql/create-books.sql | 2 -- sql/create-pets.sql | 2 -- src/routers/books.js | 2 +- src/routers/pets.js | 14 +++++++++----- test/helpers/createPet.js | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sql/create-books.sql b/sql/create-books.sql index 322f3c97..8c48c78e 100644 --- a/sql/create-books.sql +++ b/sql/create-books.sql @@ -1,5 +1,3 @@ -DROP TABLE IF EXISTS books; - CREATE TABLE IF NOT EXISTS books ( id SERIAL PRIMARY KEY, title VARCHAR(255) NOT NULL, diff --git a/sql/create-pets.sql b/sql/create-pets.sql index 34398326..e3093abd 100644 --- a/sql/create-pets.sql +++ b/sql/create-pets.sql @@ -1,5 +1,3 @@ -DROP TABLE IF EXISTS pets; - CREATE TABLE IF NOT EXISTS pets ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, diff --git a/src/routers/books.js b/src/routers/books.js index 71184131..b6043246 100644 --- a/src/routers/books.js +++ b/src/routers/books.js @@ -38,7 +38,7 @@ VALUES (?, ?, ?, ?, ?, ?); `, [req.body.title, req.body.type, req.body.author, req.body.topic, req.body.publication_date, req.body.pages]) console.log("test", update.insertId) const response = await db.query("select * FROM books WHERE id = ? ", [update.insertId]) - res.json({books: response}) + res.status(201).json({books: response}) }) module.exports = router diff --git a/src/routers/pets.js b/src/routers/pets.js index 0ef4b571..0df1133c 100644 --- a/src/routers/pets.js +++ b/src/routers/pets.js @@ -4,11 +4,11 @@ const db = require("../../db"); router.get('/', async (req, res) => { const response = await db.query("select * FROM pets", []) - res.json({pets: response}) + res.json({pets: response.map(parsePet)}) }) router.get('/:id', async (req, res) => { const response = await db.query("select * FROM pets WHERE id = ? ", [req.params.id]) - res.json({pets: response}) + res.json({pet: parsePet(response[0])}) }) router.put('/:id', async (req, res) => { console.log("BumbaClap", req.body) @@ -22,12 +22,12 @@ router.put('/:id', async (req, res) => { WHERE id = ?; `, [req.body.name, req.body.age, req.body.type, req.body.breed, req.body.has_microchip, req.params.id ]) const response = await db.query("select * FROM pets WHERE id = ? ", [req.params.id]) - res.json({pets: response}) + res.json({pet: parsePet(response[0])}) }) router.delete('/:id', async (req, res) => { const response = await db.query("select * FROM pets WHERE id = ? ", [req.params.id]) await db.query("DELETE FROM pets WHERE id = ?", [req.params.id]) - res.json({pets: response}) + res.json({pet: parsePet(response[0])}) }) router.post('/', async (req, res) => { console.log("BumbaClap", req.body) @@ -37,7 +37,11 @@ VALUES (?, ?, ?, ?, ?); `, [req.body.name, req.body.age, req.body.type, req.body.breed, req.body.has_microchip]) console.log("test", update.insertId) const response = await db.query("select * FROM pets WHERE id = ? ", [update.insertId]) - res.json({books: response}) + res.status(201).json({pet: parsePet(response[0])}) }) +function parsePet(data) { + return {...data, has_microchip: !!data.has_microchip} +} + module.exports = router diff --git a/test/helpers/createPet.js b/test/helpers/createPet.js index 8dfca845..833890d1 100644 --- a/test/helpers/createPet.js +++ b/test/helpers/createPet.js @@ -1,7 +1,7 @@ const client = require("../../db"); const createPet = async (values) => { - const sqlString = `INSERT INTO "pets" (name, age, type, breed, has_microchip) VALUES ($1, $2, $3, $4, $5) RETURNING *;` + const sqlString = `INSERT INTO "pets" (name, age, type, breed, has_microchip) VALUES (?, ?, ?, ?, ?);` const result = await client.query(sqlString, values) From ae6ce0ded4826ad5a8a39037cb554d590e8db4d0 Mon Sep 17 00:00:00 2001 From: Kyle Vann Date: Sun, 7 Jul 2024 20:10:28 +0100 Subject: [PATCH 7/7] solved database issues --- db/index.js | 26 +- package-lock.json | 524 ++++++++++++++++------------------- package.json | 7 +- sql/create-books.sql | 4 +- sql/create-pets.sql | 4 +- sql/insert-books.sql | 190 ++++++------- sql/insert-pets.sql | 2 +- src/routers/books.js | 68 +++-- src/routers/pets.js | 44 +-- test/api/routes/pets.spec.js | 3 +- test/helpers/createBook.js | 2 +- test/helpers/createPet.js | 6 +- test/helpers/insertBooks.js | 2 +- test/helpers/insertPets.js | 2 +- 14 files changed, 436 insertions(+), 448 deletions(-) diff --git a/db/index.js b/db/index.js index 1ca146af..5461e742 100644 --- a/db/index.js +++ b/db/index.js @@ -2,36 +2,24 @@ require('dotenv').config() // Require Client obj from the postgres node module -const knex = require("knex")({ - client: "mysql", - connection: { - host: 'nassydev.synology.me', - user: 'kyle', - password: process.env.DB_PASSWORD, - database:'api-express-database', - timezone: 'utc', - }, - debug: false, -}); +const { Client } = require("pg"); const client = { query: async (str, values) => { // Get the connection string from process.env - // the dotenv library sets this variable based - // on the contents of our env file - // Create a new connection to the database using the Client - // object provided by the postgres node module - + const dbClient = new Client(process.env.PGURL) // connect a connection - + await dbClient.connect() // execute the query - const result = await knex.raw(str, values) + const result = await dbClient.query(str, values) // close the connection - return result[0] + await dbClient.end() + return result } } -module.exports = client; +module.exports = client; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7c8367fc..a9b52c26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,13 +10,14 @@ "dependencies": { "body-parser": "^1.20.2", "cors": "^2.8.5", + "date-fns": "^3.6.0", + "date-fns-tz": "^3.1.3", "dotenv": "^16.3.1", "express": "^4.18.2", "faker": "^5.5.3", - "knex": "^3.1.0", - "mariadb": "^3.3.1", "morgan": "1.10.0", - "mysql": "^2.18.1" + "pg": "8.6.0", + "pg-promise": "^11.5.4" }, "devDependencies": { "jest": "^28.1.3", @@ -1113,11 +1114,6 @@ "@babel/types": "^7.20.7" } }, - "node_modules/@types/geojson": { - "version": "7946.0.14", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", - "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==" - }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -1155,6 +1151,7 @@ "version": "20.14.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "dev": true, "dependencies": { "undici-types": "~5.26.4" } @@ -1276,6 +1273,14 @@ "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", "dev": true }, + "node_modules/assert-options": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/assert-options/-/assert-options-0.8.1.tgz", + "integrity": "sha512-5lNGRB5g5i2bGIzb+J1QQE1iKU/WEMVBReFIc5pPDWjcPj23otPL0eI6PB2v7QPi0qU6Mhym5D3y0ZiSIOf3GA==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1395,14 +1400,6 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, - "node_modules/bignumber.js": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", - "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==", - "engines": { - "node": "*" - } - }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -1504,6 +1501,14 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "node_modules/buffer-writer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", + "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==", + "engines": { + "node": ">=4" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -1684,11 +1689,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/colorette": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", - "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==" - }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -1701,14 +1701,6 @@ "node": ">= 0.8" } }, - "node_modules/commander": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", - "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", - "engines": { - "node": ">=14" - } - }, "node_modules/component-emitter": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz", @@ -1768,11 +1760,6 @@ "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", "dev": true }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" - }, "node_modules/cors": { "version": "2.8.5", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", @@ -1799,6 +1786,23 @@ "node": ">= 8" } }, + "node_modules/date-fns": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", + "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, + "node_modules/date-fns-tz": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-3.1.3.tgz", + "integrity": "sha512-ZfbMu+nbzW0mEzC8VZrLiSWvUIaI3aRHeq33mTe7Y38UctKukgqPR4nTDwcwS4d64Gf8GghnVsroBuMY3eiTeA==", + "peerDependencies": { + "date-fns": "^3.0.0" + } + }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -1844,14 +1848,6 @@ "node": ">=0.4.0" } }, - "node_modules/denque": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", - "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", - "engines": { - "node": ">=0.10" - } - }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -1958,6 +1954,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, "engines": { "node": ">=6" } @@ -1976,14 +1973,6 @@ "node": ">=8" } }, - "node_modules/esm": { - "version": "3.2.25", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", - "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", - "engines": { - "node": ">=6" - } - }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2308,6 +2297,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, "engines": { "node": ">=8.0.0" } @@ -2324,11 +2314,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/getopts": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/getopts/-/getopts-2.3.0.tgz", - "integrity": "sha512-5eDf9fuSXwxBL6q5HX+dhDj+dslFGWzU5thZ9kNKUkcPtaPdatmUFKwHFrLb/uf/WpA4BHET+AX3Scl56cAjpA==" - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -2539,14 +2524,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "node_modules/interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -2577,6 +2554,7 @@ "version": "2.13.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, "dependencies": { "hasown": "^2.0.0" }, @@ -2644,11 +2622,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -3390,77 +3363,6 @@ "node": ">=6" } }, - "node_modules/knex": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/knex/-/knex-3.1.0.tgz", - "integrity": "sha512-GLoII6hR0c4ti243gMs5/1Rb3B+AjwMOfjYm97pu0FOQa7JH56hgBxYf5WK2525ceSbBY1cjeZ9yk99GPMB6Kw==", - "dependencies": { - "colorette": "2.0.19", - "commander": "^10.0.0", - "debug": "4.3.4", - "escalade": "^3.1.1", - "esm": "^3.2.25", - "get-package-type": "^0.1.0", - "getopts": "2.3.0", - "interpret": "^2.2.0", - "lodash": "^4.17.21", - "pg-connection-string": "2.6.2", - "rechoir": "^0.8.0", - "resolve-from": "^5.0.0", - "tarn": "^3.0.2", - "tildify": "2.0.0" - }, - "bin": { - "knex": "bin/cli.js" - }, - "engines": { - "node": ">=16" - }, - "peerDependenciesMeta": { - "better-sqlite3": { - "optional": true - }, - "mysql": { - "optional": true - }, - "mysql2": { - "optional": true - }, - "pg": { - "optional": true - }, - "pg-native": { - "optional": true - }, - "sqlite3": { - "optional": true - }, - "tedious": { - "optional": true - } - } - }, - "node_modules/knex/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/knex/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -3488,11 +3390,6 @@ "node": ">=8" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -3559,40 +3456,6 @@ "tmpl": "1.0.5" } }, - "node_modules/mariadb": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/mariadb/-/mariadb-3.3.1.tgz", - "integrity": "sha512-L8bh4iuZU3J8H7Co7rQ6OY9FDLItAN1rGy8kPA7Dyxo8AiHADuuONoypKKp1pE09drs6e5LR7UW9luLZ/A4znA==", - "dependencies": { - "@types/geojson": "^7946.0.14", - "@types/node": "^20.11.17", - "denque": "^2.1.0", - "iconv-lite": "^0.6.3", - "lru-cache": "^10.2.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/mariadb/node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/mariadb/node_modules/lru-cache": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.3.0.tgz", - "integrity": "sha512-CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==", - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -3715,25 +3578,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, - "node_modules/mysql": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz", - "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==", - "dependencies": { - "bignumber.js": "9.0.0", - "readable-stream": "2.3.7", - "safe-buffer": "5.1.2", - "sqlstring": "2.3.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mysql/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -4011,6 +3855,11 @@ "node": ">=6" } }, + "node_modules/packet-reader": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", + "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==" + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -4067,17 +3916,146 @@ "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, - "node_modules/pg-connection-string": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.2.tgz", - "integrity": "sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==" + "node_modules/pg": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.6.0.tgz", + "integrity": "sha512-qNS9u61lqljTDFvmk/N66EeGq3n6Ujzj0FFyNMGQr6XuEv4tgNTXvJQTfJdcvGit5p5/DWPu+wj920hAJFI+QQ==", + "dependencies": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.3.0", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "pg-native": ">=2.0.0" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-cloudflare": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz", + "integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==", + "optional": true + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-minify": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/pg-minify/-/pg-minify-1.6.4.tgz", + "integrity": "sha512-cf6hBt1YqzqPX0OznXKSv4U7e4o7eUU4zp2zQsbJ+4OCNNr7EnnAVWkIz4k0dv6UN4ouS1ZL4WlXxCrZHHl69g==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.2.tgz", + "integrity": "sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg==", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-promise": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-11.8.0.tgz", + "integrity": "sha512-w9hTFpkM4FByJTJ7KCWLtZSOtQa2BKC+XIV8+3ZvDlfYfBYdz8V4V+BttnqhUPY/d12Itug7Bft4XdILihsY+w==", + "dependencies": { + "assert-options": "0.8.1", + "pg": "8.11.5", + "pg-minify": "1.6.4", + "spex": "3.3.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/pg-promise/node_modules/pg": { + "version": "8.11.5", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.11.5.tgz", + "integrity": "sha512-jqgNHSKL5cbDjFlHyYsCXmQDrfIX/3RsNwYqpd4N0Kt8niLuNoRNH+aazv6cOd43gPh9Y4DjQCtb+X0MH0Hvnw==", + "dependencies": { + "pg-connection-string": "^2.6.4", + "pg-pool": "^3.6.2", + "pg-protocol": "^1.6.1", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "optionalDependencies": { + "pg-cloudflare": "^1.1.1" + }, + "peerDependencies": { + "pg-native": ">=3.0.1" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-promise/node_modules/pg-connection-string": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.4.tgz", + "integrity": "sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA==" + }, + "node_modules/pg-protocol": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.1.tgz", + "integrity": "sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg==" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pg/node_modules/pg-connection-string": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.4.tgz", + "integrity": "sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA==" + }, + "node_modules/pgpass": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "dependencies": { + "split2": "^4.1.0" + } }, "node_modules/picocolors": { "version": "1.0.0", @@ -4118,6 +4096,41 @@ "node": ">=8" } }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", + "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/pretty-format": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", @@ -4145,11 +4158,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -4223,25 +4231,6 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, - "node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/readable-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -4254,17 +4243,6 @@ "node": ">=8.10.0" } }, - "node_modules/rechoir": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", - "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", - "dependencies": { - "resolve": "^1.20.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -4278,6 +4256,7 @@ "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, "dependencies": { "is-core-module": "^2.13.0", "path-parse": "^1.0.7", @@ -4306,6 +4285,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, "engines": { "node": ">=8" } @@ -4547,20 +4527,28 @@ "source-map": "^0.6.0" } }, + "node_modules/spex": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/spex/-/spex-3.3.0.tgz", + "integrity": "sha512-VNiXjFp6R4ldPbVRYbpxlD35yRHceecVXlct1J4/X80KuuPnW2AXMq3sGwhnJOhKkUsOxAT6nRGfGE5pocVw5w==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "engines": { + "node": ">= 10.x" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, - "node_modules/sqlstring": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", - "integrity": "sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -4581,19 +4569,6 @@ "node": ">= 0.8" } }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -4794,6 +4769,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -4801,14 +4777,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tarn": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/tarn/-/tarn-3.0.2.tgz", - "integrity": "sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ==", - "engines": { - "node": ">=8.0.0" - } - }, "node_modules/terminal-link": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", @@ -4839,14 +4807,6 @@ "node": ">=8" } }, - "node_modules/tildify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tildify/-/tildify-2.0.0.tgz", - "integrity": "sha512-Cc+OraorugtXNfs50hU9KS369rFXCfgGLpfCfvlc+Ud5u6VWmUQsOAa9HbTvheQdYnrdJqqv1e5oIqXppMYnSw==", - "engines": { - "node": ">=8" - } - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -4936,7 +4896,8 @@ "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true }, "node_modules/unpipe": { "version": "1.0.0", @@ -4976,11 +4937,6 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -5077,6 +5033,14 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 5b902287..8dbe3d2e 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,14 @@ "dependencies": { "body-parser": "^1.20.2", "cors": "^2.8.5", + "date-fns": "^3.6.0", + "date-fns-tz": "^3.1.3", "dotenv": "^16.3.1", "express": "^4.18.2", "faker": "^5.5.3", - "knex": "^3.1.0", - "mariadb": "^3.3.1", "morgan": "1.10.0", - "mysql": "^2.18.1" + "pg": "8.6.0", + "pg-promise": "^11.5.4" }, "devDependencies": { "jest": "^28.1.3", diff --git a/sql/create-books.sql b/sql/create-books.sql index 8c48c78e..68b41169 100644 --- a/sql/create-books.sql +++ b/sql/create-books.sql @@ -1,3 +1,5 @@ +DROP TABLE IF EXISTS books; + CREATE TABLE IF NOT EXISTS books ( id SERIAL PRIMARY KEY, title VARCHAR(255) NOT NULL, @@ -6,4 +8,4 @@ CREATE TABLE IF NOT EXISTS books ( topic VARCHAR(255) NOT NULL, publication_date DATE NOT NULL, pages INTEGER NOT NULL -); +); \ No newline at end of file diff --git a/sql/create-pets.sql b/sql/create-pets.sql index e3093abd..2c791be0 100644 --- a/sql/create-pets.sql +++ b/sql/create-pets.sql @@ -1,3 +1,5 @@ +DROP TABLE IF EXISTS pets; + CREATE TABLE IF NOT EXISTS pets ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, @@ -5,4 +7,4 @@ CREATE TABLE IF NOT EXISTS pets ( type VARCHAR(255) NOT NULL, breed VARCHAR(255) NOT NULL, has_microchip BOOLEAN NOT NULL -); +); \ No newline at end of file diff --git a/sql/insert-books.sql b/sql/insert-books.sql index b4f3419e..056bf04c 100644 --- a/sql/insert-books.sql +++ b/sql/insert-books.sql @@ -1,107 +1,107 @@ -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptatem eligendi cupiditate et', 'Fiction', 'Carolyn Donnelly', 'western', '2020-11-16 21:38:54', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('blanditiis consequatur in accusantium autem voluptatem', 'Fiction', 'Carolyn Donnelly', 'western', '2017-05-01 14:06:32', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eligendi consequatur et', 'Fiction', 'Carolyn Donnelly', 'western', '2016-12-24 07:16:51', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut dolor', 'Fiction', 'Colt Dibbert', 'fantasy', '2012-02-04 04:27:29', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('excepturi sed nam recusandae ut sed', 'Fiction', 'Colt Dibbert', 'fantasy', '2017-11-13 12:39:13', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptatem voluptas ut occaecati', 'Fiction', 'Colt Dibbert', 'fantasy', '2021-09-18 12:40:54', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea provident quisquam aut inventore', 'Fiction', 'Karli Kiehn', 'historical', '2016-02-09 16:22:06', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea et', 'Fiction', 'Kim Hand', 'thriller', '2020-01-30 11:51:58', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('aliquam totam est quasi', 'Fiction', 'Kim Hand', 'thriller', '2011-06-03 16:34:20', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facere dolor velit eaque', 'Fiction', 'Kim Hand', 'thriller', '2007-03-03 06:10:13', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non vel', 'Fiction', 'Hildegard Lesch', 'thriller', '2017-01-02 22:19:37', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('adipisci perferendis ea', 'Fiction', 'Kamron Senger', 'science fiction', '2019-12-09 11:53:10', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptatem eligendi cupiditate et', 'Fiction', 'Carolyn Donnelly', 'western', '2020-11-16T21:38:54.789+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('blanditiis consequatur in accusantium autem voluptatem', 'Fiction', 'Carolyn Donnelly', 'western', '2017-05-01T14:06:32.789+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eligendi consequatur et', 'Fiction', 'Carolyn Donnelly', 'western', '2016-12-24T07:16:51.420+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut dolor', 'Fiction', 'Colt Dibbert', 'fantasy', '2012-02-04T04:27:29.083+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('excepturi sed nam recusandae ut sed', 'Fiction', 'Colt Dibbert', 'fantasy', '2017-11-13T12:39:13.886+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptatem voluptas ut occaecati', 'Fiction', 'Colt Dibbert', 'fantasy', '2021-09-18T12:40:54.153+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea provident quisquam aut inventore', 'Fiction', 'Karli Kiehn', 'historical', '2016-02-09T16:22:06.082+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea et', 'Fiction', 'Kim Hand', 'thriller', '2020-01-30T11:51:58.233+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('aliquam totam est quasi', 'Fiction', 'Kim Hand', 'thriller', '2011-06-03T16:34:20.912+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facere dolor velit eaque', 'Fiction', 'Kim Hand', 'thriller', '2007-03-03T06:10:13.134+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non vel', 'Fiction', 'Hildegard Lesch', 'thriller', '2017-01-02T22:19:37.659+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('adipisci perferendis ea', 'Fiction', 'Kamron Senger', 'science fiction', '2019-12-09T11:53:10.136+00:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ipsa enim quis', 'Fiction', 'Adella Hackett', 'historical', -'2002-11-19 06:31:24', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('omnis et', 'Fiction', 'Maribel Fritsch', 'fantasy', '2013-07-14 14:18:59', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('labore rerum ut', 'Fiction', 'Maribel Fritsch', 'fantasy', '2019-02-19 23:45:51', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui tempore sed sint provident ut', 'Fiction', 'Maribel Fritsch', 'fantasy', '2016-02-27 01:12:56', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('optio et quia iure quia at', 'Fiction', 'Ardith Dietrich', 'horror', '2011-05-21 16:04:59', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('at placeat quisquam fugiat', 'Fiction', 'Chelsie Gerlach', 'dystopian', '2003-05-03 12:38:10', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit alias', 'Fiction', 'Chelsie Gerlach', 'dystopian', '2019-02-22 09:59:23', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('laudantium voluptas', 'Fiction', 'Zackery Dickinson', 'mystery', '2006-03-25 18:33:41', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('laborum quia soluta aut rerum sed', 'Fiction', 'Zackery Dickinson', 'mystery', '2009-12-01 14:08:06', 400); +'2002-11-19T06:31:24.205+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('omnis et', 'Fiction', 'Maribel Fritsch', 'fantasy', '2013-07-14T14:18:59.458+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('labore rerum ut', 'Fiction', 'Maribel Fritsch', 'fantasy', '2019-02-19T23:45:51.633+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui tempore sed sint provident ut', 'Fiction', 'Maribel Fritsch', 'fantasy', '2016-02-27T01:12:56.194+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('optio et quia iure quia at', 'Fiction', 'Ardith Dietrich', 'horror', '2011-05-21T16:04:59.862+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('at placeat quisquam fugiat', 'Fiction', 'Chelsie Gerlach', 'dystopian', '2003-05-03T12:38:10.051+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit alias', 'Fiction', 'Chelsie Gerlach', 'dystopian', '2019-02-22T09:59:23.732+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('laudantium voluptas', 'Fiction', 'Zackery Dickinson', 'mystery', '2006-03-25T18:33:41.908+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('laborum quia soluta aut rerum sed', 'Fiction', 'Zackery Dickinson', 'mystery', '2009-12-01T14:08:06.654+00:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('consectetur quibusdam placeat facilis voluptas', 'Fiction', -'Eda Lubowitz', 'science fiction', '2020-09-26 02:33:43', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et adipisci necessitatibus aperiam commodi', 'Fiction', 'Haven Lehner', 'science fiction', '2011-04-27 08:26:47', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non vel', 'Fiction', 'Haven Lehner', 'science fiction', '2012-01-31 13:38:40', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quisquam nihil quibusdam doloribus molestiae', 'Fiction', 'Jairo Flatley', 'fantasy', '2011-06-07 07:05:31', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('autem voluptas soluta molestiae quae', 'Fiction', 'Jairo Flatley', 'fantasy', '2010-05-27 05:46:04', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit excepturi', 'Fiction', 'Jairo Flatley', 'fantasy', '2003-08-22 12:07:46', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('iste praesentium rerum maxime', 'Fiction', 'Shayna Shields', 'literary fiction', '2011-03-23 16:12:05', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sed sapiente nisi nihil laborum', 'Fiction', 'Shayna Shields', 'literary fiction', '2021-09-03 00:44:40', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('rerum dolor', 'Fiction', 'Shayna Shields', 'literary fiction', '2017-08-31 13:18:14', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('illum est molestias velit quis iure', 'Fiction', 'Monroe Hahn', 'mystery', '2009-10-07 23:47:34', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea aliquid blanditiis', 'Fiction', 'Monroe Hahn', 'mystery', '2004-09-10 15:57:20', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('nisi quia delectus autem in', 'Fiction', 'Monroe Hahn', 'mystery', '2018-02-19 19:43:27', 400); +'Eda Lubowitz', 'science fiction', '2020-09-26T02:33:43.174+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et adipisci necessitatibus aperiam commodi', 'Fiction', 'Haven Lehner', 'science fiction', '2011-04-27T08:26:47.669+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non vel', 'Fiction', 'Haven Lehner', 'science fiction', '2012-01-31T13:38:40.465+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quisquam nihil quibusdam doloribus molestiae', 'Fiction', 'Jairo Flatley', 'fantasy', '2011-06-07T07:05:31.616+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('autem voluptas soluta molestiae quae', 'Fiction', 'Jairo Flatley', 'fantasy', '2010-05-27T05:46:04.053+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit excepturi', 'Fiction', 'Jairo Flatley', 'fantasy', '2003-08-22T12:07:46.886+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('iste praesentium rerum maxime', 'Fiction', 'Shayna Shields', 'literary fiction', '2011-03-23T16:12:05.844+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sed sapiente nisi nihil laborum', 'Fiction', 'Shayna Shields', 'literary fiction', '2021-09-03T00:44:40.909+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('rerum dolor', 'Fiction', 'Shayna Shields', 'literary fiction', '2017-08-31T13:18:14.009+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('illum est molestias velit quis iure', 'Fiction', 'Monroe Hahn', 'mystery', '2009-10-07T23:47:34.840+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ea aliquid blanditiis', 'Fiction', 'Monroe Hahn', 'mystery', '2004-09-10T15:57:20.058+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('nisi quia delectus autem in', 'Fiction', 'Monroe Hahn', 'mystery', '2018-02-19T19:43:27.830+00:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('natus quia ut quas', 'Fiction', 'Jaren Schaefer', 'literary -fiction', '2002-05-08 14:54:57', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptas labore aliquam ut et earum', 'Fiction', 'Stefanie Bednar', 'historical', '2019-04-28 18:11:41', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('rerum error est qui', 'Fiction', 'Stefanie Bednar', 'historical', '2019-06-06 01:28:32', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et voluptatem aliquid repellendus', 'Fiction', 'Stefanie Bednar', 'historical', '2010-01-11 11:48:26', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('necessitatibus et minus earum', 'Fiction', 'Devon Grady', 'western', '2010-09-22 15:57:55', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('aut quo dolorem', 'Fiction', 'Devon Grady', 'western', '2015-07-30 19:04:58', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et atque recusandae rerum quae', 'Fiction', 'Sister Klocko', 'mystery', '2016-06-19 11:53:10', 400); +fiction', '2002-05-08T14:54:57.508+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('voluptas labore aliquam ut et earum', 'Fiction', 'Stefanie Bednar', 'historical', '2019-04-28T18:11:41.200+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('rerum error est qui', 'Fiction', 'Stefanie Bednar', 'historical', '2019-06-06T01:28:32.178+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et voluptatem aliquid repellendus', 'Fiction', 'Stefanie Bednar', 'historical', '2010-01-11T11:48:26.297+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('necessitatibus et minus earum', 'Fiction', 'Devon Grady', 'western', '2010-09-22T15:57:55.046+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('aut quo dolorem', 'Fiction', 'Devon Grady', 'western', '2015-07-30T19:04:58.514+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et atque recusandae rerum quae', 'Fiction', 'Sister Klocko', 'mystery', '2016-06-19T11:53:10.083+01:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('est veniam similique hic soluta veniam', 'Fiction', 'Sister -Klocko', 'mystery', '2021-01-20 11:51:51', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non quasi sit dolores laborum', 'Fiction', 'Ola Hilll', 'mystery', '2003-03-21 22:22:49', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quaerat molestiae autem voluptates distinctio', 'Fiction', 'Ola Hilll', 'mystery', '2013-02-08 08:37:12', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('nihil autem veniam quo cupiditate suscipit', 'Fiction', 'Ola Hilll', 'mystery', '2006-07-25 20:33:43', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('minima et', 'Fiction', 'Johanna Hahn', 'thriller', '2006-01-17 05:44:02', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et repellat', 'Fiction', 'Luther Lehner', 'historical', '2020-02-12 15:35:18', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quos ea', 'Fiction', 'Luther Lehner', 'historical', '2005-09-28 02:59:16', 400); +Klocko', 'mystery', '2021-01-20T11:51:51.482+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('non quasi sit dolores laborum', 'Fiction', 'Ola Hilll', 'mystery', '2003-03-21T22:22:49.630+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quaerat molestiae autem voluptates distinctio', 'Fiction', 'Ola Hilll', 'mystery', '2013-02-08T08:37:12.789+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('nihil autem veniam quo cupiditate suscipit', 'Fiction', 'Ola Hilll', 'mystery', '2006-07-25T20:33:43.191+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('minima et', 'Fiction', 'Johanna Hahn', 'thriller', '2006-01-17T05:44:02.267+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et repellat', 'Fiction', 'Luther Lehner', 'historical', '2020-02-12T15:35:18.982+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quos ea', 'Fiction', 'Luther Lehner', 'historical', '2005-09-28T02:59:16.221+01:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('excepturi suscipit perspiciatis animi deserunt', 'Fiction', -'Ardith Schaden', 'literary fiction', '2010-03-12 11:12:09', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('pariatur vel dolores', 'Fiction', 'Ardith Schaden', 'literary fiction', '2019-10-07 16:41:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('autem natus et nihil magnam facilis', 'Fiction', 'Ardith Schaden', 'literary fiction', '2020-09-13 01:03:23', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('vitae nemo laboriosam et voluptatibus', 'Fiction', 'Ahmad Pagac', 'horror', '2016-05-01 13:23:50', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('in modi ut totam ea', 'Fiction', 'Gwen Goyette', 'horror', '2005-06-14 14:54:50', 400); +'Ardith Schaden', 'literary fiction', '2010-03-12T11:12:09.214+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('pariatur vel dolores', 'Fiction', 'Ardith Schaden', 'literary fiction', '2019-10-07T16:41:00.370+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('autem natus et nihil magnam facilis', 'Fiction', 'Ardith Schaden', 'literary fiction', '2020-09-13T01:03:23.774+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('vitae nemo laboriosam et voluptatibus', 'Fiction', 'Ahmad Pagac', 'horror', '2016-05-01T13:23:50.408+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('in modi ut totam ea', 'Fiction', 'Gwen Goyette', 'horror', '2005-06-14T14:54:50.097+01:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae quia porro', 'Fiction', 'Gwen Goyette', 'horror', -'2005-01-13 22:58:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et soluta aut', 'Fiction', 'Gwen Goyette', 'horror', '2013-10-26 06:36:26', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('hic impedit aspernatur', 'Fiction', 'Mohammed Fritsch', 'dystopian', '2008-07-24 04:24:04', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('assumenda consequatur', 'Fiction', 'Claudia Quitzon', 'horror', '2019-01-29 04:51:53', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('atque nostrum eos ipsa aut provident', 'Fiction', 'Claudia Quitzon', 'horror', '2017-08-09 10:31:52', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('totam ex adipisci nesciunt itaque', 'Fiction', 'Claudia Quitzon', 'horror', '2016-09-08 23:48:13', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('officiis voluptatum consequatur', 'Non-Fiction', 'Katelin Koch', 'humour', '2020-05-30 06:46:51', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('consectetur consequatur', 'Non-Fiction', 'Katelin Koch', 'humour', '2014-12-30 06:56:28', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('at omnis aut commodi vel neque', 'Non-Fiction', 'Archibald Mertz', 'business', '2004-03-31 02:14:37', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('culpa hic dolore consequatur', 'Non-Fiction', 'Archibald Mertz', 'business', '2012-08-14 18:40:20', 400); +'2005-01-13T22:58:00.899+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et soluta aut', 'Fiction', 'Gwen Goyette', 'horror', '2013-10-26T06:36:26.645+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('hic impedit aspernatur', 'Fiction', 'Mohammed Fritsch', 'dystopian', '2008-07-24T04:24:04.037+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('assumenda consequatur', 'Fiction', 'Claudia Quitzon', 'horror', '2019-01-29T04:51:53.005+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('atque nostrum eos ipsa aut provident', 'Fiction', 'Claudia Quitzon', 'horror', '2017-08-09T10:31:52.709+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('totam ex adipisci nesciunt itaque', 'Fiction', 'Claudia Quitzon', 'horror', '2016-09-08T23:48:13.245+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('officiis voluptatum consequatur', 'Non-Fiction', 'Katelin Koch', 'humour', '2020-05-30T06:46:51.314+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('consectetur consequatur', 'Non-Fiction', 'Katelin Koch', 'humour', '2014-12-30T06:56:28.717+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('at omnis aut commodi vel neque', 'Non-Fiction', 'Archibald Mertz', 'business', '2004-03-31T02:14:37.980+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('culpa hic dolore consequatur', 'Non-Fiction', 'Archibald Mertz', 'business', '2012-08-14T18:40:20.333+01:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eaque id eligendi expedita', 'Non-Fiction', 'Gino Flatley', -'history', '2017-08-28 04:44:22', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eveniet aut omnis quasi vitae voluptas', 'Non-Fiction', 'Gino Flatley', 'history', '2013-05-06 02:18:11', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui quam adipisci alias atque', 'Non-Fiction', 'Gino Flatley', 'history', '2008-04-09 13:51:36', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae in', 'Non-Fiction', 'Heber Williamson', 'travel guide', '2017-02-07 18:37:25', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('corrupti tenetur', 'Non-Fiction', 'Heber Williamson', 'travel guide', '2019-07-14 17:06:36', 400); +'history', '2017-08-28T04:44:22.075+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eveniet aut omnis quasi vitae voluptas', 'Non-Fiction', 'Gino Flatley', 'history', '2013-05-06T02:18:11.750+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui quam adipisci alias atque', 'Non-Fiction', 'Gino Flatley', 'history', '2008-04-09T13:51:36.809+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae in', 'Non-Fiction', 'Heber Williamson', 'travel guide', '2017-02-07T18:37:25.992+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('corrupti tenetur', 'Non-Fiction', 'Heber Williamson', 'travel guide', '2019-07-14T17:06:36.761+01:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut quisquam officia qui nemo sunt', 'Non-Fiction', 'Yesenia -Nicolas', 'business', '2015-12-20 00:58:31', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('natus laboriosam', 'Non-Fiction', 'Gilberto Walter', 'history', '2017-01-02 14:19:33', 400); +Nicolas', 'business', '2015-12-20T00:58:31.725+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('natus laboriosam', 'Non-Fiction', 'Gilberto Walter', 'history', '2017-01-02T14:19:33.875+00:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('corporis quos repellendus sapiente eveniet', 'Non-Fiction', -'Gilberto Walter', 'history', '2013-10-11 14:35:26', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facilis ut', 'Non-Fiction', 'Alexandro Schuster', 'travel guide', '2012-01-11 02:32:36', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('harum hic', 'Non-Fiction', 'Libbie Bradtke', 'humour', '2007-04-10 20:39:16', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae quaerat', 'Non-Fiction', 'Libbie Bradtke', 'humour', '2018-10-07 03:18:51', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facere repellendus', 'Non-Fiction', 'Dewitt Hauck', 'history', '2016-05-14 13:30:58', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('est quia neque molestias', 'Non-Fiction', 'Nick Russel', 'history', '2019-07-07 09:52:06', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolorum inventore est veniam id', 'Non-Fiction', 'Nick Russel', 'history', '2006-01-06 17:38:24', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae rerum in voluptas commodi', 'Non-Fiction', 'Isabelle Auer', 'philosophy', '2009-02-01 00:39:20', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('id fugit quia est ipsa quibusdam', 'Non-Fiction', 'Holly Greenholt', 'history', '2008-12-09 23:30:23', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('minima voluptatem quis ut quidem perferendis', 'Non-Fiction', 'Elwyn Stanton', 'business', '2006-06-03 21:05:25', 400); +'Gilberto Walter', 'history', '2013-10-11T14:35:26.738+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facilis ut', 'Non-Fiction', 'Alexandro Schuster', 'travel guide', '2012-01-11T02:32:36.994+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('harum hic', 'Non-Fiction', 'Libbie Bradtke', 'humour', '2007-04-10T20:39:16.323+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae quaerat', 'Non-Fiction', 'Libbie Bradtke', 'humour', '2018-10-07T03:18:51.903+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('facere repellendus', 'Non-Fiction', 'Dewitt Hauck', 'history', '2016-05-14T13:30:58.198+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('est quia neque molestias', 'Non-Fiction', 'Nick Russel', 'history', '2019-07-07T09:52:06.577+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolorum inventore est veniam id', 'Non-Fiction', 'Nick Russel', 'history', '2006-01-06T17:38:24.318+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('molestiae rerum in voluptas commodi', 'Non-Fiction', 'Isabelle Auer', 'philosophy', '2009-02-01T00:39:20.149+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('id fugit quia est ipsa quibusdam', 'Non-Fiction', 'Holly Greenholt', 'history', '2008-12-09T23:30:23.552+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('minima voluptatem quis ut quidem perferendis', 'Non-Fiction', 'Elwyn Stanton', 'business', '2006-06-03T21:05:25.445+01:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('incidunt ex rerum pariatur temporibus amet', 'Non-Fiction', -'Elwyn Stanton', 'business', '2016-03-07 15:29:17', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolorum et nostrum natus', 'Non-Fiction', 'Elwyn Stanton', 'business', '2021-06-29 17:30:00', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eaque est cupiditate ad nemo', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2021-06-11 10:43:17', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et voluptate laboriosam', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2011-01-18 04:34:41', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ducimus porro quae aut aspernatur', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2019-02-01 14:45:32', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui quisquam', 'Non-Fiction', 'Timothy Jast', 'biography', '2011-09-08 06:02:45', 400); +'Elwyn Stanton', 'business', '2016-03-07T15:29:17.406+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolorum et nostrum natus', 'Non-Fiction', 'Elwyn Stanton', 'business', '2021-06-29T17:30:00.115+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('eaque est cupiditate ad nemo', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2021-06-11T10:43:17.356+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('et voluptate laboriosam', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2011-01-18T04:34:41.382+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ducimus porro quae aut aspernatur', 'Non-Fiction', 'Tevin Pagac', 'self-help', '2019-02-01T14:45:32.868+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('qui quisquam', 'Non-Fiction', 'Timothy Jast', 'biography', '2011-09-08T06:02:45.369+01:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('neque sunt nobis assumenda', 'Non-Fiction', 'Timothy Jast', -'biography', '2019-09-20 04:03:48', 400); +'biography', '2019-09-20T04:03:48.308+01:00', 400); INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sit suscipit qui repudiandae quia', 'Non-Fiction', 'Samantha -Beahan', 'philosophy', '2016-12-12 01:38:27', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sapiente alias impedit', 'Non-Fiction', 'Samantha Beahan', 'philosophy', '2014-07-15 18:15:14', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('odio recusandae', 'Non-Fiction', 'Wilma Jast', 'biography', '2017-12-30 11:44:38', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('iste aut nemo', 'Non-Fiction', 'Everette Cormier', 'self-help', '2019-10-23 21:48:24', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut eveniet non', 'Non-Fiction', 'Everette Cormier', 'self-help', '2021-05-10 19:55:28', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('placeat eius consectetur architecto', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2018-02-20 07:56:03', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quia cumque maiores illum', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2021-04-24 05:10:20', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ratione laudantium voluptas nihil voluptatem', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2014-02-26 03:05:12', 400); -INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolore qui accusamus sed', 'Non-Fiction', 'Arianna Dietrich', 'biography', '2004-06-23 09:29:19', 400); \ No newline at end of file +Beahan', 'philosophy', '2016-12-12T01:38:27.401+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('sapiente alias impedit', 'Non-Fiction', 'Samantha Beahan', 'philosophy', '2014-07-15T18:15:14.711+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('odio recusandae', 'Non-Fiction', 'Wilma Jast', 'biography', '2017-12-30T11:44:38.638+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('iste aut nemo', 'Non-Fiction', 'Everette Cormier', 'self-help', '2019-10-23T21:48:24.119+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ut eveniet non', 'Non-Fiction', 'Everette Cormier', 'self-help', '2021-05-10T19:55:28.240+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('placeat eius consectetur architecto', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2018-02-20T07:56:03.841+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('quia cumque maiores illum', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2021-04-24T05:10:20.766+01:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('ratione laudantium voluptas nihil voluptatem', 'Non-Fiction', 'Nick Labadie', 'philosophy', '2014-02-26T03:05:12.242+00:00', 400); +INSERT INTO books (title, type, author, topic, publication_date, pages) VALUES ('dolore qui accusamus sed', 'Non-Fiction', 'Arianna Dietrich', 'biography', '2004-06-23T09:29:19.212+01:00', 400); \ No newline at end of file diff --git a/sql/insert-pets.sql b/sql/insert-pets.sql index 5b2033e4..81561b2a 100644 --- a/sql/insert-pets.sql +++ b/sql/insert-pets.sql @@ -337,4 +337,4 @@ INSERT INTO pets (name, age, type, breed, has_microchip) VALUES('Corbin', 19, 'r INSERT INTO pets (name, age, type, breed, has_microchip) VALUES('Jazmyne', 8, 'rabbit', 'Florida White', true); INSERT INTO pets (name, age, type, breed, has_microchip) VALUES('Ralph', 15, 'rabbit', 'Florida White', false); INSERT INTO pets (name, age, type, breed, has_microchip) VALUES('Yasmin', 16, 'rabbit', 'Florida White', false); -INSERT INTO pets (name, age, type, breed, has_microchip) VALUES('Joan', 4, 'rabbit', 'Florida White', true); +INSERT INTO pets (name, age, type, breed, has_microchip) VALUES('Joan', 4, 'rabbit', 'Florida White', true); \ No newline at end of file diff --git a/src/routers/books.js b/src/routers/books.js index b6043246..b78bf1b9 100644 --- a/src/routers/books.js +++ b/src/routers/books.js @@ -1,44 +1,72 @@ const express = require('express') const router = express.Router() const db = require("../../db"); +const { parseISO, format } = require('date-fns'); +const { utcToZonedTime } = require('date-fns-tz'); router.get('/', async (req, res) => { - const response = await db.query("select * FROM books", []) - res.json({books: response}) + const queryOptions = [] + const queryParams = [] + const type = req.query.type + const topic = req.query.topic + if(type !== undefined){ + queryOptions.push(`LOWER(type) = $1`) + queryParams.push(type) + } + if(topic !== undefined){ + queryOptions.push(`LOWER(topic) = $${queryOptions.length + 1}`) + queryParams.push(topic) + } + console.log("query:", `select * FROM books ${queryOptions.length > 0 ? "WHERE " : ""}${queryOptions.join(" AND ")}`, queryParams) + const response = await db.query(`select * FROM books ${queryOptions.length > 0 ? "WHERE " : ""}${queryOptions.join(" AND ")}`, queryParams) + res.json({books: response.rows.map(parseBook)}) }) router.get('/:id', async (req, res) => { - const response = await db.query("select * FROM books WHERE id = ? ", [req.params.id]) - res.json({books: response}) + const response = await db.query("select * FROM books WHERE id = $1 ", [req.params.id]) + res.json({book: parseBook(response.rows[0])}) }) router.put('/:id', async (req, res) => { console.log("BumbaClap", req.body) const update = await db.query( `UPDATE books - SET title = ?, - type = ?, - author = ?, - topic = ?, - publication_date = ?, - pages = ? - WHERE id = ?; + SET title = $1, + type = $2, + author = $3, + topic = $4, + publication_date = $5, + pages = $6 + WHERE id = $7; `, [req.body.title, req.body.type, req.body.author, req.body.topic, req.body.publication_date, req.body.pages, req.params.id ]) - const response = await db.query("select * FROM books WHERE id = ? ", [req.params.id]) - res.json({books: response}) + const response = await db.query("select * FROM books WHERE id = $1 ", [req.params.id]) + res.status(201).json({book: parseBook(response.rows[0])}) }) router.delete('/:id', async (req, res) => { - const response = await db.query("select * FROM books WHERE id = ? ", [req.params.id]) - await db.query("DELETE FROM books WHERE id = ?", [req.params.id]) - res.json({books: response}) + const response = await db.query("select * FROM books WHERE id = $1 ", [req.params.id]) + await db.query("DELETE FROM books WHERE id = $1", [req.params.id]) + res.status(201).json({book: parseBook(response.rows[0])}) }) router.post('/', async (req, res) => { console.log("BumbaClap", req.body) const update = await db.query( `INSERT INTO books (title, type, author, topic, publication_date, pages) -VALUES (?, ?, ?, ?, ?, ?); +VALUES ($1, $2, $3, $4, $5, $6) RETURNING *; `, [req.body.title, req.body.type, req.body.author, req.body.topic, req.body.publication_date, req.body.pages]) - console.log("test", update.insertId) -const response = await db.query("select * FROM books WHERE id = ? ", [update.insertId]) - res.status(201).json({books: response}) + console.log("test", update.rows[0]) +const response = await db.query("select * FROM books WHERE id = $1 ", [update.rows[0].id]) + res.status(201).json({book: parseBook(response.rows[0])}) }) +function parseBook(bookData) { +// // Parse the input date string to a Date object +// const date = parseISO(bookData.publication_date); + +// // Convert the date to the local time zone +// const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; +// const zonedDate = utcToZonedTime(date, timeZone); + +// Format the date to 'yyyy-MM-dd HH:mm:ss' +const outputDateStr = format(new Date(bookData.publication_date), 'yyyy-MM-dd HH:mm:ss'); +return {...bookData, publication_date:outputDateStr} +} + module.exports = router diff --git a/src/routers/pets.js b/src/routers/pets.js index 0df1133c..6d52eb67 100644 --- a/src/routers/pets.js +++ b/src/routers/pets.js @@ -3,41 +3,43 @@ const router = express.Router() const db = require("../../db"); router.get('/', async (req, res) => { - const response = await db.query("select * FROM pets", []) - res.json({pets: response.map(parsePet)}) + const type = req.query.type + const response = await db.query(`select * FROM pets ${type !==undefined ? "WHERE type = $1" : ""}`, type !== undefined ? [type] : []) + res.json({pets: response.rows.map(parsePet)}) }) router.get('/:id', async (req, res) => { - const response = await db.query("select * FROM pets WHERE id = ? ", [req.params.id]) - res.json({pet: parsePet(response[0])}) + const response = await db.query("select * FROM pets WHERE id = $1 ", [req.params.id]) + res.json({pet: parsePet(response.rows[0])}) }) router.put('/:id', async (req, res) => { - console.log("BumbaClap", req.body) + // console.log("BumbaClap", req.body) const update = await db.query( `UPDATE pets - SET name = ?, - age = ?, - type = ?, - breed = ?, - has_microchip = ? - WHERE id = ?; + SET name = $1, + age = $2, + type = $3, + breed = $4, + has_microchip = $5 + WHERE id = $6; `, [req.body.name, req.body.age, req.body.type, req.body.breed, req.body.has_microchip, req.params.id ]) - const response = await db.query("select * FROM pets WHERE id = ? ", [req.params.id]) - res.json({pet: parsePet(response[0])}) + const response = await db.query("select * FROM pets WHERE id = $1 ", [req.params.id]) + res.status(201).json({pet: parsePet(response.rows[0])}) }) router.delete('/:id', async (req, res) => { - const response = await db.query("select * FROM pets WHERE id = ? ", [req.params.id]) - await db.query("DELETE FROM pets WHERE id = ?", [req.params.id]) - res.json({pet: parsePet(response[0])}) + + const deleteResponse = await db.query("DELETE FROM pets WHERE id = $1 RETURNING *;", [req.params.id]) + // console.log("data", deleteResponse) + res.status(201).json({pet: parsePet(deleteResponse.rows[0])}) }) router.post('/', async (req, res) => { - console.log("BumbaClap", req.body) + // console.log("BumbaClap", req.body) const update = await db.query( `INSERT INTO pets (name, age, type, breed, has_microchip) -VALUES (?, ?, ?, ?, ?); +VALUES ($1, $2, $3, $4, $5) RETURNING *; `, [req.body.name, req.body.age, req.body.type, req.body.breed, req.body.has_microchip]) - console.log("test", update.insertId) -const response = await db.query("select * FROM pets WHERE id = ? ", [update.insertId]) - res.status(201).json({pet: parsePet(response[0])}) + // console.log("test", update.rows[0]) +const response = await db.query("select * FROM pets WHERE id = $1 ", [update.rows[0].id]) + res.status(201).json({pet: parsePet(response.rows[0])}) }) function parsePet(data) { diff --git a/test/api/routes/pets.spec.js b/test/api/routes/pets.spec.js index 73e22597..f8b367a0 100644 --- a/test/api/routes/pets.spec.js +++ b/test/api/routes/pets.spec.js @@ -31,6 +31,7 @@ describe("Pets Endpoint", () => { expect(response.status).toEqual(200) expect(response.body.pets).not.toEqual(undefined) + console.log("response", response.body) expect(response.body.pets.length).toEqual(2) }) @@ -82,4 +83,4 @@ describe("Pets Endpoint", () => { } }) }) -}) +}) \ No newline at end of file diff --git a/test/helpers/createBook.js b/test/helpers/createBook.js index 5f7e9c76..3ea356b0 100644 --- a/test/helpers/createBook.js +++ b/test/helpers/createBook.js @@ -8,4 +8,4 @@ const createBook = async (values) => { return result.rows[0] } -module.exports = createBook +module.exports = createBook \ No newline at end of file diff --git a/test/helpers/createPet.js b/test/helpers/createPet.js index 833890d1..a85e248d 100644 --- a/test/helpers/createPet.js +++ b/test/helpers/createPet.js @@ -1,11 +1,11 @@ const client = require("../../db"); const createPet = async (values) => { - const sqlString = `INSERT INTO "pets" (name, age, type, breed, has_microchip) VALUES (?, ?, ?, ?, ?);` - + const sqlString = `INSERT INTO "pets" (name, age, type, breed, has_microchip) VALUES ($1, $2, $3, $4, $5) RETURNING *;` +console.log("insert pets", values) const result = await client.query(sqlString, values) return result.rows[0] } -module.exports = createPet +module.exports = createPet \ No newline at end of file diff --git a/test/helpers/insertBooks.js b/test/helpers/insertBooks.js index 54e720ca..295c6713 100644 --- a/test/helpers/insertBooks.js +++ b/test/helpers/insertBooks.js @@ -8,4 +8,4 @@ const insertBooks = async () => { await client.query(sqlStringForBooks) } -module.exports = insertBooks +module.exports = insertBooks \ No newline at end of file diff --git a/test/helpers/insertPets.js b/test/helpers/insertPets.js index eadddec2..771b706c 100644 --- a/test/helpers/insertPets.js +++ b/test/helpers/insertPets.js @@ -8,4 +8,4 @@ const insertPets = async () => { await client.query(sqlStringForPets) } -module.exports = insertPets +module.exports = insertPets \ No newline at end of file