Commit Graph

79 Commits

Author SHA1 Message Date
Developer c3931255d3 fix(reward-service): 优化 Dockerfile 和添加 .dockerignore
问题:
1. Dockerfile 使用 COPY . . 会复制 node_modules 导致构建极慢
2. CMD 路径错误:dist/src/main.js 应该是 dist/main.js

修复:
- 添加 .dockerignore 排除 node_modules, dist 等
- 优化 Dockerfile 只复制必要文件 (COPY src ./src)
- 修正 CMD 路径为 dist/main.js
- 添加构建验证步骤 (test -f dist/main.js)
- 添加非 root 用户运行
- 添加健康检查

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 06:50:24 -08:00
Developer fc26575693 fix(leaderboard-service): 删除 Dockerfile 中的 test stage
问题:Dockerfile 中的 test stage 放在最后,导致 docker build 默认使用
test stage 而不是 production stage。容器启动时运行 npm test 而不是
node dist/src/main.js。

修复:删除 test stage,只保留 builder 和 production stages。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 06:48:54 -08:00
Developer b224e209a6 fix(mpc-service): 修复PostgreSQL兼容性问题
1. Dockerfile: 将DATABASE_URL协议从mysql改为postgresql
2. schema.prisma: 重命名索引以满足PostgreSQL全局唯一性要求
   - idx_party_id -> idx_ps_party_id (party_shares)
   - idx_session_id -> idx_ps_session_id (party_shares)
   - idx_status -> idx_ps_status (party_shares)
   - idx_session_id -> idx_ss_session_id (session_states)
   - idx_party_id -> idx_ss_party_id (session_states)
   - idx_status -> idx_ss_status (session_states)

已在WSL2中验证Docker构建成功。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 06:09:16 -08:00
Developer a9594ef15e fix(mpc-service): 修复数据库provider从mysql改为postgresql
mpc-service错误配置为mysql,与项目统一使用的postgresql不一致,
导致服务启动时Prisma验证DATABASE_URL失败。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 05:54:07 -08:00
Developer 1150d7e514 fix(wallet,referral): correct build output path to dist/main.js
These services build to dist/main.js (no src subdirectory).
Added build verification steps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 05:38:36 -08:00
Developer efd1156739 fix(mpc-service): correct build output path to dist/main.js
NestJS with tsconfig outDir: ./dist builds to dist/main.js, not dist/src/main.js.
Added build verification step to catch this earlier.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 04:41:29 -08:00
Developer 9b4a1d119c fix(services): switch from Alpine to Debian slim for Prisma OpenSSL
Alpine 3.22 removed openssl1.1-compat package which Prisma needs.
Switched production stage from node:20-alpine to node:20-slim (Debian)
which has proper OpenSSL support.

Changes:
- Use node:20-slim for production stage (keep Alpine for build)
- Install openssl and wget via apt-get
- Update user creation from Alpine (addgroup/adduser) to Debian (groupadd/useradd)

Validated identity-service build and startup in WSL2:
- Build passes successfully
- NestJS starts and loads all routes
- Prisma client connects without OpenSSL errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 04:12:27 -08:00
Developer c2b44eef29 fix(services): add OpenSSL 1.1 compatibility for Prisma in Alpine
Prisma engine requires libssl.so.1.1 which is not available in Alpine
Linux by default (Alpine uses OpenSSL 3.x). Added openssl1.1-compat
package to all service Dockerfiles.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 04:03:15 -08:00
Developer 7bb4259290 fix(services): correct NestJS build output path in all Dockerfiles
NestJS with sourceRoot: "src" outputs to dist/src/main.js not dist/main.js.
Fixed CMD paths in all service Dockerfiles:
- identity-service: dist/src/main.js (verified in WSL2)
- wallet-service: dist/src/main.js
- backup-service: dist/src/main.js
- planting-service: dist/src/main.js
- referral-service: dist/src/main.js
- reward-service: dist/src/main.js
- mpc-service: dist/src/main.js
- leaderboard-service: dist/src/main.js
- reporting-service: dist/src/main.js
- authorization-service: dist/src/main.js

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 03:56:02 -08:00
Developer a23b786797 fix(identity-service): fix Dockerfile build and add .dockerignore
- Add .dockerignore to exclude unnecessary files from Docker context
- Explicitly copy tsconfig, nest-cli.json, and src directory
- Add build verification step (test -f dist/main.js)
- Change CMD from npm run to direct node command
- Add health check and non-root user for security

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 03:44:11 -08:00
Developer 0a0b7eb886 feat(services): add individual deploy scripts for each service
Add deploy.sh script to each service directory for independent
deployment and management:
- identity-service, wallet-service, backup-service
- planting-service, referral-service, reward-service
- mpc-service, leaderboard-service, reporting-service
- authorization-service

