sequelize-game-bank 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/database/models/Account.js +3 -2
- package/database/models/Credit.js +3 -2
- package/database/models/Transaction.js +2 -1
- package/database/models/User.js +3 -2
- package/database/services/account/add-manny.js +3 -2
- package/database/services/account/change-pincode.js +2 -1
- package/database/services/account/change-status.js +3 -2
- package/database/services/account/create-credit.js +4 -3
- package/database/services/account/create.js +2 -1
- package/database/services/account/delete.js +2 -1
- package/database/services/account/find-manny.js +2 -1
- package/database/services/account/logs.js +3 -2
- package/database/services/account/remove-manny.js +3 -2
- package/database/services/account/transfer.js +6 -5
- package/database/services/accounts.js +11 -11
- package/database/services/bot/cron-schedule.js +6 -5
- package/database/services/bot/generators/ban-bot.html +1 -0
- package/database/services/bot/generators/ban-bot.txt +1 -0
- package/database/services/bot/generators/disable-2FA-bot.html +1 -0
- package/database/services/bot/generators/disable-2FA-bot.txt +1 -0
- package/database/services/bot/generators/enable-2FA-bot.html +1 -0
- package/database/services/bot/generators/enable-2FA-bot.txt +1 -0
- package/database/services/bot/generators/login-bot.html +1 -0
- package/database/services/bot/generators/login-bot.txt +1 -0
- package/database/services/bot/generators/register-bot.html +1 -0
- package/database/services/bot/generators/register-bot.txt +7 -0
- package/database/services/bot/generators/transfer-from-bot.html +1 -0
- package/database/services/bot/generators/transfer-from-bot.txt +1 -0
- package/database/services/bot/generators/transfer-to-bot.html +1 -0
- package/database/services/bot/generators/transfer-to-bot.txt +1 -0
- package/database/services/bot/generators/unban-bot.html +1 -0
- package/database/services/bot/generators/unban-bot.txt +1 -0
- package/database/services/user/change-avatar.js +2 -1
- package/database/services/user/change-gmail.js +2 -1
- package/database/services/user/change-password.js +2 -1
- package/database/services/user/create.js +2 -1
- package/database/services/user/delete.js +2 -1
- package/database/services/user/disable-2FA.js +3 -2
- package/database/services/user/enable-2FA.js +3 -2
- package/database/services/user/login.js +3 -2
- package/database/services/user/math-manny.js +2 -1
- package/database/services/users.js +10 -9
- package/index.js +13 -12
- package/package.json +2 -2
- package/public/uploads/avatars/Pavel_1791693884620.png +0 -0
- package/server/server.js +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { DataTypes } = require('sequelize');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const sequelize = require(path.join(__dirname, '..', 'config', 'init-db'));
|
|
4
|
+
const User = require(path.join(__dirname, 'User'));
|
|
4
5
|
const Account = sequelize.define('account', {
|
|
5
6
|
id: {
|
|
6
7
|
type: DataTypes.INTEGER,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { DataTypes } = require('sequelize');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const sequelize = require(path.join(__dirname, '..', 'config', 'init-db'));
|
|
4
|
+
const Account = require(path.join(__dirname, 'Account'));
|
|
4
5
|
const Credit = sequelize.define('credit', {
|
|
5
6
|
id: {
|
|
6
7
|
type: DataTypes.INTEGER,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { DataTypes } = require('sequelize');
|
|
2
|
-
const
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const sequelize = require(path.join(__dirname, '..', 'config', 'init-db'));
|
|
3
4
|
module.exports = sequelize.define('transaction_log', {
|
|
4
5
|
id: {
|
|
5
6
|
type: DataTypes.INTEGER,
|
package/database/models/User.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { DataTypes } = require('sequelize');
|
|
2
|
-
const
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const sequelize = require(path.join(__dirname, '..', 'config', 'init-db'));
|
|
3
4
|
const User = sequelize.define('user', {
|
|
4
5
|
name: {
|
|
5
6
|
type: DataTypes.STRING,
|
|
@@ -41,7 +42,7 @@ const User = sequelize.define('user', {
|
|
|
41
42
|
avatar: {
|
|
42
43
|
type: DataTypes.STRING,
|
|
43
44
|
allowNull: true,
|
|
44
|
-
defaultValue: '
|
|
45
|
+
defaultValue: path.join(__dirname, '..', '..', 'uploads', 'avatars', 'default.png')
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
48
|
module.exports = User;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
3
|
+
const Transaction = require(path.join(__dirname, '..', '..', 'models', 'Transaction'));
|
|
3
4
|
module.exports = async function addManny(accountId, amount) {
|
|
4
5
|
try {
|
|
5
6
|
const acc = await Account.findByPk(accountId);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const bcrypt = require('bcrypt');
|
|
2
|
-
const
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
3
4
|
module.exports = async function changePincode(accountId, oldPin, newPin) {
|
|
4
5
|
try {
|
|
5
6
|
const acc = await Account.findByPk(accountId);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
3
|
+
const { sendBotNotification } = require(path.join(__dirname, '..', 'bot', 'bot'));
|
|
3
4
|
module.exports = async function changeAccountStatus(accountId, isActive) {
|
|
4
5
|
try {
|
|
5
6
|
const [updatedCount] = await Account.update(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
3
|
+
const Credit = require(path.join(__dirname, '..', '..', 'models', 'Credit'));
|
|
4
|
+
const sequelize = require(path.join(__dirname, '..', '..', 'config', 'init-db'));
|
|
4
5
|
async function createCredit({ accountId, amount, autoRepay = false, rate = 0.1, termMonths = 12 }) {
|
|
5
6
|
const numericAmount = parseFloat(amount);
|
|
6
7
|
const numericRate = parseFloat(rate);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const bcrypt = require('bcrypt');
|
|
2
|
-
const
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
3
4
|
module.exports = async function createAccount(username, pinCode, enable2FA) {
|
|
4
5
|
try {
|
|
5
6
|
if (!pinCode || pinCode.length > 8) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
2
3
|
module.exports = async function findManny(accountId) {
|
|
3
4
|
try {
|
|
4
5
|
const acc = await Account.findByPk(accountId);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("path")
|
|
2
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
3
|
+
const Transaction = require(path.join(__dirname, '..', '..', 'models', 'Transaction'));
|
|
3
4
|
module.exports = async function getAccountLogs(username) {
|
|
4
5
|
try {
|
|
5
6
|
const myAccounts = await Account.findAll({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
3
|
+
const Transaction = require(path.join(__dirname, '..', '..', 'models', 'Transaction'));
|
|
3
4
|
module.exports = async function removeManny(accountId, amount) {
|
|
4
5
|
try {
|
|
5
6
|
const acc = await Account.findByPk(accountId);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const path = require("path");
|
|
1
2
|
const bcrypt = require('bcrypt');
|
|
2
|
-
const Account = require('
|
|
3
|
-
const User = require('
|
|
4
|
-
const Transaction = require('
|
|
5
|
-
const sequelize = require('
|
|
6
|
-
const { sendBotNotification } = require('
|
|
3
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
4
|
+
const User = require(path.join(__dirname, '..', '..', 'models', 'User'));
|
|
5
|
+
const Transaction = require(path.join(__dirname, '..', '..', 'models', 'Transaction'));
|
|
6
|
+
const sequelize = require(path.join(__dirname, '..', '..', 'config', 'init-db'));
|
|
7
|
+
const { sendBotNotification } = require(path.join(__dirname, '..', 'bot', 'bot'));
|
|
7
8
|
const logger = require("custom-color-logs").print;
|
|
8
9
|
module.exports = async function transferManny(fromId, toId, amount, pinCode, totpCode = null) {
|
|
9
10
|
const t = await sequelize.transaction();
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
const path = require("path");
|
|
2
2
|
module.exports = {
|
|
3
|
-
create: require('
|
|
4
|
-
delete: require('
|
|
5
|
-
changePincode: require('
|
|
6
|
-
transfer: require('
|
|
7
|
-
addManny: require('
|
|
8
|
-
removeManny: require('
|
|
9
|
-
findManny: require('
|
|
10
|
-
creatCredit: require('
|
|
11
|
-
getLogs: require('
|
|
12
|
-
changeAccountStatus: require('
|
|
3
|
+
create: require(path.join(__dirname, 'account', 'create')),
|
|
4
|
+
delete: require(path.join(__dirname, 'account', 'delete')),
|
|
5
|
+
changePincode: require(path.join(__dirname, 'account', 'change-pincode')),
|
|
6
|
+
transfer: require(path.join(__dirname, 'account', 'transfer')),
|
|
7
|
+
addManny: require(path.join(__dirname, 'account', 'add-manny')),
|
|
8
|
+
removeManny: require(path.join(__dirname, 'account', 'remove-manny')),
|
|
9
|
+
findManny: require(path.join(__dirname, 'account', 'find-manny')),
|
|
10
|
+
creatCredit: require(path.join(__dirname, 'account', 'create-credit')),
|
|
11
|
+
getLogs: require(path.join(__dirname, 'account', 'logs')),
|
|
12
|
+
changeAccountStatus: require(path.join(__dirname, 'account', 'change-status'))
|
|
13
13
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const cron = require('node-cron');
|
|
2
2
|
const nodemailer = require('nodemailer');
|
|
3
|
-
const { Op } = require('sequelize');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
3
|
+
const { Op } = require('sequelize');
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
6
|
+
const Credit = require(path.join(__dirname, '..', '..', 'models', 'Credit'));
|
|
7
|
+
const User = require(path.join(__dirname, '..', '..', 'models', 'User'));
|
|
8
|
+
const sequelize = require(path.join(__dirname, '..', '..', 'config', 'init-db'));
|
|
8
9
|
const logger = require("custom-color-logs").print;
|
|
9
10
|
const transporter = nodemailer.createTransport({
|
|
10
11
|
service: 'gmail',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h3 style='color:red;'>🚫 Заморозка счета</h3><p>Ваш банковский счет #{accountId} заблокирован администрацией.</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
🚫 Счет #{accountId} ЗАБЛОКИРОВАН администратором.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h3>⚠️ Снижение уровня защиты</h3><p>2FA-статус аккаунта {name} был отключен.</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
⚠️ Защита 2FA ОТКЛЮЧЕНА для аккаунта {name}.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h3>🔒 Защита профиля</h3><p>2FA-статус аккаунта {name} успешно активирован.</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
🔒 Защита 2FA успешно ВКЛЮЧЕНА для аккаунта {name}.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h3>🔔 Уведомление безопасности</h3><p>Успешный вход в личный кабинет: <b>{name}</b></p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
🔔 Вход в систему: Профиль {name} успешно авторизован.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h2>Здравствуйте, {surname} {realName}!</h2><p>На ваш счёт зарегистрировали аккаунт в банке City-bank.</p><p>{twoFaBlock}</p><p>Если забыли пароль используйте токен - <b>[{token}]</b></p><p>Ваш пароль - <b>[{password}]</b></p><br><p>С уважением, система банка City-bank ©</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h3>💸 Списание со счета</h3><p>Вы перевели <b>{amount} руб.</b> на счет #{toId}</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
💸 Списание со счета #{fromId}: {amount} руб. отправлено на счет #{toId}.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h3>💰 Входящий перевод</h3><p>На ваш счет зачислено <b>{amount} руб.</b> от счета #{fromId}</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
💰 Зачисление на счет #{toId}: Получено {amount} руб. со счета #{fromId}.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h3 style='color:green;'>✅ Разблокировка счета</h3><p>Ваш банковский счет #{accountId} успешно активирован.</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
✅ Счет #{accountId} РАЗБЛОКИРОВАН администратором.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const User = require(path.join(__dirname, '..', '..', 'models', 'User'));
|
|
2
3
|
module.exports = async function changeGmail(name, newGmail) {
|
|
3
4
|
try {
|
|
4
5
|
if (await User.findOne({ where: { user_gmail: newGmail } })) return { status: false, statusCode: -21 };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const bcrypt = require('bcrypt');
|
|
2
|
-
const
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const User = require(path.join(__dirname, '..', '..', 'models', 'User'));
|
|
3
4
|
module.exports = async function changePassword(name, oldPassword, newPassword, totp = null) {
|
|
4
5
|
try {
|
|
5
6
|
const user = await User.findByPk(name);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const bcrypt = require('bcrypt');
|
|
2
2
|
const crypto = require('crypto');
|
|
3
|
-
const
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const User = require(path.join(__dirname, '..', '..', 'models', 'User'));
|
|
4
5
|
const nodemailer = require('nodemailer');
|
|
5
6
|
const { sendBotNotification } = require('../bot/bot');
|
|
6
7
|
module.exports = async function createUser(data) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const bcrypt = require('bcrypt');
|
|
2
|
-
const
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const User = require(path.join(__dirname, '..', '..', 'models', 'User'));
|
|
3
4
|
module.exports = async function deleteUser(name, password, totp = null) {
|
|
4
5
|
try {
|
|
5
6
|
const user = await User.findByPk(name);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const User = require(path.join(__dirname, '..', '..', 'models', 'User'));
|
|
3
|
+
const { sendBotNotification } = require(path.join(__dirname, '..', 'bot', 'bot'));
|
|
3
4
|
module.exports = async function disable2FA(name) {
|
|
4
5
|
try {
|
|
5
6
|
const user = await User.findByPk(name);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const crypto = require('crypto');
|
|
2
2
|
const bcrypt = require('bcrypt');
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const User = require(path.join(__dirname, '..', '..', 'models', 'User'));
|
|
5
|
+
const { sendBotNotification } = require(path.join(__dirname, '..', 'bot', 'bot'));
|
|
5
6
|
module.exports = async function enable2FA(name) {
|
|
6
7
|
try {
|
|
7
8
|
const user = await User.findByPk(name);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const bcrypt = require('bcrypt');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const User = require(path.join(__dirname, '..', '..', 'models', 'User'));
|
|
4
|
+
const { sendBotNotification } = require(path.join(__dirname, '..', 'bot', 'bot'));
|
|
4
5
|
const logger = require("custom-color-logs").print;
|
|
5
6
|
module.exports = async function loginUser(name, password, totpCode = null) {
|
|
6
7
|
try {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const Account = require(path.join(__dirname, '..', '..', 'models', 'Account'));
|
|
2
3
|
module.exports = async function mathManny(username) {
|
|
3
4
|
try {
|
|
4
5
|
const total = await Account.sum('manny', { where: { user: username } });
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
const path = require("path");
|
|
1
2
|
module.exports = {
|
|
2
|
-
registerUser: require('
|
|
3
|
-
deleteUser: require('
|
|
4
|
-
changePassword: require('
|
|
5
|
-
login: require('
|
|
6
|
-
mathManny: require('
|
|
7
|
-
enable2FA: require('
|
|
8
|
-
disable2FA: require('
|
|
9
|
-
changeGmail: require('
|
|
10
|
-
changeAvatar: require('
|
|
3
|
+
registerUser: require(path.join(__dirname, 'user', 'create')),
|
|
4
|
+
deleteUser: require(path.join(__dirname, 'user', 'delete')),
|
|
5
|
+
changePassword: require(path.join(__dirname, 'user', 'change-password')),
|
|
6
|
+
login: require(path.join(__dirname, 'user', 'login')),
|
|
7
|
+
mathManny: require(path.join(__dirname, 'user', 'math-manny')),
|
|
8
|
+
enable2FA: require(path.join(__dirname, 'user', 'enable-2FA')),
|
|
9
|
+
disable2FA: require(path.join(__dirname, 'user', 'disable-2FA')),
|
|
10
|
+
changeGmail: require(path.join(__dirname, 'user', 'change-gmail')),
|
|
11
|
+
changeAvatar: require(path.join(__dirname, 'user', 'change-avatar'))
|
|
11
12
|
};
|
package/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
const logger = require("custom-color-logs").print;
|
|
2
2
|
console.log(logger.ServerBankInfo("Модуль банка запущен!"))
|
|
3
3
|
require('dotenv').config();
|
|
4
|
+
const path = require("path")
|
|
4
5
|
const express = require('express');
|
|
5
6
|
const cookieParser = require('cookie-parser');
|
|
6
7
|
const bcrypt = require('bcrypt');
|
|
7
|
-
const sequelize = require('
|
|
8
|
-
const User = require('
|
|
9
|
-
const { writeTemplatesIfNotExist } = require('
|
|
10
|
-
const registerRoutes = require('
|
|
11
|
-
const Transaction = require('
|
|
8
|
+
const sequelize = require(path.join(__dirname, 'database', 'config', 'init-db'));
|
|
9
|
+
const User = require(path.join(__dirname, 'database', 'models', 'User'));
|
|
10
|
+
const { writeTemplatesIfNotExist } = require(path.join(__dirname, 'database', 'services', 'bot', 'write'));
|
|
11
|
+
const registerRoutes = require(path.join(__dirname, 'server', 'server'));
|
|
12
|
+
const Transaction = require(path.join(__dirname, 'database', 'models', 'Transaction'));
|
|
12
13
|
const app = express();
|
|
13
|
-
|
|
14
|
-
const { verifySession } = require('
|
|
14
|
+
|
|
15
|
+
const { verifySession } = require(path.join(__dirname, 'server', 'server'));
|
|
15
16
|
app.use(express.json());
|
|
16
17
|
app.use(cookieParser());
|
|
17
|
-
require('
|
|
18
|
+
require(path.join(__dirname, 'database', 'services', 'bot', 'cron-schedule'));
|
|
18
19
|
async function Bank() {
|
|
19
20
|
try {
|
|
20
21
|
await sequelize.sync();
|
|
@@ -37,10 +38,10 @@ async function Bank() {
|
|
|
37
38
|
});
|
|
38
39
|
console.log(logger.ServerBankInfo(`Супер пользвотель создан`))
|
|
39
40
|
const configuredApp = registerRoutes(app);
|
|
40
|
-
app.use('/css', express.static(path.join(__dirname, 'public
|
|
41
|
-
app.use('/js', express.static(path.join(__dirname, 'public
|
|
42
|
-
app.use('/uploads', express.static(path.join(__dirname, 'public
|
|
43
|
-
const { verifyPageSession } = require('
|
|
41
|
+
app.use('/css', express.static(path.join(__dirname, 'public', 'css')));
|
|
42
|
+
app.use('/js', express.static(path.join(__dirname, 'public', 'js')));
|
|
43
|
+
app.use('/uploads', express.static(path.join(__dirname, 'public', 'uploads')));
|
|
44
|
+
const { verifyPageSession } = require(path.join(__dirname, 'server', 'middleware', 'auth'));
|
|
44
45
|
const pages = ['general.html', 'profile.html', 'accounts.html', 'transfer.html', 'history.html', 'credit.html', 'admin.html'];
|
|
45
46
|
pages.forEach(page => {
|
|
46
47
|
app.get(`/${page}`, verifyPageSession, (req, res) => {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sequelize-game-bank",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A Sequelize-based gaming economy and banking system featuring user profiles, credits, admin management, and detailed transaction history.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "node test.js",
|
|
9
|
-
"ship":"npm publish"
|
|
9
|
+
"ship": "npm publish"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"bcrypt": "^6.0.0",
|
|
Binary file
|
package/server/server.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
const path = require('path');
|
|
1
2
|
const jwt = require('jsonwebtoken');
|
|
2
3
|
const bcrypt = require('bcrypt');
|
|
3
|
-
const User = require('
|
|
4
|
-
const Account = require('
|
|
4
|
+
const User = require(path.join(__dirname, '..', 'database', 'models', 'User'));
|
|
5
|
+
const Account = require(path.join(__dirname, '..', 'database', 'models', 'Account'));
|
|
5
6
|
const multer = require('multer');
|
|
6
|
-
const path = require('path');
|
|
7
7
|
const fs = require('fs');
|
|
8
8
|
const logger = require("custom-color-logs").print;
|
|
9
9
|
const storage = multer.diskStorage({
|
|
10
10
|
destination: function (req, file, cb) {
|
|
11
|
-
const dir = '
|
|
11
|
+
const dir = path.join(__dirname, '..', 'public', 'uploads', 'avatars');
|
|
12
12
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
13
13
|
cb(null, dir);
|
|
14
14
|
},
|
|
@@ -27,8 +27,8 @@ const upload = multer({
|
|
|
27
27
|
},
|
|
28
28
|
limits: { fileSize: 2 * 1024 * 1024 }
|
|
29
29
|
});
|
|
30
|
-
const usersHub = require('
|
|
31
|
-
const accountsHub = require('
|
|
30
|
+
const usersHub = require(path.join(__dirname, '..', 'database', 'services', 'users'));
|
|
31
|
+
const accountsHub = require(path.join(__dirname, '..', 'database', 'services', 'accounts'));
|
|
32
32
|
|
|
33
33
|
function verifySession(req, res, next) {
|
|
34
34
|
const token = req.cookies.token;
|