feat(realunit): model wallet-scoped registration as aktionariat_registration entity#3786
feat(realunit): model wallet-scoped registration as aktionariat_registration entity#3786davidleomay wants to merge 1 commit into
Conversation
|
Solide Migration — Tabelle, Backfill, Dual-Write und das Eager-Load-Cleanup auf den 4 Controller-Endpoints sind alle sauber gelöst. Eine Naming-Frage, die mir beim Lesen wichtig erscheint, bevor das Schema gegossen ist: RealUnit (Brand) vs Aktionariat (Infrastruktur)Was die neue Tabelle modelliert (
RealUnit ist einer von potenziell mehreren Issuern, die Aktionariat als Infrastruktur nutzen. Sobald ein zweiter Issuer dazukommt, hat die Schicht-Benennung wieder Drift wie bei
Die hier vorgeschlagene Tabelle macht den gleichen Sprung eine Ebene tiefer: was wirklich modelliert wird, ist die Aktionariat-Aktionärsregistrierung. VorschlagKonsistent mit dem Konsequenz auf die Endpoint-/Service-Schicht (kann auch in eigener Folge-PR, Tabellen-Naming alleine ist schon der grosse Schritt):
Der Andere Findings (kleiner)
Wenn die Naming-Frage dich überzeugt, biete ich gerne an, einen kleinen Folge-Commit zu pushen, der |
#3785) Promote RealUnit registration from a JSON blob in kyc_step.result to a proper aktionariat_registration table with FK to user (wallet) and user_data (account). Named after the infrastructure layer (Aktionariat) not the issuer (RealUnit), consistent with the /quote/* endpoint rename. - New entity, repository, and migration with backfill from existing kyc_steps - Dual-write: KycStep rows still created for audit trail - Indexed DB lookups with ILike for case-insensitive wallet matching - Unique index on userId (one registration per wallet) - Remove kycSteps eager loading from controller endpoints - Fix migration generate script to use PSQL datasource Closes #3785
cb981ab to
a13f363
Compare
Summary
aktionariat_registrationentity (named after the infrastructure layer, not the issuer) with FK touser(wallet) anduser_data(account)kyc_step.resultwith indexed DB queries usingILikefor case-insensitive wallet matchinguserIdprevents duplicate registrations per walletDISTINCT ON)kycSteps: trueeager loadingmigration/generate.shto use PSQL datasourceAddresses review feedback
realunit_registration→aktionariat_registrationper TaprootFreak's reviewfindRegistrationnow usesILikefor DB-level case-insensitive primary lookup, falls back to loading all only for merge scenariosEntityManagerpropagation is out of scope; KycStep-first ordering is safe (orphaned KycStep = audit record, not data loss)Test plan
npm run build— cleannpm run lint— cleannpm run format:check— cleannpx jest --testPathPattern=realunit— 35/35 passingGET /realunit/wallet/statusreturns same shapeGET /realunit/register/statusreturns same booleanCloses #3785