-
Notifications
You must be signed in to change notification settings - Fork 0
/
account-service.js
53 lines (45 loc) · 1.19 KB
/
account-service.js
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
const AccountRepository = require('./account-repository').AccountRepository;
const accountRepository = new AccountRepository();
class AccountService {
async createAccount(accountRequest) {
try {
return accountRepository.createAccount(accountRequest);
} catch (err) {
console.log(err);
throw err;
}
}
async getAccount(id) {
try {
return accountRepository.getAccount(id);
} catch (err) {
console.log(err);
throw err;
}
}
async getAccounts() {
try {
return accountRepository.getAccounts();
} catch (err) {
console.log(err);
throw err;
}
}
async updateAccount(id, accountUpdateRequest) {
try {
return accountRepository.updateAccount(id, accountUpdateRequest);
} catch (err) {
console.log(err);
throw err;
}
}
async deleteAccount(id) {
try {
return accountRepository.deleteAccount(id);
} catch (err) {
console.log(err);
throw err;
}
}
}
exports.AccountService = AccountService;