Types

TypeScript types and interfaces used throughout the YourBanK platform.

Bank Types

Core types for bank accounts and transactions:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Bank Account Types
export interface BankAccount {
  id: string
  appwriteItemId: string
  name: string
  mask: string
  institutionId: string
  currentBalance: number
  availableBalance: number
  type: AccountType
  subtype: AccountSubtype
  officialName?: string
  shareableId?: string
}

export type AccountType = 
  | "investment" 
  | "credit" 
  | "depository" 
  | "loan" 
  | "other"

export type AccountSubtype =
  | "checking"
  | "savings"
  | "credit card"
  | "money market"
  | "prepaid"
  | "personal"

// Transaction Types
export interface Transaction {
  id: string
  accountId: string
  amount: number
  date: string
  name: string
  merchantName?: string
  category: TransactionCategory
  type: TransactionType
  pending: boolean
  description?: string
}

export type TransactionCategory =
  | "Food and Drink"
  | "Travel"
  | "Shopping"
  | "Payment"
  | "Transfer"
  | "Bank Fees"

export type TransactionType = 
  | "debit" 
  | "credit"

User Types

Types for user profiles and authentication:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export interface User {
  id: string
  email: string
  name: string
  imageUrl?: string
  preferences: UserPreferences
  createdAt: string
  updatedAt: string
}

export interface UserPreferences {
  theme: "light" | "dark" | "system"
  currency: string
  notifications: NotificationSettings
}

export interface NotificationSettings {
  email: boolean
  push: boolean
  transactions: boolean
  balances: boolean
  security: boolean
}

Component Props

Types for component props and configurations:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// AnimatedCounter Props
export interface AnimatedCounterProps {
  value: number
  duration?: number
  formatOptions?: Intl.NumberFormatOptions
  className?: string
}

// BankCard Props
export interface BankCardProps {
  account: BankAccount
  userName: string
  className?: string
  showBalance?: boolean
}

// TransactionTable Props
export interface TransactionTableProps {
  transactions: Transaction[]
  pageSize?: number
  sortable?: boolean
  filterable?: boolean
  onRowClick?: (transaction: Transaction) => void
}

API Response Types

Types for API responses and error handling:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
export interface ApiResponse<T> {
  data?: T
  error?: ApiError
  status: number
}

export interface ApiError {
  code: string
  message: string
  details?: Record<string, any>
}

export interface PaginatedResponse<T> {
  items: T[]
  total: number
  page: number
  pageSize: number
  hasMore: boolean
}