Each script supports:
- build / build-no-cache
- start / stop / restart
- logs / logs-tail
- status / health
- migrate / shell

Also updated main deploy.sh with build-no-cache command.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 03:36:50 -08:00
Developer 2a449aff3c fix(identity-service): add DATABASE_URL for Prisma generate in Dockerfile
Fix build failure caused by missing DATABASE_URL environment variable
during prisma:generate step. Changed from npm run prisma:generate to
direct npx prisma generate with dummy DATABASE_URL.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 03:13:33 -08:00
Developer 77db1009dd fix(services): add DATABASE_URL for Prisma generate in Dockerfiles
Add dummy DATABASE_URL environment variable prefix to all npx prisma
generate commands in Dockerfiles. Prisma requires DATABASE_URL at
build time to generate the client, but the actual value is only used
at runtime.

Services updated:
- authorization-service (postgresql)
- backup-service (postgresql)
- leaderboard-service (postgresql)
- mpc-service (mysql)
- planting-service (postgresql)
- referral-service (postgresql)
- reporting-service (postgresql)
- reward-service (postgresql)
- wallet-service (postgresql + npm install fix)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 02:54:31 -08:00
Developer b39344a604 fix(wallet-service): use npm install instead of npm ci
wallet-service doesn't have package-lock.json, npm ci requires it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 02:28:24 -08:00
Developer 3dd561bd24 fix(services): comment out admin-service (not yet implemented)
- Comment out admin-service in docker-compose.yml
- Simplify admin-service Dockerfile to placeholder
- Fixes build error due to missing source files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 02:19:54 -08:00
Developer f99cac21cf feat(services): add unified Docker deployment system
- Add docker-compose.yml for all 11 backend services
- Add deploy.sh automation script with install/build/up/down commands
- Add init-databases.sh for PostgreSQL multi-database initialization
- Add .env.example template with secure key placeholders
- Fix empty Dockerfiles for admin/referral/reporting/wallet services

Services included:
- identity-service (:3000)
- wallet-service (:3001)
- backup-service (:3002)
- planting-service (:3003)
- referral-service (:3004)
- reward-service (:3005)
- mpc-service (:3006)
- leaderboard-service (:3007)
- reporting-service (:3008)
- authorization-service (:3009)
- admin-service (:3010)

Infrastructure: PostgreSQL, Redis, Kafka/Zookeeper

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 02:12:49 -08:00
Developer 70e6391691 feat(mpc-system): 添加原生部署脚本,替代 Docker 部署
由于中国网络环境无法正常使用 Docker,添加原生部署方案:

新增文件:
- backend/mpc-system/scripts/deploy.sh - 一键部署脚本

脚本功能:
- install: 安装 Go 1.21、PostgreSQL、Redis、RabbitMQ
- build: 编译 Go 服务并配置基础设施
- start/stop/restart: 服务控制
- status: 查看服务状态
- logs: 查看服务日志
- uninstall: 卸载服务

更新文档:
- 更新 DEPLOYMENT_GUIDE.md 第 4 节为原生部署方式
- 添加 systemd 服务管理说明
- 添加 Nginx/iptables 端口映射配置
- 更新故障排查指南

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 23:24:16 -08:00
Developer 42735e41ef docs: 更新 MPC-System 部署指南为 Docker Compose 一键部署
根据实际的 mpc-system/docker-compose.yml 更新部署文档:

- 更新系统要求 (Docker 24.0+, 4GB RAM)
- 添加服务架构说明 (account-service, session-coordinator 等)
- 提供一键部署步骤 (clone -> .env -> docker compose up)
- 添加 .env 配置模板
- 更新服务端口说明 (仅暴露 4000 端口)
- 更新 API 端点说明
- 添加运维命令参考

