@@ -20,7 +20,6 @@ export class BeneficiariesService {
2020 userId : string ,
2121 dto : CreateBeneficiaryDto ,
2222 ) : Promise < Beneficiary > {
23- // If this is set as default, unset all other defaults first
2423 if ( dto . isDefault ) {
2524 await this . beneficiaryRepository . update (
2625 { userId, isDefault : true } ,
@@ -61,45 +60,7 @@ export class BeneficiariesService {
6160 return beneficiary ;
6261 }
6362
64- async updateBeneficiary (
65- userId : string ,
66- id : string ,
67- dto : UpdateBeneficiaryDto ,
68- ) : Promise < Beneficiary > {
69- const beneficiary = await this . getBeneficiaryById ( userId , id ) ;
70-
71- Object . assign ( beneficiary , dto ) ;
72- return this . beneficiaryRepository . save ( beneficiary ) ;
73- }
74-
75- async deleteBeneficiary ( userId : string , id : string ) : Promise < void > {
76- const beneficiary = await this . getBeneficiaryById ( userId , id ) ;
77- await this . beneficiaryRepository . remove ( beneficiary ) ;
78- }
79-
80- async setDefault ( userId : string , id : string ) : Promise < Beneficiary > {
81- // Validate the beneficiary belongs to this user
82- const beneficiary = await this . getBeneficiaryById ( userId , id ) ;
83-
84- // Unset all current defaults for this user
85- await this . beneficiaryRepository . update (
86- { userId, isDefault : true } ,
87- { isDefault : false } ,
88- ) ;
89-
90- // Set new default
91- beneficiary . isDefault = true ;
92- return this . beneficiaryRepository . save ( beneficiary ) ;
93- }
94-
95- /**
96- * Used by the withdrawal flow — fetch wallet address from a saved beneficiary.
97- */
98- async resolveWalletAddress (
99- userId : string ,
100- beneficiaryId : string ,
101- ) : Promise < string > {
102- const beneficiary = await this . getBeneficiaryById ( userId , beneficiaryId ) ;
103- return beneficiary . walletAddress ;
63+ async updateLastUsed ( id : string ) : Promise < void > {
64+ await this . beneficiaryRepository . update ( id , { lastUsedAt : new Date ( ) } ) ;
10465 }
105- }
66+ }
0 commit comments