-
Notifications
You must be signed in to change notification settings - Fork 111
[WIP] feat: some data management APIs #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v1-dev
Are you sure you want to change the base?
Conversation
审阅者指南此 PR 将 Fedy 集成从以用户为中心的事件模型重构为以卡片为中心的事件模型,引入了新的数据拉取/推送 API 以及卡片解析/链接/解除链接端点,将这些事件连接到多个控制器中,并移除了过时的 AquaNetUserFedy 逻辑。 通过 Fedy 进行卡片创建事件通知的序列图sequenceDiagram
participant Frontier
participant CardService
participant Fedy
participant RemoteService
Frontier->>CardService: registerByAccessCode(accessCode)
CardService-->>Frontier: Card
Frontier->>Fedy: onCardCreated(accessCode, card.extId)
Fedy->>RemoteService: POST /notify (cardCreated event payload)
通过 Fedy 进行卡片链接事件通知的序列图sequenceDiagram
participant CardController
participant CardService
participant Fedy
participant RemoteService
CardController->>CardService: registerByAccessCode(cardId, user)
CardService-->>CardController: Card
CardController->>Fedy: onCardLinked(newCard.luid, oldExtId, extId, migratedGames)
Fedy->>RemoteService: POST /notify (cardLinked event payload)
通过 Fedy 进行卡片解除链接事件通知的序列图sequenceDiagram
participant CardController
participant CardRepository
participant Fedy
participant RemoteService
CardController->>CardRepository: save(card)
CardController->>Fedy: onCardUnlinked(luid)
Fedy->>RemoteService: POST /notify (cardUnlinked event payload)
通过 Fedy 进行数据更新事件通知的序列图sequenceDiagram
participant ImportController
participant Fedy
participant RemoteService
ImportController->>Fedy: onDataUpdated(extId, game, removeOldData)
Fedy->>RemoteService: POST /notify (dataUpdated event payload)
移除 AquaNetUserFedy 表的 ER 图erDiagram
AQUA_NET_USER_FEDY {
LONG id
LONG aqua_net_user_id
DATETIME created_at
}
AQUA_NET_USER_FEDY ||--|| AQUA_NET_USER : "aqua_net_user_id references id"
%% Table AQUA_NET_USER_FEDY is dropped in this PR
新 Fedy 事件模型和 API 请求/响应类型的类图classDiagram
class Fedy {
+handleDataPull(key: Str, req: DataPullReq): DataPullRes
+handleDataPush(key: Str, req: DataPushReq): Any
+handleCardResolve(key: Str, req: CardResolveReq): CardResolveRes
+handleCardLink(key: Str, req: CardLinkReq): Any
+handleCardUnlink(key: Str, req: CardUnlinkReq): Any
+onCardCreated(luid: Str, extId: Long)
+onCardLinked(luid: Str, oldExtId: Long?, extId: Long, migratedGames: List<Str>)
+onCardUnlinked(luid: Str)
+onDataUpdated(extId: Long, game: Str, removeOldData: Bool)
}
class CardCreatedEvent {
+luid: Str
+extId: Long
}
class CardLinkedEvent {
+luid: Str
+oldExtId: Long?
+extId: Long
+migratedGames: List<Str>
}
class CardUnlinkedEvent {
+luid: Str
}
class DataUpdatedEvent {
+extId: Long
+game: Str
+removeOldData: Bool
}
class FedyEvent {
+cardCreated: CardCreatedEvent?
+cardLinked: CardLinkedEvent?
+cardUnlinked: CardUnlinkedEvent?
+dataUpdated: DataUpdatedEvent?
}
class DataPullReq {
+extId: Long
+game: Str
+exportOptions: ExportOptions
}
class DataPullRes {
+error: DataPullErr?
+result: Any?
}
class DataPullErr {
+code: Int
+message: Str
}
class DataPushReq {
+extId: Long
+game: Str
+data: JDict
+removeOldData: Bool
}
class CardResolveReq {
+luid: Str
+pairedLuid: Str?
+createIfNotFound: Bool
}
class CardResolveRes {
+extId: Long
+isGhost: Bool
+isNewlyCreated: Bool
+isPairedLuidDiverged: Bool
}
class CardLinkReq {
+auId: Long
+luid: Str
}
class CardUnlinkReq {
+auId: Long
+luid: Str
}
FedyEvent --> CardCreatedEvent
FedyEvent --> CardLinkedEvent
FedyEvent --> CardUnlinkedEvent
FedyEvent --> DataUpdatedEvent
Fedy --> FedyEvent
Fedy --> DataPullReq
Fedy --> DataPullRes
Fedy --> DataPushReq
Fedy --> CardResolveReq
Fedy --> CardResolveRes
Fedy --> CardLinkReq
Fedy --> CardUnlinkReq
文件级更改
提示和命令与 Sourcery 互动
自定义您的体验访问您的 仪表板 以:
获取帮助Original review guide in EnglishReviewer's GuideThis PR refactors the Fedy integration from a user-centric to a card-centric event model, introducing new data pull/push APIs and card resolve/link/unlink endpoints, wiring those events across multiple controllers, and removing obsolete AquaNetUserFedy logic. Sequence diagram for card creation event notification via FedysequenceDiagram
participant Frontier
participant CardService
participant Fedy
participant RemoteService
Frontier->>CardService: registerByAccessCode(accessCode)
CardService-->>Frontier: Card
Frontier->>Fedy: onCardCreated(accessCode, card.extId)
Fedy->>RemoteService: POST /notify (cardCreated event payload)
Sequence diagram for card linking event notification via FedysequenceDiagram
participant CardController
participant CardService
participant Fedy
participant RemoteService
CardController->>CardService: registerByAccessCode(cardId, user)
CardService-->>CardController: Card
CardController->>Fedy: onCardLinked(newCard.luid, oldExtId, extId, migratedGames)
Fedy->>RemoteService: POST /notify (cardLinked event payload)
Sequence diagram for card unlinking event notification via FedysequenceDiagram
participant CardController
participant CardRepository
participant Fedy
participant RemoteService
CardController->>CardRepository: save(card)
CardController->>Fedy: onCardUnlinked(luid)
Fedy->>RemoteService: POST /notify (cardUnlinked event payload)
Sequence diagram for data update event notification via FedysequenceDiagram
participant ImportController
participant Fedy
participant RemoteService
ImportController->>Fedy: onDataUpdated(extId, game, removeOldData)
Fedy->>RemoteService: POST /notify (dataUpdated event payload)
ER diagram for removal of AquaNetUserFedy tableerDiagram
AQUA_NET_USER_FEDY {
LONG id
LONG aqua_net_user_id
DATETIME created_at
}
AQUA_NET_USER_FEDY ||--|| AQUA_NET_USER : "aqua_net_user_id references id"
%% Table AQUA_NET_USER_FEDY is dropped in this PR
Class diagram for new Fedy event model and API request/response typesclassDiagram
class Fedy {
+handleDataPull(key: Str, req: DataPullReq): DataPullRes
+handleDataPush(key: Str, req: DataPushReq): Any
+handleCardResolve(key: Str, req: CardResolveReq): CardResolveRes
+handleCardLink(key: Str, req: CardLinkReq): Any
+handleCardUnlink(key: Str, req: CardUnlinkReq): Any
+onCardCreated(luid: Str, extId: Long)
+onCardLinked(luid: Str, oldExtId: Long?, extId: Long, migratedGames: List<Str>)
+onCardUnlinked(luid: Str)
+onDataUpdated(extId: Long, game: Str, removeOldData: Bool)
}
class CardCreatedEvent {
+luid: Str
+extId: Long
}
class CardLinkedEvent {
+luid: Str
+oldExtId: Long?
+extId: Long
+migratedGames: List<Str>
}
class CardUnlinkedEvent {
+luid: Str
}
class DataUpdatedEvent {
+extId: Long
+game: Str
+removeOldData: Bool
}
class FedyEvent {
+cardCreated: CardCreatedEvent?
+cardLinked: CardLinkedEvent?
+cardUnlinked: CardUnlinkedEvent?
+dataUpdated: DataUpdatedEvent?
}
class DataPullReq {
+extId: Long
+game: Str
+exportOptions: ExportOptions
}
class DataPullRes {
+error: DataPullErr?
+result: Any?
}
class DataPullErr {
+code: Int
+message: Str
}
class DataPushReq {
+extId: Long
+game: Str
+data: JDict
+removeOldData: Bool
}
class CardResolveReq {
+luid: Str
+pairedLuid: Str?
+createIfNotFound: Bool
}
class CardResolveRes {
+extId: Long
+isGhost: Bool
+isNewlyCreated: Bool
+isPairedLuidDiverged: Bool
}
class CardLinkReq {
+auId: Long
+luid: Str
}
class CardUnlinkReq {
+auId: Long
+luid: Str
}
FedyEvent --> CardCreatedEvent
FedyEvent --> CardLinkedEvent
FedyEvent --> CardUnlinkedEvent
FedyEvent --> DataUpdatedEvent
Fedy --> FedyEvent
Fedy --> DataPullReq
Fedy --> DataPullRes
Fedy --> DataPushReq
Fedy --> CardResolveReq
Fedy --> CardResolveRes
Fedy --> CardLinkReq
Fedy --> CardUnlinkReq
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
@sourcery-ai review |
@sourcery-ai summary |
Sourcery 总结
重构 Fedy 集成,使其使用基于卡的數據管理和事件通知,引入新的數據拉取/推送和卡片管理端點,並移除舊的用戶鏈接實現。
新功能:
/data/pull
和/data/push
端點,用於通過卡片 ID 進行外部遊戲數據同步/card/resolve
、/card/link
和/card/unlink
存根端點,用於卡片生命週期管理改進:
CardRepository
和外部卡片 ID,而不是AquaNetUser
鏈接CardController
、Frontier
、AimeDB
和遊戲導入控制器中,於卡片創建、鏈接、解除鏈接和數據更新時觸發 Fedy 事件DataUpdated
事件日常任務:
AquaNetUserFedy
實體並刪除其數據庫表Original summary in English
Sourcery 总结
全面改进 Fedy 集成以使用基于卡的數據管理:用卡片解析/链接/取消链接和数据拉取/推送端点替换旧的用户链接,发送卡片生命周期和数据更新事件,相应地更新控制器和游戏处理器,并移除旧的 AquaNetUserFedy 实体
新功能:
/data/pull
和/data/push
端点,用于通过卡片extId
同步游戏数据/card/resolve
、/card/link
和/card/unlink
端点,用于管理卡片生命周期CardCreated
、CardLinked
、CardUnlinked
、DataUpdated
),以通知下游服务改进:
CardRepository
和外部卡片 ID,而不是AquaNetUser
链接DataUpdated
事件CardController
、Frontier
和AimeDB
中,在卡片创建、链接和取消链接时发送 Fedy 事件CardGameService
,以在幽灵卡和活跃卡之间迁移和孤立游戏数据杂项:
AquaNetUserFedy
实体并删除aqua_net_user_fedy
表Original summary in English
Summary by Sourcery
Overhaul Fedy integration to use card-based data management: replace legacy user linking with card resolve/link/unlink and data pull/push endpoints, emit card lifecycle and data update events, update controllers and game handlers accordingly, and remove the old AquaNetUserFedy entity
New Features:
Enhancements:
Chores: