-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.js
More file actions
32 lines (29 loc) · 920 Bytes
/
models.js
File metadata and controls
32 lines (29 loc) · 920 Bytes
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
class Customer {
constructor(id, name, email) {
this.id = id;
this.name = name;
this.email = email;
}
}
class Account {
constructor(id, customerId, type, balance, createdAt) {
this.id = id;
this.customerId = customerId;
this.type = type; // "current" or "savings"
this.balance = balance;
this.createdAt = createdAt;
}
}
class Transaction {
constructor(id, accountId, customerId, type, amount, fromAccountId = null, toAccountId = null, createdAt) {
this.id = id;
this.accountId = accountId;
this.customerId = customerId;
this.type = type; // "transfer", "payment", "bonus", "interest", "fee"
this.amount = amount;
this.fromAccountId = fromAccountId;
this.toAccountId = toAccountId;
this.createdAt = createdAt;
}
}
module.exports = { Customer, Account, Transaction };