[Wallet Messenger Service] - ERD, API
This post was migrated from Tistory. You can find the original here.
[Membership Fee Management Messenger Service - Wireframe, ERD, API, Brunch
An MSA-based membership fee management messenger service handling large-scale traffic 2023.07.31 - [Project/Membership Fee Management Messenger Service] - Messenger service project ERD, API design Live voice/video is a key point for improving performance
cornpip.tistory.com](https://cornpip.tistory.com/46)
The ERD, wireframe, and API links can be found in the previous post.
APIs related to membership fee management
The current ERD looks like the above. Wallet is a supertype using @Inheritance(strategy = InheritanceType.JOINED), and it has a subtype relationship with GroupWallet and PersonalWallet.
A User can open one PersonalWallet and multiple GroupWallets.
The GroupWallets a user has joined can be found through UserGroupWallet.
Transaction records every transaction between wallets (wallet <-> wallet).
There are four possible cases for a transaction:
- PersonalWallet -> PersonalWallet
- PersonalWallet -> GroupWallet
- GroupWallet -> PersonalWallet
- GroupWallet -> GroupWallet
If a transfer is made from a GroupWallet, a row is inserted into GroupSpendDetail indicating which authorized user in the GroupWallet made the transfer.
Transaction has a transferType field, which has two types:
- SEND
- RECEIVE
When a transfer happens, two rows are inserted into Transaction: one SEND and one RECEIVE.
- A sends 50,000 won to B (SEND)
- B receives 50,000 won from A (RECEIVE)
The following need to be considered when making a transfer:
- Is this an appropriate User? - The user must be the wallet’s owner, or, in the case of a GroupWallet, a member with the appropriate authority.
- Does the account hold a sufficient balance to transfer?
The following need to be considered when making a reservation:
- Priority when there are reservations for the same time slot
- Applying the correct update depending on whether the reservation succeeds or fails
Progress
The three biggest domains are user, channel, and wallet.
I built out the wallet domain (excluding reservation), while my teammates built out user and channel.
The major domains are mostly in place now, and chat is nearly fully implemented.
This week’s MVP goal is to get a reasonable set of client-side features working, so I’m starting on the React work today.
The faster the client-side work wraps up, the sooner we can get to the challenging points like MSA, high-volume traffic, and concurrency.
I’m aiming to finish the client-side work by tomorrow, and if it turns out to be taking too much time, I’ll consider other alternatives.
