1
0

Integrate ai.card Rust API with ai.gpt MCP and implement daily limit system

### Major Changes:
- **Rust Migration**: Move api-rs to root directory, rename binary to 'aicard'
- **MCP Integration**: Add card tools to ai.gpt MCP server (get_user_cards, draw_card, get_draw_status)
- **Daily Limit System**: Implement 2-day interval card drawing limits in API and iOS
- **iOS Enhancements**: Add DrawStatusView, backup functionality, and limit integration

### Technical Details:
- ai.gpt MCP now has 20 tools including 3 card-related tools
- ServiceClient enhanced with missing card API methods
- iOS app includes daily limit UI and atproto OAuth backup features
- Database migration for last_draw_date field
- Complete feature parity between web and iOS implementations

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-06-08 10:35:43 +09:00
parent 2e55e6ce09
commit 9f9208e160
14 changed files with 384 additions and 12 deletions

View File

@ -34,7 +34,19 @@ class GachaService:
Returns:
(Card, is_unique): 抽選されたカードとuniqueかどうか
Raises:
ValueError: If user cannot draw due to daily limit
"""
# Check if user can draw (daily limit)
can_draw = await self.user_repo.can_draw_card(user_did, settings.draw_limit_days)
if not can_draw:
next_draw_time = await self.user_repo.get_next_draw_time(user_did, settings.draw_limit_days)
if next_draw_time:
raise ValueError(f"カードを引けるのは{next_draw_time.strftime('%Y-%m-%d %H:%M:%S')}以降です。")
else:
raise ValueError("現在カードを引くことができません。")
# Get or create user
user = await self.user_repo.get_or_create(user_did)
# レアリティ抽選
@ -78,6 +90,9 @@ class GachaService:
)
self.session.add(draw_history)
# Update user's last draw date
await self.user_repo.update_last_draw_date(user.id)
# API用のCardモデルに変換
card = Card(
id=card_id,