主要更新: 1. 后端核心底座完成 (M1-M6): - 健康检查、指标监控、分布式锁 - 事件总线、队列系统、事务管理 - 安全守卫、多租户隔离、存储适配器 - 审计日志、配置管理、多语言支持 2. 前端迁移到 Ant Design Vue: - 从 Element Plus 迁移到 Ant Design Vue - 完善 system 模块 (role/menu/dept) - 修复依赖和配置问题 3. 文档完善: - AI 开发工作流文档 - 架构约束和开发规范 - 项目进度跟踪 4. 其他改进: - 修复编译错误和类型问题 - 完善测试用例 - 优化项目结构
70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
import { Controller, Post, Body, Get } from '@nestjs/common';
|
|
import { TestService } from './test.service';
|
|
import { Public } from '../src/common/auth/decorators/public.decorator';
|
|
|
|
@Controller('test')
|
|
export class TestController {
|
|
constructor(private readonly testService: TestService) {}
|
|
|
|
@Get('status')
|
|
@Public()
|
|
getStatus() {
|
|
return {
|
|
message: 'Test module is working',
|
|
timestamp: new Date().toISOString(),
|
|
services: {
|
|
redis: 'available',
|
|
kafka: 'available',
|
|
},
|
|
};
|
|
}
|
|
|
|
@Post('kafka')
|
|
@Public()
|
|
async testKafka(@Body() data: Record<string, any>) {
|
|
try {
|
|
await this.testService.publishKafkaEvent('test-topic', {
|
|
message: 'Hello from WWJCloud Test Module!',
|
|
data,
|
|
timestamp: new Date().toISOString(),
|
|
});
|
|
return {
|
|
success: true,
|
|
message: 'Event published to Kafka successfully',
|
|
topic: 'test-topic',
|
|
data,
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
success: false,
|
|
message: 'Failed to publish event to Kafka',
|
|
error: error instanceof Error ? error.message : String(error),
|
|
};
|
|
}
|
|
}
|
|
|
|
@Post('redis')
|
|
@Public()
|
|
async testRedis(@Body() data: Record<string, any>) {
|
|
try {
|
|
const jobId = await this.testService.enqueueRedisJob('test-job', {
|
|
message: 'Hello from WWJCloud Test Module!',
|
|
data,
|
|
timestamp: new Date().toISOString(),
|
|
});
|
|
return {
|
|
success: true,
|
|
message: 'Job queued to Redis successfully',
|
|
jobId,
|
|
data,
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
success: false,
|
|
message: 'Failed to queue job to Redis',
|
|
error: error instanceof Error ? error.message : String(error),
|
|
};
|
|
}
|
|
}
|
|
}
|