部署路径: /home/ceshi/rwadurian/backend/mpc-system

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 22:03:07 -08:00
Developer 01e192ea17 fix(nginx): 修复 CORS 配置,将 add_header 移出 if 块
nginx 不允许在 if 块中使用 add_header 指令,
将 CORS 配置提取到独立的 snippets/cors-params.conf 文件。

修改内容:
- 新增 cors-params.conf 配置文件
- 在每个 location 块中引入 cors-params.conf
- 从 server 块移除内联的 CORS 配置
- 更新目录结构说明和部署步骤

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 21:48:52 -08:00
Developer 6da6dba3f9 docs: 修复部署步骤顺序,SSL证书获取优先于站点配置
对于全新系统部署,必须先获取 Let's Encrypt 证书,
然后才能配置引用这些证书的 Nginx 站点配置。

修改内容:
- 将 SSL 证书获取移到步骤 3(配置站点之前)
- 提供 standalone 和 webroot 两种证书获取方式
- 添加清晰的步骤注释说明
- 移除不需要的 /etc/nginx/ssl 目录创建

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 21:21:25 -08:00
Developer b94a9b3d25 docs: 更新文档索引,区分开发/生产环境部署指南
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 21:00:56 -08:00
Developer c421a06f16 fix: 使用 Let's Encrypt 默认证书路径
- SSL 证书直接引用 /etc/letsencrypt/live/rwaapi.szaiai.com/
- 移除不必要的软链接创建步骤
- 添加 certbot 自动续期说明
- 更新 SSL 证书问题排查命令

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:59:59 -08:00
Developer 2ece6328ba refactor: 重组 identity-service 文档目录结构
文档重组:
- 创建 docs/ 目录,移动所有 .md 文档
- 添加 docs/README.md 文档索引

Nginx 配置更新:
- 改用 sites-available/sites-enabled 标准结构
- 添加 snippets/ 目录存放可复用配置
  - proxy-params.conf - 代理参数
  - ssl-params.conf - SSL 安全参数
- 更新部署步骤,包含站点启用/禁用命令

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:58:40 -08:00
Developer e082cda8b7 docs: 更新部署指南,MPC-System 部署在 Nginx 服务器 192.168.1.100
架构更新:
- Nginx + MPC-System 服务器 (192.168.1.100)
  - Nginx 反向代理 (80/443)
  - MPC-System Go 服务 (4000)
- 后端微服务服务器 (192.168.1.111)
  - 所有 NestJS 微服务
  - mpc-service 调用 192.168.1.100:4000

新增内容:
- MPC-System 部署指南 (systemd/Docker 两种方式)
- MPC-System API 端点说明
- 防火墙配置 (只允许后端服务器访问)
- MPC 相关故障排查
- 健康检查命令更新

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:47:34 -08:00
Developer a9dc2b441e docs: 更新部署指南,添加完整 Nginx 配置
更新内容:
- 明确后端服务部署在 192.168.1.111 服务器
- 添加完整的 Nginx 配置文件结构
  - nginx.conf 主配置
  - proxy_params.conf 代理参数
  - rwaapi.conf API 网关配置
- 所有 upstream 指向 192.168.1.111 内网地址
- 添加 Docker Compose 完整配置 (10个微服务)
- 添加数据库初始化脚本
- 添加环境变量配置示例
- 添加部署步骤和验证命令
- 添加监控运维和常见问题

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:41:50 -08:00
Developer 2d50ad32a9 docs: 添加系统部署指南和更新 API 配置
添加 DEPLOYMENT_GUIDE.md:
- 完整的 Nginx 反向代理配置 (rwaapi.szaiai.com)
- Docker Compose 生产环境部署配置
- 后端服务端口规划和 API 路由映射
- 前端 API 调用对照表
- SSL/HTTPS 配置说明
- 部署步骤和常见问题

