- Create /docs structure (microdao, daarion, agents) - Organize 61 cursor technical docs - Add README files for each category - Copy key documents to public categories - Add GitHub setup instructions and scripts
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
/**
|
|
* 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,
|
|
});
|
|
}
|
|
});
|
|
|
|
|