refactor: restructure db logic and add import alias using tsc-alias

Note: the legacy githubTokensDb migration is not included in this commit.
It's used only in `agents.js` and will be removed in a future commit. We
will directly use credentials repository instead of github tokens repository.
This commit is contained in:
Haileyesus
2026-03-13 17:00:26 +03:00
parent e67738c9fc
commit 695da128f3
21 changed files with 1144 additions and 15 deletions

View File

@@ -875,8 +875,9 @@ router.post('/', validateExternalApiKey, async (req, res) => {
// Determine the final project path
if (githubUrl) {
// Clone repository (to projectPath if provided, otherwise generate path)
// TODO: use credinitalsDB when refactoring
const tokenToUse = githubToken || githubTokensDb.getActiveGithubToken(req.user.id);
let targetPath;
if (projectPath) {
targetPath = projectPath;
@@ -995,6 +996,7 @@ router.post('/', validateExternalApiKey, async (req, res) => {
console.log('🔄 Starting GitHub branch/PR creation workflow...');
// Get GitHub token
// TODO: use credinitalsDB when refactoring
const tokenToUse = githubToken || githubTokensDb.getActiveGithubToken(req.user.id);
if (!tokenToUse) {