Many Changes
This commit is contained in:
parent
a01b6bdbc2
commit
f6eef1ded3
@ -1,23 +0,0 @@
|
||||
{
|
||||
"development": {
|
||||
"username": "root",
|
||||
"password": null,
|
||||
"database": "database_development",
|
||||
"host": "127.0.0.1",
|
||||
"dialect": "sqlite"
|
||||
},
|
||||
"test": {
|
||||
"username": "root",
|
||||
"password": null,
|
||||
"database": "database_test",
|
||||
"host": "127.0.0.1",
|
||||
"dialect": "sqlite"
|
||||
},
|
||||
"production": {
|
||||
"username": "root",
|
||||
"password": null,
|
||||
"database": "database_production",
|
||||
"host": "127.0.0.1",
|
||||
"dialect": "sqlite"
|
||||
}
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Sequelize = require('sequelize');
|
||||
const process = require('process');
|
||||
const basename = path.basename(__filename);
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
const config = require(__dirname + '/../config/config.json')[env];
|
||||
const db = {};
|
||||
|
||||
let sequelize;
|
||||
if (config.use_env_variable) {
|
||||
sequelize = new Sequelize(process.env[config.use_env_variable], config);
|
||||
} else {
|
||||
sequelize = new Sequelize(config.database, config.username, config.password, config);
|
||||
}
|
||||
|
||||
fs
|
||||
.readdirSync(__dirname)
|
||||
.filter(file => {
|
||||
return (
|
||||
file.indexOf('.') !== 0 &&
|
||||
file !== basename &&
|
||||
file.slice(-3) === '.js' &&
|
||||
file.indexOf('.test.js') === -1
|
||||
);
|
||||
})
|
||||
.forEach(file => {
|
||||
const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes);
|
||||
db[model.name] = model;
|
||||
});
|
||||
|
||||
Object.keys(db).forEach(modelName => {
|
||||
if (db[modelName].associate) {
|
||||
db[modelName].associate(db);
|
||||
}
|
||||
});
|
||||
|
||||
db.sequelize = sequelize;
|
||||
db.Sequelize = Sequelize;
|
||||
|
||||
module.exports = db;
|
||||
@ -1,9 +1,15 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
experimental: {
|
||||
serverComponentsExternalPackages: ['sequelize', 'sequelize-typescript'],
|
||||
serverActions: true,
|
||||
}
|
||||
serverComponentsExternalPackages: ['sequelize', 'sequelize-typescript', 'bcrypt', '@sequelize/core'],
|
||||
serverActions: {
|
||||
|
||||
},
|
||||
},
|
||||
webpack: (config) => {
|
||||
config.externals = [...config.externals, 'bcrypt'];
|
||||
return config;
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = nextConfig
|
||||
|
||||
294
package-lock.json
generated
294
package-lock.json
generated
@ -8,6 +8,8 @@
|
||||
"name": "portfolio2023",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@sequelize/core": "^7.0.0-alpha.40",
|
||||
"@sequelize/sqlite3": "^7.0.0-alpha.40",
|
||||
"@types/bcrypt": "^5.0.0",
|
||||
"@types/cookie": "^0.5.1",
|
||||
"@types/node": "20.1.7",
|
||||
@ -23,6 +25,7 @@
|
||||
"fetch-cookie": "^3.0.1",
|
||||
"flowbite": "^2.3.0",
|
||||
"flowbite-react": "^0.7.5",
|
||||
"moment": "^2.30.1",
|
||||
"mysql": "^2.18.1",
|
||||
"mysql2": "^3.3.3",
|
||||
"next": "14.1.4",
|
||||
@ -31,7 +34,6 @@
|
||||
"react": "18.2.0",
|
||||
"react-bootstrap": "^2.7.4",
|
||||
"react-dom": "18.2.0",
|
||||
"sequelize": "^6.32.0",
|
||||
"sqlite": "^4.2.1",
|
||||
"tailwindcss": "3.3.2",
|
||||
"ts-node": "^10.9.2",
|
||||
@ -195,7 +197,6 @@
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz",
|
||||
"integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@humanwhocodes/config-array": {
|
||||
@ -531,7 +532,6 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz",
|
||||
"integrity": "sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@gar/promisify": "^1.0.1",
|
||||
@ -543,7 +543,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz",
|
||||
"integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==",
|
||||
"deprecated": "This functionality has been moved to @npmcli/fs",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"mkdirp": "^1.0.4",
|
||||
@ -629,6 +628,74 @@
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.7.2.tgz",
|
||||
"integrity": "sha512-RbhOOTCNoCrbfkRyoXODZp75MlpiHMgbE5MEBZAnnnLyQNgrigEj4p0lzsMDyc1zVsJDLrivB58tgg3emX0eEA=="
|
||||
},
|
||||
"node_modules/@sequelize/core": {
|
||||
"version": "7.0.0-alpha.40",
|
||||
"resolved": "https://registry.npmjs.org/@sequelize/core/-/core-7.0.0-alpha.40.tgz",
|
||||
"integrity": "sha512-wj91y6Vx9k4pLOQVFyZLlq01xnS08dOPO/7//vtI20FVbPnmJpHnaqcuWYhkC0XGTmtPGfx9ZDJJ1rMG8tTFoA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/sequelize"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@sequelize/utils": "7.0.0-alpha.40",
|
||||
"@types/debug": "^4.1.12",
|
||||
"@types/validator": "^13.11.9",
|
||||
"bnf-parser": "^3.1.6",
|
||||
"chalk": "^4.1.2",
|
||||
"dayjs": "^1.11.10",
|
||||
"debug": "^4.3.4",
|
||||
"dottie": "^2.0.6",
|
||||
"fast-glob": "^3.3.2",
|
||||
"inflection": "^3.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"retry-as-promised": "^7.0.4",
|
||||
"semver": "^7.3",
|
||||
"sequelize-pool": "^8.0.0",
|
||||
"toposort-class": "^1.0.1",
|
||||
"type-fest": "^4.14.0",
|
||||
"uuid": "^9.0.1",
|
||||
"validator": "^13.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@sequelize/core/node_modules/type-fest": {
|
||||
"version": "4.15.0",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.15.0.tgz",
|
||||
"integrity": "sha512-tB9lu0pQpX5KJq54g+oHOLumOx+pMep4RaM6liXh2PKmVRFF+/vAtUP0ZaJ0kOySfVNjF6doBWPHhBhISKdlIA==",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/@sequelize/sqlite3": {
|
||||
"version": "7.0.0-alpha.40",
|
||||
"resolved": "https://registry.npmjs.org/@sequelize/sqlite3/-/sqlite3-7.0.0-alpha.40.tgz",
|
||||
"integrity": "sha512-sBVtpYfGst6X2/3wcfLhPJQi3N+lGQwEQz9g3TBd0Ai6Q2GTbUg+SgNoJwABzUy/kDvzSWaTf0WdQr5mpftUgg==",
|
||||
"dependencies": {
|
||||
"@sequelize/core": "7.0.0-alpha.40",
|
||||
"@sequelize/utils": "7.0.0-alpha.40",
|
||||
"lodash": "^4.17.21",
|
||||
"sqlite3": "^5.1.7"
|
||||
}
|
||||
},
|
||||
"node_modules/@sequelize/utils": {
|
||||
"version": "7.0.0-alpha.40",
|
||||
"resolved": "https://registry.npmjs.org/@sequelize/utils/-/utils-7.0.0-alpha.40.tgz",
|
||||
"integrity": "sha512-npN1C6m3QPvrDlZSveB9DHSyx2I4EGEshIv7R7jCXt7iKFVG2o/LLYlFK4rwzND5YtNRI6ES69UxLg/65KSa5g==",
|
||||
"dependencies": {
|
||||
"@types/lodash": "^4.17.0",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/helpers": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.2.tgz",
|
||||
@ -641,7 +708,6 @@
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
|
||||
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
@ -693,6 +759,11 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ=="
|
||||
},
|
||||
"node_modules/@types/lodash": {
|
||||
"version": "4.17.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.0.tgz",
|
||||
"integrity": "sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA=="
|
||||
},
|
||||
"node_modules/@types/ms": {
|
||||
"version": "0.7.34",
|
||||
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz",
|
||||
@ -900,7 +971,6 @@
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz",
|
||||
"integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"humanize-ms": "^1.2.1"
|
||||
@ -913,7 +983,6 @@
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
|
||||
"integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"clean-stack": "^2.0.0",
|
||||
@ -1282,7 +1351,6 @@
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@ -1331,7 +1399,6 @@
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
@ -1340,7 +1407,6 @@
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
@ -1351,7 +1417,6 @@
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
@ -1361,6 +1426,11 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/bnf-parser": {
|
||||
"version": "3.1.6",
|
||||
"resolved": "https://registry.npmjs.org/bnf-parser/-/bnf-parser-3.1.6.tgz",
|
||||
"integrity": "sha512-3x0ECh6CghmcAYnY6uiVAOfl263XkWffDq5fQS20ac3k0U7TE5rTWNXTnOTckgmfZc94iharwqCyoV8OAYxYoA=="
|
||||
},
|
||||
"node_modules/bootstrap": {
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz",
|
||||
@ -1434,7 +1504,6 @@
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@ -1469,7 +1538,6 @@
|
||||
"version": "15.3.0",
|
||||
"resolved": "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz",
|
||||
"integrity": "sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@npmcli/fs": "^1.0.0",
|
||||
@ -1499,7 +1567,6 @@
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
@ -1627,7 +1694,6 @@
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
|
||||
"integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
@ -1732,6 +1798,11 @@
|
||||
"resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz",
|
||||
"integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA=="
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.10",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
|
||||
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
|
||||
},
|
||||
"node_modules/debounce": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/debounce/-/debounce-2.0.0.tgz",
|
||||
@ -1763,7 +1834,6 @@
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mimic-response": "^3.1.0"
|
||||
},
|
||||
@ -1778,7 +1848,6 @@
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
@ -1931,7 +2000,6 @@
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
@ -1952,7 +2020,6 @@
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
|
||||
"integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
@ -1962,7 +2029,6 @@
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz",
|
||||
"integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/es-abstract": {
|
||||
@ -2518,7 +2584,6 @@
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
|
||||
"integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
@ -2595,8 +2660,7 @@
|
||||
"node_modules/file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
|
||||
},
|
||||
"node_modules/fill-range": {
|
||||
"version": "7.0.1",
|
||||
@ -2718,8 +2782,7 @@
|
||||
"node_modules/fs-constants": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
|
||||
"dev": true
|
||||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
||||
},
|
||||
"node_modules/fs-minipass": {
|
||||
"version": "2.1.0",
|
||||
@ -2858,8 +2921,7 @@
|
||||
"node_modules/github-from-package": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
||||
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "7.1.7",
|
||||
@ -3042,14 +3104,12 @@
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
|
||||
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/http-proxy-agent": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",
|
||||
"integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@tootallnate/once": "1",
|
||||
@ -3076,7 +3136,6 @@
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
|
||||
"integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"ms": "^2.0.0"
|
||||
@ -3097,7 +3156,6 @@
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@ -3148,7 +3206,6 @@
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
|
||||
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@ -3158,16 +3215,15 @@
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",
|
||||
"integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/inflection": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmjs.org/inflection/-/inflection-1.13.4.tgz",
|
||||
"integrity": "sha512-6I/HUDeYFfuNCVS3td055BaXBwKYuzw7K3ExVMStBowKo9oOAMJIXIHvdyR3iboTCp1b+1i5DSkIZTcwIktuDw==",
|
||||
"engines": [
|
||||
"node >= 0.4.0"
|
||||
]
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inflection/-/inflection-3.0.0.tgz",
|
||||
"integrity": "sha512-1zEJU1l19SgJlmwqsEyFTbScw/tkMHFenUo//Y0i+XEP83gDFdMvPizAD/WGcE+l1ku12PcTVHQhO6g5E0UCMw==",
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inflight": {
|
||||
"version": "1.0.6",
|
||||
@ -3186,8 +3242,7 @@
|
||||
"node_modules/ini": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
||||
"dev": true
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
|
||||
},
|
||||
"node_modules/internal-slot": {
|
||||
"version": "1.0.7",
|
||||
@ -3214,7 +3269,6 @@
|
||||
"version": "9.0.5",
|
||||
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
|
||||
"integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"jsbn": "1.1.0",
|
||||
@ -3382,7 +3436,6 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz",
|
||||
"integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/is-map": {
|
||||
@ -3637,7 +3690,6 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
|
||||
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/json-buffer": {
|
||||
@ -3808,7 +3860,6 @@
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz",
|
||||
"integrity": "sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"agentkeepalive": "^4.1.3",
|
||||
@ -3836,7 +3887,6 @@
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
@ -3869,7 +3919,6 @@
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
@ -3919,7 +3968,6 @@
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz",
|
||||
"integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"minipass": "^3.0.0"
|
||||
@ -3932,7 +3980,6 @@
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.4.1.tgz",
|
||||
"integrity": "sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"minipass": "^3.1.0",
|
||||
@ -3950,7 +3997,6 @@
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz",
|
||||
"integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"minipass": "^3.0.0"
|
||||
@ -3963,7 +4009,6 @@
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz",
|
||||
"integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"minipass": "^3.0.0"
|
||||
@ -3976,7 +4021,6 @@
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz",
|
||||
"integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"minipass": "^3.0.0"
|
||||
@ -4011,8 +4055,7 @@
|
||||
"node_modules/mkdirp-classic": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
||||
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
|
||||
"dev": true
|
||||
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.30.1",
|
||||
@ -4022,17 +4065,6 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/moment-timezone": {
|
||||
"version": "0.5.45",
|
||||
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.45.tgz",
|
||||
"integrity": "sha512-HIWmqA86KcmCAhnMAN0wuDOARV/525R2+lOLotuGFzn4HO+FH+/645z2wx0Dt3iDv6/p61SIvKnDstISainhLQ==",
|
||||
"dependencies": {
|
||||
"moment": "^2.29.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
@ -4053,9 +4085,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mysql2": {
|
||||
"version": "3.9.2",
|
||||
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.9.2.tgz",
|
||||
"integrity": "sha512-3Cwg/UuRkAv/wm6RhtPE5L7JlPB877vwSF6gfLAS68H+zhH+u5oa3AieqEd0D0/kC3W7qIhYbH419f7O9i/5nw==",
|
||||
"version": "3.9.6",
|
||||
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.9.6.tgz",
|
||||
"integrity": "sha512-9NYUMLQv6yXnu+5hUh8PZ5CdKoG6VWDzXbojIdTyob8upNZXU3rBNQK9viaEqfgw+LMifhd+53VEZPxZk3bTWA==",
|
||||
"dependencies": {
|
||||
"denque": "^2.1.0",
|
||||
"generate-function": "^2.3.1",
|
||||
@ -4127,8 +4159,7 @@
|
||||
"node_modules/napi-build-utils": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
|
||||
"integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg=="
|
||||
},
|
||||
"node_modules/natural-compare": {
|
||||
"version": "1.4.0",
|
||||
@ -4139,7 +4170,6 @@
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
@ -4221,7 +4251,6 @@
|
||||
"version": "3.56.0",
|
||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.56.0.tgz",
|
||||
"integrity": "sha512-fZjdhDOeRcaS+rcpve7XuwHBmktS1nS1gzgghwKUQQ8nTy2FdSDr6ZT8k6YhvlJeHmmQMYiT/IH9hfco5zeW2Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"semver": "^7.3.5"
|
||||
},
|
||||
@ -4257,7 +4286,6 @@
|
||||
"version": "8.4.1",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz",
|
||||
"integrity": "sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"env-paths": "^2.2.0",
|
||||
@ -4282,7 +4310,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz",
|
||||
"integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"delegates": "^1.0.0",
|
||||
@ -4296,7 +4323,6 @@
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz",
|
||||
"integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"aproba": "^1.0.3 || ^2.0.0",
|
||||
@ -4316,7 +4342,6 @@
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz",
|
||||
"integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"are-we-there-yet": "^3.0.0",
|
||||
@ -4332,7 +4357,6 @@
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
@ -4563,7 +4587,6 @@
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",
|
||||
"integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"aggregate-error": "^3.0.0"
|
||||
@ -4654,11 +4677,6 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"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-hstore": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/pg-hstore/-/pg-hstore-2.3.4.tgz",
|
||||
@ -4855,7 +4873,6 @@
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.2.tgz",
|
||||
"integrity": "sha512-UnNke3IQb6sgarcZIDU3gbMeTp/9SSU1DAIkil7PrqG1vZlBtY5msYccSKSHDqa3hNg436IXK+SNImReuA1wEQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.0",
|
||||
"expand-template": "^2.0.3",
|
||||
@ -4894,14 +4911,12 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz",
|
||||
"integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/promise-retry": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz",
|
||||
"integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"err-code": "^2.0.2",
|
||||
@ -4942,7 +4957,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
@ -4984,7 +4998,6 @@
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
||||
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"deep-extend": "^0.6.0",
|
||||
"ini": "~1.3.0",
|
||||
@ -4999,7 +5012,6 @@
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@ -5205,7 +5217,6 @@
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
|
||||
"integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
@ -5347,71 +5358,10 @@
|
||||
"resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz",
|
||||
"integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q=="
|
||||
},
|
||||
"node_modules/sequelize": {
|
||||
"version": "6.37.1",
|
||||
"resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.37.1.tgz",
|
||||
"integrity": "sha512-vIKKzQ9dGp2aBOxQRD1FmUYViuQiKXSJ8yah8TsaBx4U3BokJt+Y2A0qz2C4pj08uX59qpWxRqSLEfRmVOEgQw==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/sequelize"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/debug": "^4.1.8",
|
||||
"@types/validator": "^13.7.17",
|
||||
"debug": "^4.3.4",
|
||||
"dottie": "^2.0.6",
|
||||
"inflection": "^1.13.4",
|
||||
"lodash": "^4.17.21",
|
||||
"moment": "^2.29.4",
|
||||
"moment-timezone": "^0.5.43",
|
||||
"pg-connection-string": "^2.6.1",
|
||||
"retry-as-promised": "^7.0.4",
|
||||
"semver": "^7.5.4",
|
||||
"sequelize-pool": "^7.1.0",
|
||||
"toposort-class": "^1.0.1",
|
||||
"uuid": "^8.3.2",
|
||||
"validator": "^13.9.0",
|
||||
"wkx": "^0.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"ibm_db": {
|
||||
"optional": true
|
||||
},
|
||||
"mariadb": {
|
||||
"optional": true
|
||||
},
|
||||
"mysql2": {
|
||||
"optional": true
|
||||
},
|
||||
"oracledb": {
|
||||
"optional": true
|
||||
},
|
||||
"pg": {
|
||||
"optional": true
|
||||
},
|
||||
"pg-hstore": {
|
||||
"optional": true
|
||||
},
|
||||
"snowflake-sdk": {
|
||||
"optional": true
|
||||
},
|
||||
"sqlite3": {
|
||||
"optional": true
|
||||
},
|
||||
"tedious": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/sequelize-pool": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/sequelize-pool/-/sequelize-pool-7.1.0.tgz",
|
||||
"integrity": "sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg==",
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sequelize-pool/-/sequelize-pool-8.0.0.tgz",
|
||||
"integrity": "sha512-xY04c5ctp6lKE4ZoSVo7YJHN5FHVhoYMoH2Z8jWIJG26c9kJSkIjql5HgD9XG5cwJbYMF0Ko2Fhgws20HC90Ug==",
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
}
|
||||
@ -5501,7 +5451,6 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
|
||||
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@ -5521,7 +5470,6 @@
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
|
||||
"integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@ -5554,7 +5502,6 @@
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 6.0.0",
|
||||
@ -5565,7 +5512,6 @@
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.1.tgz",
|
||||
"integrity": "sha512-B6w7tkwNid7ToxjZ08rQMT8M9BJAf8DKx8Ft4NivzH0zBUfd6jldGcisJn/RLgxcX3FPNDdNQCUEMMT79b+oCQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"ip-address": "^9.0.5",
|
||||
@ -5580,7 +5526,6 @@
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-6.2.1.tgz",
|
||||
"integrity": "sha512-a6KW9G+6B3nWZ1yB8G7pJwL3ggLy1uTzKAgCb7ttblwqdz9fMGJUuTy3uFzEP48FAs9FLILlmzDlE2JJhVQaXQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"agent-base": "^6.0.2",
|
||||
@ -5603,7 +5548,6 @@
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
|
||||
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/sqlite": {
|
||||
@ -5615,7 +5559,6 @@
|
||||
"version": "5.1.7",
|
||||
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.7.tgz",
|
||||
"integrity": "sha512-GGIyOiFaG+TUra3JIfkI/zGP8yZYLPQ0pl1bH+ODjiX57sPhrLU5sQJn1y9bDKZUFYkX1crlrPfSYt0BKKdkog==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bindings": "^1.5.0",
|
||||
@ -5639,7 +5582,6 @@
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz",
|
||||
"integrity": "sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^16 || ^18 || >= 20"
|
||||
}
|
||||
@ -5656,7 +5598,6 @@
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
|
||||
"integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"minipass": "^3.1.1"
|
||||
@ -6019,7 +5960,6 @@
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
|
||||
"integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chownr": "^1.1.1",
|
||||
"mkdirp-classic": "^0.5.2",
|
||||
@ -6030,14 +5970,12 @@
|
||||
"node_modules/tar-fs/node_modules/chownr": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
|
||||
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
|
||||
},
|
||||
"node_modules/tar-stream": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
|
||||
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"bl": "^4.0.3",
|
||||
"end-of-stream": "^1.4.1",
|
||||
@ -6053,7 +5991,6 @@
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
@ -6221,7 +6158,6 @@
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
},
|
||||
@ -6369,7 +6305,6 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz",
|
||||
"integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"unique-slug": "^2.0.0"
|
||||
@ -6379,7 +6314,6 @@
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz",
|
||||
"integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"imurmurhash": "^0.1.4"
|
||||
@ -6445,9 +6379,13 @@
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
|
||||
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
|
||||
"funding": [
|
||||
"https://github.com/sponsors/broofa",
|
||||
"https://github.com/sponsors/ctavan"
|
||||
],
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
@ -6589,14 +6527,6 @@
|
||||
"string-width": "^1.0.2 || 2 || 3 || 4"
|
||||
}
|
||||
},
|
||||
"node_modules/wkx": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/wkx/-/wkx-0.5.0.tgz",
|
||||
"integrity": "sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg==",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sequelize/core": "^7.0.0-alpha.40",
|
||||
"@sequelize/sqlite3": "^7.0.0-alpha.40",
|
||||
"@types/bcrypt": "^5.0.0",
|
||||
"@types/cookie": "^0.5.1",
|
||||
"@types/node": "20.1.7",
|
||||
@ -24,6 +26,7 @@
|
||||
"fetch-cookie": "^3.0.1",
|
||||
"flowbite": "^2.3.0",
|
||||
"flowbite-react": "^0.7.5",
|
||||
"moment": "^2.30.1",
|
||||
"mysql": "^2.18.1",
|
||||
"mysql2": "^3.3.3",
|
||||
"next": "14.1.4",
|
||||
@ -32,7 +35,6 @@
|
||||
"react": "18.2.0",
|
||||
"react-bootstrap": "^2.7.4",
|
||||
"react-dom": "18.2.0",
|
||||
"sequelize": "^6.32.0",
|
||||
"sqlite": "^4.2.1",
|
||||
"tailwindcss": "3.3.2",
|
||||
"ts-node": "^10.9.2",
|
||||
|
||||
@ -3,14 +3,14 @@
|
||||
|
||||
import { validatePassword } from "@/util/Auth";
|
||||
import { APIError } from "@/api/error";
|
||||
import { User, Auth } from "@/model/sequelize/NewModels";
|
||||
import { User } from "@/model/User";
|
||||
|
||||
export function parseBasicAuth(authb64:string):UserAuth
|
||||
{
|
||||
const authString:string = Buffer.from(authb64.split(" ")[1], "base64").toString("utf8");
|
||||
const authString:string = Buffer.from(authb64.split(" ")[1] as any, "base64").toString("utf8");
|
||||
var userAuth:UserAuth = {
|
||||
username:authString.split(":")[0],
|
||||
password:authString.split(":")[1]
|
||||
username:authString.split(":")[0] as any,
|
||||
password:authString.split(":")[1] as any
|
||||
};
|
||||
return userAuth
|
||||
}
|
||||
@ -22,7 +22,6 @@ export type UserAuth = {
|
||||
|
||||
export async function getAssociatedUser(auth:UserAuth)
|
||||
{
|
||||
const username = auth.username;
|
||||
let foundUser = await User.findOne({ attributes: {include: ['password']}, where: {username: auth.username} });
|
||||
|
||||
if (!foundUser)
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import { authenticate } from '@/app/lib/actions'
|
||||
import { serverAttemptAuthenticateUser } from '@/app/lib/actions'
|
||||
import { useFormState, useFormStatus } from "react-dom";
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
|
||||
export default function Page(state:any) {
|
||||
const [loginResult, dispatch] = useFormState(authenticate, undefined)
|
||||
const [loginResult, dispatch] = useFormState(serverAttemptAuthenticateUser, undefined)
|
||||
console.log(dispatch);
|
||||
|
||||
console.log(state);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import AdminPanel from "@/components/admin/adminPanel";
|
||||
import AuthHandler from "@/components/admin/authHandler";
|
||||
import AdminPanel from "@/components/client/admin/adminPanel";
|
||||
import AuthHandler from "@/components/server/admin/authHandler";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
|
||||
|
||||
@ -14,17 +14,10 @@ export async function GET(request:Request, { params }: {params:{slug: string}}){
|
||||
// @ts-ignore
|
||||
cookies().set('name', 'lee');
|
||||
return Response.json({
|
||||
"a": "lorem",
|
||||
"b": params
|
||||
"params": params
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// export default async function handler(req:NextApiRequest, res:NextApiResponse) {
|
||||
// await MPost.sync();
|
||||
// switch (req.method) {
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
'use server'
|
||||
|
||||
import { Model } from "sequelize";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
import { Auth, Post, User } from "@/model/sequelize/NewModels";
|
||||
|
||||
|
||||
import { APIError} from "@/api/error"
|
||||
import { UserAuth, parseBasicAuth, getAssociatedUser } from "@/api/user"
|
||||
import { Auth, User } from "@/model/Models";
|
||||
|
||||
|
||||
async function tryAuth(request:Request){
|
||||
@ -31,15 +28,24 @@ async function tryAuth(request:Request){
|
||||
user_id: user.id,
|
||||
})
|
||||
|
||||
console.log('ok');
|
||||
const foundAuth = await Auth.findOne({
|
||||
include: 'user',
|
||||
include: {
|
||||
model: User,
|
||||
as: 'user'
|
||||
},
|
||||
where: {
|
||||
user_id: user.id
|
||||
}
|
||||
})
|
||||
console.log('ok2');
|
||||
|
||||
if(!foundAuth)
|
||||
return new Response("error",{status:500});
|
||||
|
||||
const usr = foundAuth.user;
|
||||
|
||||
|
||||
|
||||
const authUser = await authentication.getUser();
|
||||
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
'use server'
|
||||
|
||||
import { Model } from "sequelize";
|
||||
import { Model } from "@sequelize/core";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
import { Auth, Post, User } from "@/model/sequelize/NewModels";
|
||||
|
||||
import { Auth } from "@/model/Models";
|
||||
|
||||
|
||||
import { APIError} from "@/api/error"
|
||||
@ -23,9 +24,13 @@ async function tryAuth(request:Request){
|
||||
console.log(koek);
|
||||
const auth = JSON.parse(koek.value);
|
||||
|
||||
const authentication = await Auth.findOne( { include: 'user', where: {token:auth.token} })
|
||||
|
||||
const authentication = await Auth.findOne( { include: {
|
||||
association: Auth.associations.user
|
||||
}, where: { token:auth.token } })
|
||||
|
||||
|
||||
|
||||
if(!authentication)
|
||||
return new Response("unauthorized: invalid token",{status:403});
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use server'
|
||||
|
||||
import { APIError } from "@/api/error";
|
||||
import { Post } from "@/model/sequelize/NewModels";
|
||||
import { Post } from "@/model/Models";
|
||||
|
||||
|
||||
export async function tryFetchPost(request:Request, { params }: {params:{slug: string}}){
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
'use server'
|
||||
|
||||
import { APIError } from "@/api/error";
|
||||
import { Auth, Post, User } from "@/model/Models";
|
||||
import { Auth, Post, PostTag, Tag, User } from "@/model/Models";
|
||||
import { cookies } from "next/headers";
|
||||
import { where } from "sequelize";
|
||||
|
||||
|
||||
|
||||
async function tryCreatePost(request: Request) {
|
||||
|
||||
// Make sure the DB is ready
|
||||
await PostTag.sync();
|
||||
await Tag.sync();
|
||||
await Post.sync();
|
||||
|
||||
// Prepare data
|
||||
@ -24,7 +25,7 @@ async function tryCreatePost(request: Request) {
|
||||
const authObject = JSON.parse(cookieJSON);
|
||||
|
||||
// Fetch User Auth from the database
|
||||
const auth = await Auth.findOne({ include: 'user', where: { token: authObject.token } });
|
||||
const auth:any = await Auth.findOne({ include: 'user', where: { token: authObject.token } });
|
||||
|
||||
// Sanity check the auth and associated user
|
||||
if (!auth || !auth.user) throw new APIError({ status: 401, responseText: "Authentication Error" });
|
||||
@ -35,6 +36,7 @@ async function tryCreatePost(request: Request) {
|
||||
if (!requestBody.title) throw new APIError({ status: 500, responseText: "Missing post title" });
|
||||
if (!requestBody.content) throw new APIError({ status: 500, responseText: "Missing post content" });
|
||||
if (!user.id) throw new APIError({ status: 500, responseText: "Missing user id" });
|
||||
if (!user.perms || !user.perms.isAdmin) throw new APIError({ status: 401, responseText: "Unauthorized" });
|
||||
|
||||
// Create a new Post in the database
|
||||
const post = await Post.create(
|
||||
@ -42,8 +44,11 @@ async function tryCreatePost(request: Request) {
|
||||
content: requestBody.content,
|
||||
user_id: user.id,
|
||||
title: requestBody.title,
|
||||
date: Date.now()
|
||||
},{include: "user"})
|
||||
},{
|
||||
include: {
|
||||
association: Post.associations.user
|
||||
}
|
||||
}).then(post=>post.reload())
|
||||
// // Find the post (Unneeded but nice to check)
|
||||
// const foundPost = await Post.findOne({
|
||||
// include: "user",
|
||||
@ -52,7 +57,7 @@ async function tryCreatePost(request: Request) {
|
||||
// }
|
||||
// })
|
||||
|
||||
return new Response(JSON.stringify(Post), { status: 200 });
|
||||
return new Response(JSON.stringify(post), { status: 200 });
|
||||
|
||||
}
|
||||
|
||||
@ -76,9 +81,12 @@ async function tryFetchPosts(request: Request) {
|
||||
await Post.sync();
|
||||
|
||||
const foundPosts = await Post.findAll({
|
||||
include: [{
|
||||
association: 'user',
|
||||
include: [
|
||||
{
|
||||
association: Post.associations.user,
|
||||
attributes: { exclude: ['password', 'createdAt', 'updatedAt'] }
|
||||
},{
|
||||
association: Post.associations.postTags
|
||||
}]
|
||||
});
|
||||
|
||||
|
||||
@ -1,41 +1,48 @@
|
||||
'use server'
|
||||
|
||||
import { User, Auth, Post, UserPerms } from "@/model/sequelize/NewModels"
|
||||
|
||||
/* =================================================================================================
|
||||
*
|
||||
* Copyright 2024 Andreas Schaafsma
|
||||
* Purpose: Handle API requests that fetch or permute User data
|
||||
*
|
||||
* ================================================================================================= */
|
||||
|
||||
import { APIError } from "@/api/error";
|
||||
import { UserAuth } from "@/api/user";
|
||||
import { UserPerms, User, Auth } from "@/model/Models"; // Do not alter "unused" imports, they are required to perform the nescessairy includes on the User model
|
||||
import { hashPassword } from "@/util/Auth";
|
||||
|
||||
|
||||
|
||||
async function tryRegister(request:Request){
|
||||
// Attempt to register a new User
|
||||
async function attemptRegister(request:Request){
|
||||
|
||||
// Sync User model
|
||||
User.sync();
|
||||
|
||||
// Get request body
|
||||
const requestBody:Partial<UserAuth> = await request.json();
|
||||
|
||||
// Handle edgecases
|
||||
if(!requestBody) throw new APIError({status:500,responseText: "Request Body is Empty"})
|
||||
if(!requestBody.username) throw new APIError({status:500,responseText: "No username specified"})
|
||||
if(!requestBody.password) throw new APIError({status:500,responseText: "No password specified"})
|
||||
|
||||
// Try to get user from database
|
||||
const dbUser = await User.findOne({where:{username:requestBody.username}});
|
||||
|
||||
// If it exists we throw an error
|
||||
if(dbUser) throw new APIError({status:500,responseText: "Username unavailable, try another"});
|
||||
|
||||
const hash = await hashPassword(requestBody.password);
|
||||
// Hash the password and create a new user in the database
|
||||
const user = await User.create({
|
||||
username: requestBody.username,
|
||||
password: hash,
|
||||
password: await hashPassword(requestBody.password),
|
||||
perms:{
|
||||
isAdmin: false
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
include: [{
|
||||
association: 'perms'
|
||||
association: User.associations.perms
|
||||
}]
|
||||
})
|
||||
|
||||
}).then(user=>user.reload());
|
||||
// Return the HTTP response
|
||||
return new Response(
|
||||
JSON.stringify(
|
||||
{
|
||||
@ -52,7 +59,7 @@ async function tryRegister(request:Request){
|
||||
|
||||
export async function POST(request:Request){
|
||||
try{
|
||||
return await tryRegister(request);
|
||||
return await attemptRegister(request);
|
||||
}
|
||||
catch(e){
|
||||
if (e instanceof APIError){
|
||||
@ -65,23 +72,9 @@ export async function POST(request:Request){
|
||||
}
|
||||
}
|
||||
|
||||
async function tryGetUsers(request:Request){
|
||||
|
||||
const defaultScope:any = User.scope('defaultScope');
|
||||
|
||||
const mergedInclude = defaultScope.include ? [defaultScope.include] : [];
|
||||
mergedInclude.push({ association: 'authtokens' });
|
||||
|
||||
// const mergedInclude = [...defaultScope.include, { association: 'authtokens' }];
|
||||
|
||||
const users = await User.findAll(
|
||||
{
|
||||
attributes: defaultScope.attributes,
|
||||
include: mergedInclude,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
async function attemptGetUsers(request:Request){
|
||||
// Get users with scopes applied
|
||||
const users = await User.withScope(['defaultScope','withPerms','withAuthtokens']).findAll();
|
||||
return new Response(
|
||||
JSON.stringify(
|
||||
{
|
||||
@ -98,7 +91,7 @@ async function tryGetUsers(request:Request){
|
||||
|
||||
export async function GET(request:Request){
|
||||
try{
|
||||
return await tryGetUsers(request);
|
||||
return await attemptGetUsers(request);
|
||||
}
|
||||
catch(e){
|
||||
if (e instanceof APIError){
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
import Header from "@/components/header";
|
||||
import PageContainer from "@/components/page-container";
|
||||
import Navbar from "@/components/navbar";
|
||||
import Sidebar from "@/components/sidebar";
|
||||
import Article from "@/components/news/article";
|
||||
import ArticlePreview from "@/components/news/article-preview"
|
||||
import Header from "@/components/shared/header";
|
||||
import PageContainer from "@/components/shared/page-container";
|
||||
import Navbar from "@/components/shared/navbar";
|
||||
import Sidebar from "@/components/shared/sidebar";
|
||||
import Article from "@/components/shared/news/article";
|
||||
import ArticlePreview from "@/components/shared/news/article-preview"
|
||||
|
||||
import ReactDOM from "react";
|
||||
|
||||
import "/public/global.css"
|
||||
import "@/app/index.css"
|
||||
import { Post, User } from "@/model/sequelize/NewModels";
|
||||
import { Attributes } from "sequelize";
|
||||
|
||||
import { Post } from "@/model/Post";
|
||||
import { Attributes } from "@sequelize/core";
|
||||
import { DeepPartial } from "@/util/DeepPartial";
|
||||
|
||||
|
||||
type DeepPartial<T> = T extends object ? {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
} : T;
|
||||
|
||||
async function getData(slug:string):Promise<DeepPartial<Post>> {
|
||||
async function getData(slug:string):Promise<Attributes<Post>> {
|
||||
// Get all posts from the API
|
||||
const res = await fetch(`http://localhost:3000/api/post/${slug}`);
|
||||
// The return value is *not* serialized
|
||||
@ -31,7 +31,7 @@ async function getData(slug:string):Promise<DeepPartial<Post>> {
|
||||
|
||||
export default async function Page({ params }: {params: {slug:string}}) {
|
||||
const { slug } = params;
|
||||
const post:DeepPartial<Attributes<Post>> = await getData(slug);
|
||||
const post:Attributes<Post> = await getData(slug);
|
||||
console.log(post);
|
||||
|
||||
|
||||
|
||||
@ -5,27 +5,30 @@ import { constructAPIUrl } from "@/util/Utils"
|
||||
import { cookies } from "next/headers"
|
||||
import { parseSetCookie } from "@/util/parseSetCookie";
|
||||
import makeFetchCookie from 'fetch-cookie';
|
||||
import fetchCookie from "fetch-cookie";
|
||||
|
||||
type LoginReturn = {
|
||||
cookie?:unknown,
|
||||
errorMessage?:string;
|
||||
}
|
||||
|
||||
async function signIn(method:string,b:FormData):Promise<LoginReturn|null>
|
||||
async function attemptAPILogin(method:string,b:FormData):Promise<LoginReturn|null>
|
||||
{
|
||||
console.log("form data:");
|
||||
console.log(b);
|
||||
|
||||
if(!b || !b.get('input_username') || !b.get('input_password')) return null;
|
||||
let headers:Headers = new Headers();
|
||||
const fetchCookie = makeFetchCookie(fetch)
|
||||
headers.set('Authorization', 'Basic ' + Buffer.from(b.get('input_username') + ":" + b.get('input_password')).toString('base64'));
|
||||
let res = await fetchCookie(constructAPIUrl("auth"), {
|
||||
const { CookieJar, Cookie } = fetchCookie.toughCookie;
|
||||
const cj = new CookieJar()
|
||||
const fetchKoek = makeFetchCookie(fetch, cj);
|
||||
// Set Basic Auth
|
||||
headers.set('Authorization', `Basic ${Buffer.from(`${b.get('input_username')}:${b.get('input_password')}`).toString('base64')}`);
|
||||
let res = await fetchKoek(constructAPIUrl("auth"), {
|
||||
method:'POST',
|
||||
credentials: 'include',
|
||||
headers:headers,
|
||||
});
|
||||
|
||||
console.log(cj.store.idx['localhost']['/']);
|
||||
// if(res.headers.get('set-coo')) console.log(res.headers['set-cookie'])
|
||||
let koek = res.headers.getSetCookie();
|
||||
// console.log("api koek:" + koek.map((k)=>decodeURIComponent(k)));
|
||||
@ -40,11 +43,11 @@ async function signIn(method:string,b:FormData):Promise<LoginReturn|null>
|
||||
// console.log(koek);
|
||||
}
|
||||
|
||||
export async function authenticate(_currentState: unknown, formData: FormData):Promise<LoginReturn|null>
|
||||
export async function serverAttemptAuthenticateUser(_currentState: unknown, formData: FormData):Promise<LoginReturn|null>
|
||||
{
|
||||
console.log("action triggered")
|
||||
try {
|
||||
const signInStatus = await signIn('credentials', formData)
|
||||
const signInStatus = await attemptAPILogin('credentials', formData)
|
||||
return signInStatus;
|
||||
} catch (error:any) {
|
||||
if (error) {
|
||||
@ -62,10 +65,9 @@ export async function authenticate(_currentState: unknown, formData: FormData):P
|
||||
throw error
|
||||
}
|
||||
}
|
||||
export async function koekValid(koek:string):Promise<boolean>
|
||||
{
|
||||
|
||||
|
||||
export async function serverValidateSessionCookie(koek:string):Promise<boolean>
|
||||
{
|
||||
const validateSession = await fetch(constructAPIUrl("auth/validate"),{
|
||||
method:"POST",
|
||||
headers:{
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
import Header from "@/components/header";
|
||||
import PageContainer from "@/components/page-container";
|
||||
import Navbar from "@/components/navbar";
|
||||
import Sidebar from "@/components/sidebar";
|
||||
import ArticlePreview from "@/components/news/article-preview"
|
||||
import Header from "@/components/shared/header";
|
||||
import PageContainer from "@/components/shared/page-container";
|
||||
import Navbar from "@/components/shared/navbar";
|
||||
import Sidebar from "@/components/shared/sidebar";
|
||||
import ArticlePreview from "@/components/shared/news/article-preview"
|
||||
import ReactDOM from "react";
|
||||
import "/public/global.css"
|
||||
import "./index.css"
|
||||
import { Post, PostAttributes } from "@/model/sequelize/NewModels";
|
||||
import { Post } from "@/model/Post";
|
||||
import { constructAPIUrl } from "@/util/Utils";
|
||||
import Link from "next/link";
|
||||
import { Attributes } from "@sequelize/core";
|
||||
|
||||
type DeepPartial<T> = T extends object ? {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
@ -18,7 +19,7 @@ export default async function Test() {
|
||||
|
||||
const response = await fetch(constructAPIUrl('post'));
|
||||
|
||||
const articles:Array<DeepPartial<PostAttributes>> = await response.json();
|
||||
const articles:Array<Attributes<Post>> = await response.json();
|
||||
|
||||
return <div className={`root`}>
|
||||
<Header/>
|
||||
@ -32,9 +33,8 @@ export default async function Test() {
|
||||
</Sidebar> */}
|
||||
<main>
|
||||
{articles.map((article, i) => {
|
||||
console.log("Entered");
|
||||
// Return the element. Also pass key
|
||||
return (<ArticlePreview id={article?.id?.toString()} content={article?.content} title={article?.title}></ArticlePreview>)
|
||||
return (<ArticlePreview key={article?.id} id={article?.id?.toString()} content={article?.content} title={article?.title}></ArticlePreview>)
|
||||
})}
|
||||
</main>
|
||||
</PageContainer>
|
||||
|
||||
@ -1,17 +1,30 @@
|
||||
import Header from "@/components/header";
|
||||
import PageContainer from "@/components/page-container";
|
||||
import Navbar from "@/components/navbar";
|
||||
import Sidebar from "@/components/sidebar";
|
||||
import ArticlePreview from "@/components/news/article-preview"
|
||||
import ReactDOM from "react";
|
||||
// import components
|
||||
import Header from "@/components/shared/header";
|
||||
import PageContainer from "@/components/shared/page-container";
|
||||
import Navbar from "@/components/shared/navbar";
|
||||
import Sidebar from "@/components/shared/sidebar";
|
||||
import ArticlePreview from "@/components/shared/news/article-preview"
|
||||
// import styles
|
||||
import "public/global.css"
|
||||
import "@/app/index.css"
|
||||
// import other shit
|
||||
import ReactDOM, { ReactNode } from "react";
|
||||
|
||||
type Props = {
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
|
||||
export default function Page() {
|
||||
return <div className={`root`}>
|
||||
<Header/>
|
||||
<Navbar/>
|
||||
|
||||
export default function Page(props: Props) {
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className={`root`}>
|
||||
<Header />
|
||||
<Navbar />
|
||||
<PageContainer>
|
||||
<Sidebar>
|
||||
<h1>
|
||||
@ -20,10 +33,10 @@ export default function Page() {
|
||||
<ul><li>filter 1</li><li>filter 2</li><li>filter 3</li></ul>
|
||||
</Sidebar>
|
||||
<main>
|
||||
<ArticlePreview/>
|
||||
<ArticlePreview/>
|
||||
<ArticlePreview/>
|
||||
<ArticlePreview />
|
||||
<ArticlePreview />
|
||||
<ArticlePreview />
|
||||
</main>
|
||||
</PageContainer>
|
||||
</div>;
|
||||
</div>);
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
import Header from "@/components/header";
|
||||
import PageContainer from "@/components/page-container";
|
||||
import PageContainer from "@/components/shared/page-container";
|
||||
import Navbar from "@/components/navbar";
|
||||
import Sidebar from "@/components/sidebar";
|
||||
import Sidebar from "@/components/shared/sidebar";
|
||||
import ArticlePreview from "@/components/news/article-preview"
|
||||
import ReactDOM from "react";
|
||||
import "public/global.css"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
import { ReactNode, useContext } from "react";
|
||||
import { AuthContext, AuthProps } from "@/providers/providers";
|
||||
import SomeServerSubComponent from "./serverContextUserTest";
|
||||
import SomeServerSubComponent from "@/components/server/admin/serverContextUserTest";
|
||||
|
||||
interface Props {
|
||||
children?: ReactNode;
|
||||
@ -1,9 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { authenticate } from "@/app/lib/actions";
|
||||
import { serverAttemptAuthenticateUser } from "@/app/lib/actions";
|
||||
import { AuthContext } from "@/providers/providers";
|
||||
import { constructAPIUrl } from "@/util/Utils";
|
||||
import { cookies } from "next/headers";
|
||||
import { createContext, useState } from "react";
|
||||
import { useFormState, useFormStatus } from "react-dom";
|
||||
|
||||
@ -15,11 +14,7 @@ import { useFormState, useFormStatus } from "react-dom";
|
||||
|
||||
|
||||
export default function LoginForm(){
|
||||
const [loginResult, dispatch] = useFormState(authenticate, undefined);
|
||||
|
||||
// if(loginResult?.cookie && loginResult.cookie && loginResult.cookie['auth']){
|
||||
// cookies().set('auth', loginResult.cookie['auth'])
|
||||
// }
|
||||
const [loginResult, dispatch] = useFormState(serverAttemptAuthenticateUser, undefined);
|
||||
|
||||
return (
|
||||
<form className="bg-background-400 border-4 border-primary-500 drop-shadow-md w-fit p-3 rounded-lg flex flex-col gap-1" action={dispatch}>
|
||||
@ -1,13 +1,14 @@
|
||||
'use server'
|
||||
import { cookies } from "next/headers";
|
||||
// import { useState } from "react";
|
||||
import LoginForm from "./loginForm";
|
||||
import { koekValid } from "@/app/lib/actions";
|
||||
|
||||
import LoginForm from "@/components/client/admin/loginForm";
|
||||
import AdminPanel from "@/components/client/admin/adminPanel";
|
||||
import ClientAuthHandler from "@/components/client/admin/clientAuthHandler";
|
||||
|
||||
import { serverValidateSessionCookie } from "@/app/lib/actions";
|
||||
import { constructAPIUrl } from "@/util/Utils";
|
||||
import AdminPanel from "./adminPanel";
|
||||
import { ReactNode } from "react";
|
||||
import { AuthContext, AuthProps } from "@/providers/providers";
|
||||
import ClientAuthHandler from "./clientAuthHandler";
|
||||
|
||||
|
||||
interface Props {
|
||||
@ -17,10 +18,9 @@ interface Props {
|
||||
} // We interfacing lads
|
||||
|
||||
|
||||
|
||||
export default async function AuthHandler(props: Props) {
|
||||
const protoKoek = await cookies().get('auth')?.value;
|
||||
const koek = decodeURIComponent(protoKoek?protoKoek:"");
|
||||
const koek = decodeURIComponent(protoKoek ? protoKoek: "");
|
||||
console.log("koekje:" + koek)
|
||||
let p:AuthProps = {
|
||||
test:"not pog"
|
||||
@ -41,7 +41,7 @@ export default async function AuthHandler(props: Props) {
|
||||
|
||||
return (
|
||||
<div className="flex flex-row">
|
||||
{!(koek && await koekValid(koek)) ? <LoginForm>{ }</LoginForm> : <ClientAuthHandler authProps={p}><section>{props.children}<div>signed in! :D</div></section></ClientAuthHandler>}
|
||||
{!(koek && await serverValidateSessionCookie(koek)) ? <LoginForm>{ }</LoginForm> : <ClientAuthHandler authProps={p}><section>{props.children}<div>signed in! :D</div></section></ClientAuthHandler>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -8,6 +8,8 @@ interface Props {
|
||||
|
||||
export default function SomeServerSubComponent(props:Props){
|
||||
let { test, auth } = useContext(AuthContext);
|
||||
|
||||
|
||||
return (
|
||||
<span>{test}{JSON.stringify(auth)}</span>
|
||||
);
|
||||
@ -1,5 +1,5 @@
|
||||
import Tagbar from "@/components/news/tagbar";
|
||||
import styles from "./article-preview.module.css"
|
||||
import Tagbar from "@/components/shared/news/tagbar";
|
||||
import styles from "@/components/shared/news/article-preview.module.css"
|
||||
|
||||
import bg from "public/placeholder-square.png"
|
||||
import { ReactNode } from "react"
|
||||
@ -1,4 +1,4 @@
|
||||
import Tagbar from "@/components/news/tagbar";
|
||||
import Tagbar from "@/components/shared/news/tagbar";
|
||||
import "/public/global.css"
|
||||
import "@/app/index.css"
|
||||
import styles from "./article.module.css"
|
||||
42
src/model/APIKey.ts
Normal file
42
src/model/APIKey.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import { Association, CreationOptional, DataTypes, HasManyGetAssociationsMixin, HasOneCreateAssociationMixin, HasOneGetAssociationMixin, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize } from "@sequelize/core";
|
||||
import {
|
||||
PrimaryKey,
|
||||
Attribute,
|
||||
AutoIncrement,
|
||||
NotNull,
|
||||
BelongsTo,
|
||||
Unique,
|
||||
HasMany,
|
||||
HasOne,
|
||||
UpdatedAt,
|
||||
CreatedAt,
|
||||
} from '@sequelize/core/decorators-legacy';
|
||||
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
|
||||
|
||||
export class APIKey extends Model<InferAttributes<APIKey>, InferCreationAttributes<APIKey>>{
|
||||
// Attributes
|
||||
@Attribute(DataTypes.INTEGER)
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Unique
|
||||
declare id: number;
|
||||
@Attribute(DataTypes.UUID)
|
||||
declare key: string;
|
||||
@Attribute(DataTypes.BOOLEAN)
|
||||
declare isAdminKey: boolean
|
||||
|
||||
// Date thingies
|
||||
@CreatedAt
|
||||
declare createdAt: CreationOptional<Date>;
|
||||
@UpdatedAt
|
||||
declare updatedAt: CreationOptional<Date>;
|
||||
|
||||
}
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite',
|
||||
models: [APIKey]
|
||||
});
|
||||
@ -1,37 +1,54 @@
|
||||
import { Association, BelongsToGetAssociationMixin, CreationOptional, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, Sequelize, UUIDV4 } from "sequelize";
|
||||
import {
|
||||
Sequelize,
|
||||
DataTypes,
|
||||
Model,
|
||||
InferAttributes,
|
||||
InferCreationAttributes,
|
||||
CreationOptional,
|
||||
sql,
|
||||
BelongsToGetAssociationMixin,
|
||||
Association,
|
||||
NonAttribute,
|
||||
} from '@sequelize/core';
|
||||
|
||||
import { User } from "./User";
|
||||
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: 'db.sqlite'
|
||||
});
|
||||
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
import { Attribute, AutoIncrement, BelongsTo, Default, NotNull, PrimaryKey, Table, Unique } from "@sequelize/core/decorators-legacy";
|
||||
|
||||
@Table({
|
||||
tableName: 'Auths'
|
||||
})
|
||||
export class Auth extends Model<InferAttributes<Auth>, InferCreationAttributes<Auth>> {
|
||||
|
||||
@Attribute(DataTypes.INTEGER)
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Unique
|
||||
declare id: CreationOptional<number>;
|
||||
|
||||
@Attribute(DataTypes.UUIDV4)
|
||||
@Default(sql.uuidV4)
|
||||
declare token: CreationOptional<string>;
|
||||
declare user_id:ForeignKey<User['id']>;
|
||||
|
||||
@Attribute(DataTypes.INTEGER)
|
||||
@NotNull
|
||||
declare user_id:number;
|
||||
|
||||
@BelongsTo( ()=>User, { foreignKey: 'user_id', inverse: { type: 'hasMany', as: 'authtokens' } } )
|
||||
declare user?: NonAttribute<User>
|
||||
|
||||
|
||||
declare getUser: BelongsToGetAssociationMixin<User>;
|
||||
declare static associations: {
|
||||
user: Association<User, Auth>;
|
||||
};
|
||||
}
|
||||
|
||||
Auth.init({
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
unique: true,
|
||||
},
|
||||
token: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: UUIDV4
|
||||
}
|
||||
},
|
||||
{
|
||||
tableName: 'Auths',
|
||||
sequelize // passing the `sequelize` instance is required
|
||||
});
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite',
|
||||
models: [Auth]
|
||||
});
|
||||
|
||||
@ -1,20 +1,15 @@
|
||||
import {
|
||||
Association, DataTypes, HasManyAddAssociationMixin, HasManyCountAssociationsMixin,
|
||||
HasManyCreateAssociationMixin, HasManyGetAssociationsMixin, HasManyHasAssociationMixin,
|
||||
HasManySetAssociationsMixin, HasManyAddAssociationsMixin, HasManyHasAssociationsMixin,
|
||||
HasManyRemoveAssociationMixin, HasManyRemoveAssociationsMixin, Model, ModelDefined, Optional,
|
||||
Sequelize, InferAttributes, InferCreationAttributes, CreationOptional, NonAttribute, ForeignKey, BelongsTo, BelongsToGetAssociationMixin, UUIDV4, UUID,
|
||||
VirtualDataType,
|
||||
HasOneGetAssociationMixin,
|
||||
HasOneCreateAssociationMixin
|
||||
} from 'sequelize';
|
||||
|
||||
import { UserPerms } from './UserPerms';
|
||||
import { Auth } from './Auth';
|
||||
import { Post } from './Post';
|
||||
import { User } from './User';
|
||||
import { Auth } from './Auth';
|
||||
import { UserPerms } from './UserPerms';
|
||||
import { Post } from './Post';
|
||||
import { Tag } from './Tag';
|
||||
import { PostTag } from './PostTag';
|
||||
|
||||
User.sync();
|
||||
Auth.sync();
|
||||
UserPerms.sync();
|
||||
PostTag.sync();
|
||||
Tag.sync();
|
||||
Post.sync();
|
||||
|
||||
|
||||
|
||||
export { User, Auth, Post, UserPerms }
|
||||
export { User, Auth, UserPerms, Post, Tag, PostTag }
|
||||
@ -1,56 +1,53 @@
|
||||
import { Association, BelongsToGetAssociationMixin, DataTypes, ForeignKey, Model, NonAttribute, Sequelize } from "sequelize";
|
||||
import { User } from "./User";
|
||||
import { Association, BelongsToGetAssociationMixin, CreationOptional, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize } from "@sequelize/core";import { User } from "./User";
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: 'db.sqlite'
|
||||
});
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
import { Attribute, AutoIncrement, BelongsTo, BelongsToMany, CreatedAt, HasMany, NotNull, PrimaryKey, Unique, UpdatedAt } from "@sequelize/core/decorators-legacy";
|
||||
import { Tag } from "./Tag";
|
||||
import { PostTag } from "./PostTag";
|
||||
|
||||
export type PostAttributes = {
|
||||
id: number;
|
||||
title: string;
|
||||
content: string;
|
||||
date: number;
|
||||
user_id:ForeignKey<User['id']>;
|
||||
}
|
||||
export type PostCreationAttributes = {
|
||||
title: string;
|
||||
content: string;
|
||||
date: number;
|
||||
user_id:number;
|
||||
}
|
||||
export class Post extends Model<PostAttributes, PostCreationAttributes> {
|
||||
declare id: number;
|
||||
declare user:NonAttribute<User>;
|
||||
export class Post extends Model<InferAttributes<Post>, InferCreationAttributes<Post>> {
|
||||
|
||||
|
||||
// Attributes
|
||||
@Attribute(DataTypes.INTEGER)
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Unique
|
||||
declare id: CreationOptional<number>;
|
||||
@Attribute(DataTypes.INTEGER)
|
||||
@NotNull
|
||||
declare user_id:ForeignKey<User['id']>;
|
||||
@Attribute(DataTypes.STRING)
|
||||
declare title:string
|
||||
@Attribute(DataTypes.STRING)
|
||||
declare content:string
|
||||
|
||||
// Date thingies
|
||||
@CreatedAt
|
||||
declare createdAt: CreationOptional<Date>;
|
||||
@UpdatedAt
|
||||
declare updatedAt: CreationOptional<Date>;
|
||||
|
||||
|
||||
|
||||
// Associatoins
|
||||
|
||||
@BelongsTo(()=>User, { foreignKey: 'user_id', inverse: { type: 'hasMany', as: 'posts' } })
|
||||
declare user:NonAttribute<User>;
|
||||
|
||||
@BelongsToMany(()=>Tag, { through: { model: ()=>PostTag, unique: false}, inverse: {as: 'taggedPosts'} })
|
||||
declare postTags?:NonAttribute<Tag[]>;
|
||||
|
||||
declare getUser: BelongsToGetAssociationMixin<User>;
|
||||
|
||||
declare static associations: {
|
||||
user: Association<User, Post>;
|
||||
postTags: Association<Tag, Post>;
|
||||
};
|
||||
}
|
||||
|
||||
Post.init(
|
||||
{
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
unique: true,
|
||||
},
|
||||
content: {
|
||||
type: DataTypes.STRING
|
||||
},
|
||||
title: {
|
||||
type: DataTypes.STRING
|
||||
},
|
||||
date: {
|
||||
type: DataTypes.DATE
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
tableName: 'Posts',
|
||||
sequelize // passing the `sequelize` instance is required
|
||||
}
|
||||
);
|
||||
const sequelize = new Sequelize({
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite',
|
||||
models: [Post]
|
||||
})
|
||||
20
src/model/PostTag.ts
Normal file
20
src/model/PostTag.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import Sequelize, { Association, DataTypes, InferAttributes, InferCreationAttributes, Model, NonAttribute } from "@sequelize/core";
|
||||
import { Attribute, AutoIncrement, NotNull, PrimaryKey, Unique } from "@sequelize/core/decorators-legacy";
|
||||
import { Post } from "./Post";
|
||||
import { Tag } from "./Tag";
|
||||
import { SqliteDialect } from "@sequelize/sqlite3";
|
||||
|
||||
|
||||
class PostTag extends Model<InferAttributes<PostTag>,InferCreationAttributes<PostTag>>
|
||||
{
|
||||
declare postId:number;
|
||||
declare tagId:number;
|
||||
}
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite',
|
||||
models: [PostTag]
|
||||
})
|
||||
|
||||
export { PostTag }
|
||||
56
src/model/Project.ts
Normal file
56
src/model/Project.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import { Association, BelongsToGetAssociationMixin, CreationOptional, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize } from "@sequelize/core";import { User } from "./User";
|
||||
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite'
|
||||
});
|
||||
export type ProjectAttributes = {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
date: number;
|
||||
user_id:ForeignKey<User['id']>;
|
||||
}
|
||||
export type ProjectCreationAttributes = {
|
||||
title: string;
|
||||
description: string;
|
||||
date: number;
|
||||
user_id:number;
|
||||
}
|
||||
export class Project extends Model<ProjectAttributes, ProjectCreationAttributes> {
|
||||
declare id: number;
|
||||
declare user:NonAttribute<User>;
|
||||
declare user_id:ForeignKey<User['id']>;
|
||||
declare getUser: BelongsToGetAssociationMixin<User>;
|
||||
declare static associations: {
|
||||
user: Association<User, Project>;
|
||||
};
|
||||
}
|
||||
|
||||
Project.init(
|
||||
{
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
unique: true,
|
||||
},
|
||||
content: {
|
||||
type: DataTypes.STRING
|
||||
},
|
||||
title: {
|
||||
type: DataTypes.STRING
|
||||
},
|
||||
date: {
|
||||
type: DataTypes.DATE
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
tableName: 'Projects',
|
||||
sequelize // passing the `sequelize` instance is required
|
||||
}
|
||||
);
|
||||
28
src/model/Tag.ts
Normal file
28
src/model/Tag.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { Association, BelongsToGetAssociationMixin, BelongsToManyGetAssociationsMixin, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize } from "@sequelize/core";
|
||||
import { Post } from "./Post";
|
||||
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
import { Attribute, AutoIncrement, BelongsToMany, PrimaryKey, Unique } from "@sequelize/core/decorators-legacy";
|
||||
|
||||
export class Tag extends Model<InferAttributes<Tag>, InferCreationAttributes<Tag>> {
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Attribute(DataTypes.INTEGER)
|
||||
@Unique
|
||||
declare id: number;
|
||||
|
||||
/** Defined by {@link Post.postTags} */
|
||||
declare taggedPosts?:NonAttribute<Post[]>;
|
||||
|
||||
declare user_id:ForeignKey<Tag>;
|
||||
declare getPost: BelongsToManyGetAssociationsMixin<Tag>;
|
||||
declare static associations: {
|
||||
posts: Association<Post, Tag>;
|
||||
};
|
||||
}
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite',
|
||||
models: [Tag]
|
||||
})
|
||||
@ -1,91 +1,85 @@
|
||||
import { Association, DataTypes, HasManyGetAssociationsMixin, HasOneCreateAssociationMixin, HasOneGetAssociationMixin, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize } from "sequelize";
|
||||
import { Association, Attributes, CreationAttributes, CreationOptional, DataTypes, HasManyGetAssociationsMixin, HasOneCreateAssociationMixin, HasOneGetAssociationMixin, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize } from "@sequelize/core";
|
||||
import { Post } from "./Post";
|
||||
import { UserPerms } from "./UserPerms";
|
||||
import { Auth } from "./Auth";
|
||||
import {
|
||||
PrimaryKey,
|
||||
Attribute,
|
||||
AutoIncrement,
|
||||
NotNull,
|
||||
BelongsTo,
|
||||
Unique,
|
||||
HasMany,
|
||||
HasOne,
|
||||
UpdatedAt,
|
||||
CreatedAt,
|
||||
} from '@sequelize/core/decorators-legacy';
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: 'db.sqlite'
|
||||
});
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
|
||||
type UserCreationAttributes = {
|
||||
username:string;
|
||||
password:string;
|
||||
perms?:Partial<InferAttributes<UserPerms>>
|
||||
}
|
||||
|
||||
export class User extends Model<InferAttributes<User>, InferCreationAttributes<User>>{
|
||||
declare id: number|null;
|
||||
|
||||
@Attribute(DataTypes.INTEGER)
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Unique
|
||||
declare id: CreationOptional<number>;
|
||||
@Attribute(DataTypes.STRING)
|
||||
declare username: string;
|
||||
@Attribute(DataTypes.STRING)
|
||||
declare password: string;
|
||||
|
||||
// Date thingies
|
||||
|
||||
@CreatedAt
|
||||
declare createdAt: CreationOptional<Date>;
|
||||
@UpdatedAt
|
||||
declare updatedAt: CreationOptional<Date>;
|
||||
|
||||
// Associations
|
||||
declare getAuthTokens:HasManyGetAssociationsMixin<Auth>;
|
||||
declare getPosts:HasManyGetAssociationsMixin<Post>;
|
||||
declare getPerms:HasOneGetAssociationMixin<UserPerms>;
|
||||
declare createPerms:HasOneCreateAssociationMixin<UserPerms>;
|
||||
declare perms?:NonAttribute<UserPerms>
|
||||
|
||||
/** Defined by {@link Auth.user} */
|
||||
declare authtokens?:NonAttribute<Auth[]>
|
||||
/** Defined by {@link UserPerms.user} */
|
||||
declare perms?:CreationOptional<Partial<CreationAttributes<UserPerms>>>
|
||||
/** Defined by {@link Post.user} */
|
||||
declare posts?:CreationOptional<Post[]>
|
||||
|
||||
declare static associations: {
|
||||
perms: Association<UserPerms,User>;
|
||||
posts: Association<Post,User>
|
||||
authtokens: Association<Auth,User>;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
User.init(
|
||||
{
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
unique: true,
|
||||
},
|
||||
username: {
|
||||
allowNull: false,
|
||||
type: DataTypes.STRING,
|
||||
},
|
||||
password: {
|
||||
allowNull: false,
|
||||
type: DataTypes.STRING,
|
||||
},
|
||||
},
|
||||
{
|
||||
defaultScope: {
|
||||
attributes: {
|
||||
exclude: ['password'],
|
||||
},
|
||||
include: [{ association: 'perms' }],
|
||||
},
|
||||
tableName: 'Users',
|
||||
sequelize // passing the `sequelize` instance is required
|
||||
const sequelize = new Sequelize({
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite',
|
||||
models: [User]
|
||||
});
|
||||
|
||||
|
||||
User.addScope('defaultScope',{
|
||||
attributes: {
|
||||
exclude: ['password', 'createdAt', 'updatedAt'],
|
||||
}
|
||||
);
|
||||
|
||||
Auth.belongsTo(User, {
|
||||
foreignKey:'user_id',
|
||||
targetKey:'id',
|
||||
as: 'user',
|
||||
})
|
||||
User.hasMany(Auth, {
|
||||
sourceKey: 'id',
|
||||
foreignKey: 'user_id',
|
||||
as: 'authtokens' // this determines the name in `associations`!
|
||||
});
|
||||
Post.belongsTo(User, {
|
||||
foreignKey:'user_id',
|
||||
targetKey:'id',
|
||||
as: 'user'
|
||||
})
|
||||
User.hasMany(Post, {
|
||||
sourceKey: 'id',
|
||||
foreignKey: 'user_id',
|
||||
as: 'posts' // this determines the name in `associations`!
|
||||
});
|
||||
UserPerms.belongsTo(User, {
|
||||
foreignKey:'user_id',
|
||||
targetKey:'id',
|
||||
as: 'user'
|
||||
})
|
||||
User.hasOne(UserPerms, {
|
||||
sourceKey: 'id',
|
||||
foreignKey: 'user_id',
|
||||
as: 'perms'
|
||||
|
||||
User.addScope('withPerms',{
|
||||
include: [{association: 'perms' }]
|
||||
})
|
||||
|
||||
|
||||
User.sync();
|
||||
Auth.sync();
|
||||
Post.sync();
|
||||
UserPerms.sync();
|
||||
User.addScope('withAuthtokens',{
|
||||
include: [{association: 'authtokens'}]
|
||||
})
|
||||
@ -1,32 +1,46 @@
|
||||
import { CreationOptional, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize } from "sequelize";
|
||||
import { CreationOptional, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize } from "@sequelize/core";
|
||||
import { User } from "./User";
|
||||
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
import { Attribute, AutoIncrement, BelongsTo, CreatedAt, PrimaryKey, Table, Unique, UpdatedAt } from "@sequelize/core/decorators-legacy";
|
||||
|
||||
@Table({
|
||||
tableName: "Perms"
|
||||
})
|
||||
export class UserPerms extends Model<InferAttributes<UserPerms>, InferCreationAttributes<UserPerms>> {
|
||||
@Attribute(DataTypes.INTEGER)
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Unique
|
||||
declare id: CreationOptional<number>;
|
||||
@BelongsTo(()=>User, { foreignKey: 'user_id', inverse: { as: 'perms', type: 'hasOne' } })
|
||||
declare user:NonAttribute<User>;
|
||||
@Attribute(DataTypes.INTEGER)
|
||||
declare user_id:ForeignKey<User['id']>;
|
||||
@Attribute(DataTypes.BOOLEAN)
|
||||
declare isAdmin:CreationOptional<boolean>;
|
||||
@CreatedAt
|
||||
declare createdAt: CreationOptional<Date>;
|
||||
@UpdatedAt
|
||||
declare updatedAt: CreationOptional<Date>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: 'db.sqlite'
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite',
|
||||
models: [UserPerms],
|
||||
});
|
||||
|
||||
export class UserPerms extends Model<InferAttributes<UserPerms>, InferCreationAttributes<UserPerms>> {
|
||||
declare id: CreationOptional<number>;
|
||||
declare user:NonAttribute<User>;
|
||||
declare user_id:ForeignKey<User['id']>;
|
||||
declare isAdmin:CreationOptional<boolean>;
|
||||
}
|
||||
UserPerms.init({
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
unique: true,
|
||||
},
|
||||
isAdmin: {
|
||||
allowNull: false,
|
||||
defaultValue: false,
|
||||
type: DataTypes.BOOLEAN
|
||||
|
||||
UserPerms.addScope('defaultScope',{
|
||||
attributes: {
|
||||
exclude: ['createdAt', 'updatedAt'],
|
||||
}
|
||||
});
|
||||
UserPerms.addScope('withTimestamps',{
|
||||
attributes: {
|
||||
include: ['createdAt', 'updatedAt'],
|
||||
}
|
||||
},
|
||||
{
|
||||
tableName: 'Perms',
|
||||
sequelize // passing the `sequelize` instance is required
|
||||
});
|
||||
@ -1,14 +1,15 @@
|
||||
'use client'
|
||||
|
||||
import { Auth, User } from "@/model/sequelize/NewModels";
|
||||
import { Auth } from "@/model/Auth";
|
||||
import { User } from "@/model/User";
|
||||
import { ReactNode, createContext } from "react";
|
||||
import { InferAttributes } from "sequelize/types/model";
|
||||
import { Attributes, InferAttributes } from "@sequelize/core";
|
||||
|
||||
|
||||
export type AuthProps = {
|
||||
test: string;
|
||||
auth?: InferAttributes<Auth>
|
||||
user?: InferAttributes<User>
|
||||
auth?: Attributes<Auth>
|
||||
user?: Attributes<User>
|
||||
}
|
||||
let p: AuthProps = {
|
||||
test: "lorem",
|
||||
|
||||
3
src/util/DeepPartial.ts
Normal file
3
src/util/DeepPartial.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export type DeepPartial<T> = T extends object ? {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
} : T;
|
||||
@ -1,6 +1,7 @@
|
||||
export function parseSetCookie(h: string[]) {
|
||||
const penisregex = /(.*?)=(.*?)($|;|,(?! ))/gm;
|
||||
let aaa = h.map(
|
||||
s => [...s.matchAll(/(.*?)=(.*?)($|;|,(?! ))/gm)]
|
||||
s => [...s.matchAll(penisregex)]
|
||||
);
|
||||
const dict = Object.assign({}, ...aaa[0].map((e) => {
|
||||
return { [e[1]]: decodeURIComponent(e[2]) };
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"target": "ES2022",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"experimentalDecorators": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user