Actions
업무 #390
진행중
JL
JL
Port UserService.GetUser to alphea-ai-edge
업무 #390:
Port UserService.GetUser to alphea-ai-edge
설명
목표¶
alphea-rpc-next (Go) 의 UserService.GetUser RPC 를 alphea-ai-edge (Rust/tonic) 로 포팅한다.
범위¶
-
proto/alphea/v1/user.proto추가 -
src/store/users.rs—get_by_wallet,get_friend_count쿼리 -
src/handler/user.rs—UserHandler::get_user구현 -
src/server/mod.rs— UserService 등록 -
src/server/auth_middleware.rs—GetUser를 public allow-list 에 추가 -
examples/user_get.rs— E2E 확인
DoD¶
- proto 정의 완료 및 빌드 통과
-
GetUser(wallet_address)→GetUserResponse { wallet_address, username, profile_icon, grade, friend_count, is_active, created_at }반환 -
grade 는 friend_count 기반
gradeByFriendCount로직 이식 (clay → diamond) -
is_active:
last_active_at이 24h 이내이면 true -
존재하지 않는 wallet →
NOT_FOUND - E2E 예제 동작 확인
JL James Lee이(가) 6달 전에 변경
- 상태을(를) 신규에서 해결(으)로 변경되었습니다.
구현 완료 — commit:server|304d9a1¶
변경 파일¶
| 파일 | 내용 |
|---|---|
proto/alphea/v1/user.proto |
GetUserRequest / GetUserResponse proto 정의 |
migrations/0004_accounts_last_active_and_friends.sql |
accounts.last_active_at 컬럼 추가, friends 테이블 생성 |
src/store/accounts.rs |
last_active_at 필드, touch_last_active, friend_count 쿼리 추가 |
src/handler/user.rs |
UserHandler::get_user 구현 (grade, is_active, friend_count) |
src/server/mod.rs |
UserServiceServer 등록 |
src/server/auth_middleware.rs |
/alphea.v1.UserService/GetUser public allow-list 추가 |
src/handler/auth.rs |
Verify 에서 touch_last_active 호출로 변경 |
examples/user_get.rs |
E2E 4개 시나리오 |
DoD 체크¶
- proto 정의 및 빌드 통과
-
GetUser(wallet_address)→GetUserResponse반환 -
grade: friend_count 기반
grade_by_friend_count(clay → diamond) -
is_active:
last_active_at이 24h 이내이면 true -
존재하지 않는 wallet →
NOT_FOUND - E2E 예제 동작 확인 (happy path, not found, invalid arg)
JL James Lee이(가) 6달 전에 변경
Go 백포트 Phase 1 — 이번 범위 안 구체적 변경 없음¶
commit:server|03c6c64 (이슈 #434)
Rust 측의 UserService.GetUser 포팅(본 이슈)은 wallets 테이블 join 으로 user_id 를 조회하는 구조였으나, Go 측 Phase 1 에서는 1:N wallets 테이블 재설계가 Phase 2 로 미루어졌기 때문에 UserService.GetUser 는 기존대로 accounts.wallet_address 직접 조회 경로를 유지한다.
v12 마이그레이션이 accounts.wallet_address 를 nullable 로 완화했으므로, GoTrue 사용자가 아직 wallet 을 연결하지 않은 경우에는 NULL 이어서 GetUser 가 NotFound 를 돌려준다. 와이드 아니면 기존 동작을 유지.
Phase 2 에서 1:N wallets 테이블이 도입되면 GetUser 는 wallets join 으로 전환 예정.
Actions