更新前端 API 配置:
- api_endpoints.dart: 更新 baseUrl 为 https://rwaapi.szaiai.com
- api_endpoints.dart: 添加 /api/v1 前缀到所有端点
- api_endpoints.dart: 添加 telemetry 遥测端点
- api_client.dart: 更新默认 baseUrl 为生产环境地址

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:39:11 -08:00
Developer acb424a2da chore(identity-service): 完善 Docker Compose 配置
- 移除过时的 version 属性
- 补充完整环境变量 (Redis, Kafka, MPC, Backup Service)
- 添加健康检查 (healthcheck) 配置
- 添加自动重启策略 (restart: unless-stopped)
- 修复 Kafka broker 内部地址 (kafka:29092)
- 配置 Zookeeper 健康检查和依赖条件

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:15:12 -08:00
Developer 1fe66f34fd feat(reporting-service): Implement complete reporting service with DDD architecture
- Domain layer: ReportDefinition/ReportSnapshot aggregates, value objects (DateRange, ReportPeriod, etc.)
- Application layer: CQRS commands/queries, ReportingApplicationService
- Infrastructure layer: Prisma repositories, Redis cache, export services (Excel/CSV/PDF)
- API layer: REST controllers, DTOs with validation
- Testing: Unit tests, integration tests, E2E tests, Docker test environment
- Documentation: Architecture, API, Development, Testing, Deployment, Data Model docs
- Supports scheduled report generation, multi-format export, and data caching

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 08:12:57 -08:00
Developer ea03df9059 feat(authorization-service): Implement complete authorization service with DDD architecture
## Features
- Province/City Company authorization (省代/市代授权)
- Community authorization (社区授权)
- Monthly assessment with ladder targets (月度阶梯考核)
- Team validation for referral chain conflicts (推荐链授权冲突检测)
- First place ranking rewards (区域第一名奖励)

## Architecture
- Domain Layer: Aggregates, Entities, Value Objects, Domain Events, Services
- Application Layer: Commands, Services, Schedulers
- Infrastructure Layer: Prisma ORM, Redis Cache, Kafka Events
- API Layer: Controllers, DTOs, Guards

## Testing
- Unit tests: 33 tests (aggregates, entities, value objects)
- Integration tests: 30 tests (domain services)
- E2E tests: 6 tests (API endpoints)
- Docker test environment with PostgreSQL, Redis, Kafka

## Documentation
- ARCHITECTURE.md: System design and DDD patterns
- API.md: REST API endpoints reference
- DEVELOPMENT.md: Development guide
- TESTING.md: Testing strategies and examples
- DEPLOYMENT.md: Docker/Kubernetes deployment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 06:30:07 -08:00
Developer 9ab7ff3ef1 . 2025-12-01 03:54:55 -08:00
Developer 29cf03c1d2 feat(leaderboard-service): Implement complete leaderboard service with DDD architecture
## Features
- Daily/Weekly/Monthly leaderboard management
- Ranking score calculation (effectiveScore = totalTeamPlanting - maxDirectTeamPlanting)
- Virtual ranking system for display purposes
- Real-time ranking updates via scheduled tasks
- Redis caching for hot data
- Kafka messaging for event-driven updates

## Architecture
- Domain-Driven Design (DDD) with Hexagonal Architecture
- NestJS 10.x + TypeScript 5.x
- PostgreSQL 15 + Prisma ORM
- Redis (ioredis) for caching
- Kafka (kafkajs) for messaging
- JWT + Passport for authentication
- Swagger for API documentation

## Domain Layer
- Aggregates: LeaderboardRanking, LeaderboardConfig
- Entities: VirtualAccount
- Value Objects: LeaderboardType, LeaderboardPeriod, RankingScore, RankPosition, UserSnapshot
- Domain Events: LeaderboardRefreshedEvent, ConfigUpdatedEvent, RankingChangedEvent
- Domain Services: LeaderboardCalculationService, VirtualRankingGeneratorService, RankingMergerService

## Infrastructure Layer
- Prisma repositories implementation
- Redis cache service
- Kafka event publisher/consumer
- External service clients (ReferralService, IdentityService)

## Testing
- Unit tests: 72 tests passed (88% coverage on core domain)
- Integration tests: 7 tests passed
- E2E tests: 11 tests passed
- Docker containerized tests: 79 tests passed

