refactor(backend): move db repos to typescript and update imports

This commit is contained in:
Haileyesus
2026-03-27 20:10:01 +03:00
parent 33cea381c4
commit 90d234d9f3
26 changed files with 960 additions and 60 deletions

View File

@@ -1,5 +1,5 @@
import express from 'express';
import { notificationPreferencesDb } from '../../../database/db.js';
import { notificationPreferencesDb } from '@/shared/database/repositories/notification-preferences.js';
const router = express.Router();
@@ -9,7 +9,7 @@ const router = express.Router();
router.get('/', async (req, res) => {
try {
const preferences = notificationPreferencesDb.getPreferences(req.user.id);
const preferences = notificationPreferencesDb.getNotificationPreferences(req.user.id);
res.json({ success: true, preferences });
} catch (error) {
console.error('Error fetching notification preferences:', error);
@@ -19,7 +19,7 @@ router.get('/', async (req, res) => {
router.put('/', async (req, res) => {
try {
const preferences = notificationPreferencesDb.updatePreferences(req.user.id, req.body || {});
const preferences = notificationPreferencesDb.updateNotificationPreferences(req.user.id, req.body || {});
res.json({ success: true, preferences });
} catch (error) {
console.error('Error saving notification preferences:', error);