02 module map
Карта всех модулей Auth Center: endpoints, services, модели и DB.
Карта модулей¶
| Endpoint | Service(s) | Ключевые модели | DB таблицы / views |
|---|---|---|---|
PaymentEndpoint |
PspHmacClient, TbAccountIdDeriver |
IntentDto, CreateIntentRequest, IntentQuoteRequest |
v_tx_history, v_user_tb_accounts |
WalletEndpoint |
PspHmacClient |
WalletDto, BalanceDto, AccountDto |
v_user_tb_accounts |
KycEndpoint |
KycService, StorageService |
KycVerification, KycOcrResult |
kyc_verification |
MerchantEndpoint |
PspHmacClient, InvoiceQrSigner |
InvoiceQrPayload, ConfirmInvoiceRequest |
— |
ProfileEndpoint |
PiiDecryptionService |
UserProfile, DecryptedProfile, ProfileUpdateInput |
user_profile |
NfcTagEndpoint |
NfcTagService, NfcCryptoService |
NfcTag, NfcTagDto, NfcTagRegistration |
nfc_tag |
NfcChipResetEndpoint |
NfcTagService |
NfcChipResetCredentials |
nfc_tag |
MiniappEndpoint |
LaunchJwtService |
Miniapp, MiniappItem, MiniappLaunchResult |
miniapp |
NotificationEndpoint |
NotificationPublisher |
DeviceToken |
device_token |
ConsumerEndpoint |
PspHmacClient |
PhoneResolveResult, CloseloopProfileInput |
user_profile |
DeviceEndpoint |
— | DeviceBinding, DeviceBindingResult |
device_binding |
StorageEndpoint |
StorageService |
— | — |
AuthEventEndpoint |
AuthEventService |
AuthEvent |
auth_event |
AppVersionEndpoint |
AppVersionConfig |
AppVersionStatus |
— |
AdminKycEndpoint |
KycService, PiiDecryptionService |
KycVerification, AuditLog |
kyc_verification, audit_log |
AdminUserEndpoint |
PiiDecryptionService, WalletCreationService |
User, UserProfile, AdminUserRole |
users, user_profile, audit_log |
Все endpoint-файлы: onewallet_base_server/lib/src/endpoints/ и endpoints/admin/.
Serverpod Code Generation¶
Workflow при изменении моделей или endpoints:
- Изменить/создать
onewallet_base_server/lib/src/models/*.spy.yaml(50 файлов в проекте) cd onewallet_base_server && serverpod generate— обновляетlib/src/generated/иonewallet_base_client/dart bin/main.dart --apply-migrations— применяет DB-миграции к PostgreSQL
Никогда не редактировать lib/src/generated/ и onewallet_base_client/ вручную.
Структура проекта¶
| Директория | Содержание |
|---|---|
lib/src/endpoints/ |
14 endpoint классов (публичные) |
lib/src/endpoints/admin/ |
2 admin-only endpoints |
lib/src/services/ |
Верхний уровень: KycService, RegistrationService, WalletCreationService и др. |
lib/src/services/pii/ |
PiiCryptoService, PiiHashService, PiiMaskService, PiiDecryptionService, PiiProfileWriter |
lib/src/services/payment/ |
PspHmacClient, TbAccountIdDeriver, PmCall |
lib/src/services/nfc/ |
NfcTagService, NfcCryptoService, NfcConfig |
lib/src/services/auth/ |
LaunchJwtService |
lib/src/services/qr/ |
InvoiceQrSigner |
lib/src/models/ |
50 YAML-моделей (.spy.yaml) — источник правды для кодогенерации |
lib/src/generated/ |
Авто-сгенерированный код — не редактировать |
lib/src/util/ |
endpoint_guard.dart — requireAccountType() |
lib/src/web/routes/ |
nginx_auth_route.dart, jwks_route.dart, app_config_route.dart |
lib/src/future_calls/ |
pending_wallet_creation_call.dart, registration_cleanup.dart |
Зависимости между слоями¶
flowchart TD
ep[Endpoint] --> guard[endpoint_guard.dart]
ep --> svc[Service]
svc --> pii[PII Services]
svc --> pay[PspHmacClient]
svc --> kycsvc[KycService]
svc --> notif[NotificationPublisher]
svc --> db[(PostgreSQL ORM)]
pay -->|HMAC HTTP| pm[Payment Manager]
notif -->|Redis XADD| redis[(Redis)]
kycsvc -->|HTTP| kyc[kyc-service]