From 0ead6bd9695325ba9311f3e2d2f024dfcec9566a Mon Sep 17 00:00:00 2001 From: Mathis Date: Fri, 14 Jun 2024 10:08:44 +0200 Subject: [PATCH] refactor(interfaces): add Wallet related properties in User and Crypto interfaces The change adds Wallet related properties in both User and Crypto interfaces. Specifically, `IUserWallet` interface has been added to `userdata.interface.ts` and 'amount' field has been added to `IUserWalletCryptos` in `crypto.interface.ts`. Also, an extra type `ICryptoInUserWalletInfo` extending `ICryptoInWalletInfo` has been added with `owned_amount` field. --- src/interfaces/crypto.interface.ts | 7 ++++++- src/interfaces/userdata.interface.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/interfaces/crypto.interface.ts b/src/interfaces/crypto.interface.ts index c5327a7..1d658f3 100644 --- a/src/interfaces/crypto.interface.ts +++ b/src/interfaces/crypto.interface.ts @@ -1,5 +1,6 @@ export interface IUserWalletCryptos { - Crypto?: ICryptoInWalletInfo; + Crypto: ICryptoInWalletInfo; + amount: number; } export interface ICryptoInWalletInfo { @@ -12,6 +13,10 @@ export interface ICryptoInWalletInfo { updated_at: string; } +export interface ICryptoInUserWalletInfo extends ICryptoInWalletInfo { + owned_amount: number; +} + export type IAllTrades = ITrade[]; export interface ITrade { diff --git a/src/interfaces/userdata.interface.ts b/src/interfaces/userdata.interface.ts index a093af2..2588373 100644 --- a/src/interfaces/userdata.interface.ts +++ b/src/interfaces/userdata.interface.ts @@ -1,3 +1,9 @@ +import { + ICryptoInUserWalletInfo, + type ICryptoInWalletInfo, + IUserWalletCryptos, +} from "@/interfaces/crypto.interface"; + export interface IUserData { id: string; firstName: string; @@ -11,4 +17,12 @@ export interface IUserData { age: number; created_at: string; updated_at: string; + //TODO get on register + wallet: IUserWallet; +} + +export interface IUserWallet { + uat: number; + update_interval: number; + owned_cryptos: ICryptoInUserWalletInfo[]; }