feat: Add presence heartbeat for Matrix online status
- matrix-gateway: POST /internal/matrix/presence/online endpoint - usePresenceHeartbeat hook with activity tracking - Auto away after 5 min inactivity - Offline on page close/visibility change - Integrated in MatrixChatRoom component
This commit is contained in:
48
backend/http/platforms.routes.ts
Normal file
48
backend/http/platforms.routes.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Platforms Routes
|
||||
* Based on: api-mvp.md
|
||||
*
|
||||
* Endpoints:
|
||||
* - POST /api/v1/platforms - Create platform
|
||||
* - GET /api/v1/platforms - List platforms
|
||||
*/
|
||||
|
||||
import { Router } from 'express';
|
||||
import { daoFactoryService } from '../../services/dao-factory/dao-factory.service';
|
||||
import { registryService } from '../../services/registry/registry.service';
|
||||
import type { CreatePlatformInput } from '../../domain/dao/types';
|
||||
|
||||
export const platformsRoutes = Router();
|
||||
|
||||
// POST /api/v1/platforms - Create platform
|
||||
platformsRoutes.post('/', async (req, res) => {
|
||||
try {
|
||||
const userId = (req as any).userId;
|
||||
const input: CreatePlatformInput = req.body;
|
||||
|
||||
const result = await daoFactoryService.createPlatform(userId, input);
|
||||
|
||||
res.status(201).json(result);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({
|
||||
error: error.message || 'BAD_REQUEST',
|
||||
message: error.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// GET /api/v1/platforms - List platforms
|
||||
platformsRoutes.get('/', async (req, res) => {
|
||||
try {
|
||||
const platforms = await registryService.listPlatforms();
|
||||
|
||||
res.json({ items: platforms });
|
||||
} catch (error: any) {
|
||||
res.status(500).json({
|
||||
error: 'INTERNAL_ERROR',
|
||||
message: error.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user