## Documentation
- docs/ARCHITECTURE.md - Architecture design
- docs/API.md - API specification
- docs/DEVELOPMENT.md - Development guide
- docs/TESTING.md - Testing guide
- docs/DEPLOYMENT.md - Deployment guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 03:11:03 -08:00
Developer cc33d01be3 . 2025-12-01 02:08:24 -08:00
Developer 9769012795 feat(reward-service): Implement complete reward service with DDD architecture
## Core Features
- 6 types of reward calculation (Share Right 500U, Province Team 20U,
  Province Area 15U+1% hashpower, City Team 40U, City Area 35U+2% hashpower,
  Community Right 80U)
- 24-hour countdown mechanism for pending rewards
- Reward settlement with multi-currency support (BNB/OG/USDT/DST)
- Automatic reward expiration with scheduled tasks

## Domain Layer
- RewardLedgerEntry aggregate root with state machine
  (PENDING -> SETTLEABLE -> SETTLED, PENDING -> EXPIRED)
- RewardSummary aggregate for user reward overview
- Value objects: Money, Hashpower, RewardSource, RewardStatus, RightType
- Domain events: RewardCreated, RewardClaimed, RewardSettled, RewardExpired
- Domain services: RewardCalculationService, RewardExpirationService

## Application Layer
- RewardApplicationService for orchestrating business workflows
- RewardExpirationScheduler for automatic expiration processing

## Infrastructure Layer
- PostgreSQL persistence with Prisma ORM
- Redis caching integration
- Kafka event publishing/consuming
- External service clients (Referral, Authorization, Wallet)

## API Layer
- REST endpoints: /health, /rewards/summary, /rewards/details,
  /rewards/pending, /rewards/settle
- JWT authentication with Passport.js
- Swagger/OpenAPI documentation

## Testing (77 tests, 100% pass rate)
- 43 unit tests for domain logic (Money, Hashpower, aggregates)
- 20 integration tests for application services
- 14 E2E tests for API endpoints
- Docker Compose test infrastructure (PostgreSQL, Redis, Kafka)

## Documentation
- docs/ARCHITECTURE.md - DDD architecture overview
- docs/API.md - REST API documentation
- docs/DEVELOPMENT.md - Developer guide
- docs/TESTING.md - Testing guide
- docs/DEPLOYMENT.md - Deployment guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 01:57:40 -08:00
Developer 85c820b5af . 2025-12-01 00:32:30 -08:00
Developer 7ae98c7f5b feat(referral-service): Implement complete referral service with DDD architecture
Implement the referral service microservice with comprehensive features:

## Domain Layer
- ReferralRelationship aggregate: manages user referral relationships
- TeamStatistics aggregate: tracks team statistics and leaderboard scores
- Value Objects: UserId, ReferralCode, ReferralChain, LeaderboardScore, ProvinceCityDistribution
- Domain Services: ReferralChainService, LeaderboardCalculationService
- Domain Events: ReferralRelationshipCreated, TeamStatisticsUpdated

## Application Layer
- ReferralService: create relationships, get user info, validate codes
- TeamStatisticsService: update statistics, get leaderboard, province/city distribution
- Commands: CreateReferralRelationship, UpdateTeamStatistics
- Queries: GetUserReferralInfo, GetDirectReferrals, GetLeaderboard, GetProvinceCityDistribution
- Event Handlers: UserRegisteredHandler, PlantingCreatedHandler

## Infrastructure Layer
- Prisma repositories with PostgreSQL
- Redis caching for leaderboard
- Kafka messaging for domain events
- JWT authentication guard

## API Layer
- REST endpoints for referral management
- Leaderboard endpoints with pagination
- Team statistics endpoints
- Health check endpoints

## Testing (127 unit + 35 integration + 16 E2E tests)
- Domain layer unit tests (100% coverage)
- Integration tests with mocks
- E2E tests with supertest
- Docker test environment with PostgreSQL, Redis, Redpanda

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 00:18:20 -08:00
Developer b350d6b023 . 2025-11-30 19:04:47 -08:00
Developer 98f5d948dd feat(planting-service): Implement complete planting service with DDD architecture
- Domain Layer:
  - PlantingOrder aggregate with full lifecycle management
  - PlantingPosition aggregate for user holdings
  - PoolInjectionBatch aggregate for 5-day batch processing
  - Value objects: TreeCount, ProvinceCitySelection, FundAllocation, Money
  - Domain events for state transitions
  - FundAllocationDomainService for 10-target fund distribution (2199 USDT/tree)

