Refactor license and permission management, add services

Renamed licenceRepository.js to licenseRepository.js and updated its API to use status instead of userId for licenses. Moved permission checking logic from userRepository to permissionsRepository. Added new service layers for license, permissions, and user management, implementing error handling and business logic. Removed the old register.js service and cleaned up test.js. Updated database schema to remove userId from licenses.
This commit is contained in:
2026-01-27 05:49:50 +01:00
parent 1e78bd68cf
commit f8c1340b41
9 changed files with 243 additions and 69 deletions

View File

@@ -64,16 +64,11 @@ function initializeDatabase() {
key TEXT NOT NULL UNIQUE,
productId INTEGER NOT NULL,
targetIhannel TEXT NOT NULL,
userId INTEGER DEFAULT NULL,
usedAt TEXT,
FOREIGN KEY(productId)
REFERENCES products(id)
ON DELETE CASCADE,
FOREIGN KEY(userId)
REFERENCES accounts(id)
ON DELETE SET NULL
)
`)
}