Змінено директорії

Додано скрипти CRON
Поліпшено механізм запису стендів та їх редагування
This commit is contained in:
2025-10-27 00:11:18 +02:00
parent 1d9f9a1468
commit 04f39da611
196 changed files with 4962 additions and 4065 deletions

View File

@@ -1,11 +1,8 @@
const sqlite3 = require("sqlite3");
const path = require("path");
require("dotenv").config();
const dbPath = process.env.DATABASE_PATH || path.join(__dirname, ".."); // если в .env относительный путь
const fileName = process.env.DATABASE_FILE || "database.sqlite";
const fullPath = path.isAbsolute(dbPath) ? path.join(dbPath, fileName) : path.join(dbPath, fileName);
const dbPath = process.env.DATABASE_PATH || path.join(__dirname, "..");
const fullPath = path.join(dbPath, "database.sqlite");
const db = new sqlite3.Database(fullPath, (err) => {
if (err) {
@@ -15,7 +12,6 @@ const db = new sqlite3.Database(fullPath, (err) => {
}
});
// optional: enable foreign keys
db.exec("PRAGMA foreign_keys = ON;");
module.exports = db;

4
ws/package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "WS Sheep Service",
"version": "1.0.1",
"version": "1.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "WS Sheep Service",
"version": "1.0.1",
"version": "1.1.0",
"license": "ISC",
"dependencies": {
"dotenv": "^17.2.0",

View File

@@ -1,6 +1,6 @@
{
"name": "WS Sheep Service",
"version": "1.0.1",
"version": "1.1.0",
"main": "ws.js",
"scripts": {
"start": "node ws.js"

View File

@@ -2,7 +2,7 @@ const db = require("../config/db");
function updateApartment(user, data) {
return new Promise((resolve, reject) => {
if (!user.possibilities.can_manager_territory) {
if (!user.possibilities.can_view_territory) {
return reject(new Error("Forbidden: no rights to manage territory"));
}

View File

@@ -2,7 +2,7 @@ const db = require("../config/db");
function updateBuilding(user, data) {
return new Promise((resolve, reject) => {
if (!user.possibilities.can_manager_territory) {
if (!user.possibilities.can_view_territory) {
return reject(new Error("Forbidden: no rights to manage territory"));
}