- Application Layer:
  - PlantingApplicationService for order management
  - PoolInjectionService for batch processing
  - 5-second province/city confirmation mechanism

- Infrastructure Layer:
  - Prisma ORM with PostgreSQL
  - Repository implementations
  - External service clients (Wallet, Referral)
  - Object mappers

- API Layer:
  - REST controllers with Swagger documentation
  - JWT authentication guard
  - Request/Response DTOs with validation

- Testing:
  - 45+ unit tests
  - 12+ integration tests
  - 17+ E2E tests
  - Docker test environment

- Documentation:
  - Architecture design (DDD + Hexagonal)
  - API documentation
  - Development guide
  - Testing guide
  - Deployment guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 18:55:50 -08:00
Developer 2d18155ac2 . 2025-11-30 17:35:08 -08:00
Developer 845d841bca feat(wallet-service): Implement complete wallet service with DDD architecture
- Add domain layer with aggregates (WalletAccount, LedgerEntry, DepositOrder, SettlementOrder)
- Add value objects (Money, Balance, Hashpower, UserId, etc.)
- Add domain events for event-driven architecture
- Implement application layer with CQRS commands and queries
- Add infrastructure layer with Prisma repositories
- Implement REST API with NestJS controllers
- Add JWT authentication with guards and strategies
- Add comprehensive unit tests (69 tests) and E2E tests (23 tests)
- Add documentation: ARCHITECTURE.md, API.md, DEVELOPMENT.md, TESTING.md, DEPLOYMENT.md
- Add E2E testing guide for WSL2 environment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 09:13:57 -08:00
Developer a966d71fa0 . 2025-11-30 06:44:57 -08:00
Developer adf52ae130 . 2025-11-29 22:25:57 -08:00
Developer 66199cc93e feat(backup-service): Implement MPC backup share storage service
- Add DDD + Hexagonal architecture with NestJS 11.x
- Implement store/retrieve/revoke backup share endpoints
- Add AES-256-GCM double encryption for secure storage
- Add service-to-service JWT authentication
- Add rate limiting (3 retrieves per user per day)
- Add comprehensive audit logging
- Add test suite (37 unit + 21 mock E2E + 20 real DB E2E = 78 tests)
- Add documentation (architecture, API, development, testing, deployment)
- Add Docker and Kubernetes deployment configuration
- Add Prisma 7.x with @prisma/adapter-pg for PostgreSQL

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 22:12:41 -08:00
Developer 083db83c96 . 2025-11-29 19:22:42 -08:00
hailin 6fa4d7ac1d feat: 添加MPC多方计算服务模块
新增 mpc-service 微服务,实现 MPC-TSS 门限签名功能:

架构设计:
- 采用六边形架构(Hexagonal Architecture)
- 实现 CQRS 命令查询职责分离模式
- 遵循 DDD 领域驱动设计原则

核心功能:
- Keygen: 分布式密钥生成协议参与
- Signing: 门限签名协议参与
- Share Rotation: 密钥份额轮换
- Share Management: 份额查询和管理

技术栈:
- NestJS + TypeScript
- Prisma ORM
- Redis (缓存和分布式锁)
- Kafka (事件发布)
- Jest (单元/集成/E2E测试)

测试覆盖:
- 单元测试: 81个
- 集成测试: 30个
- E2E测试: 15个
- 总计: 111个测试全部通过

文档:
- ARCHITECTURE.md: 架构设计文档
- API.md: REST API接口文档
- TESTING.md: 测试架构说明
- DEVELOPMENT.md: 开发指南
- DEPLOYMENT.md: 部署运维文档

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 17:31:43 -08:00
hailin 92a227b576 . 2025-11-24 12:00:38 +00:00
hailin 7367838324 . 2025-11-24 03:59:50 -08:00
hailin 9a00c611b7 . 2025-11-24 03:49:34 -08:00
hailin ed5bafbfad . 2025-11-24 03:46:12 -08:00
hailin d09af9aa3e . 2025-11-24 03:43:25 -08:00
hailin cf706d95a8 . 2025-11-24 11:40:27 +00:00