Initial commit: IT Nexus Web-App

This commit is contained in:
2026-06-01 20:49:07 +02:00
commit 8023765e6c
387 changed files with 106900 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
const { asyncHandler } = require('../middleware/errorHandler');
const { getDatabase } = require('../config/database');
class TeamsActivityController {
/**
* GET /api/teams-activity/new-channels
* Returns channels discovered since last notification (notified=0).
*/
static getNewChannels = asyncHandler(async (req, res) => {
const db = getDatabase();
const channels = db.prepare(`
SELECT id, team_name, channel_name, first_seen_at
FROM teams_channels
WHERE notified = 0
ORDER BY first_seen_at DESC
LIMIT 50
`).all();
res.json({ status: 'success', data: channels });
});
/**
* POST /api/teams-activity/mark-read
* Marks all unread channel notifications as read.
*/
static markRead = asyncHandler(async (req, res) => {
const db = getDatabase();
db.prepare('UPDATE teams_channels SET notified = 1 WHERE notified = 0').run();
res.json({ status: 'success' });
});
}
module.exports = TeamsActivityController;