8
8
9
9
import com .example .customer .model .Customers ;
10
10
import com .example .customer .repository .CustomersRepository ;
11
- import lombok .extern .slf4j .Slf4j ;
12
11
import org .springframework .http .HttpStatus ;
13
12
import org .springframework .http .ResponseEntity ;
14
13
import org .springframework .web .bind .annotation .DeleteMapping ;
23
22
24
23
@ RestController
25
24
@ RequestMapping ("/api/v1" )
26
- @ Slf4j
27
25
public class CustomerController {
28
26
final CustomersRepository customersRepository ;
29
27
@@ -34,14 +32,12 @@ public CustomerController(CustomersRepository customersRepository) {
34
32
@ ResponseStatus (HttpStatus .OK )
35
33
@ GetMapping ("/customer" )
36
34
public List <Customers > findAll () {
37
- log .info ("CUSTOMER: findAll" );
38
35
return customersRepository .findAll ();
39
36
}
40
37
41
38
@ ResponseStatus (HttpStatus .OK )
42
39
@ GetMapping ("/customer/name/{customerName}" )
43
40
public List <Customers > findByCustomerByName (@ PathVariable String customerName ) {
44
- log .info ("CUSTOMER: findByCustomerByName" );
45
41
return customersRepository .findByCustomerNameIsContaining (customerName );
46
42
}
47
43
@@ -53,7 +49,6 @@ public List<Customers> findByCustomerByName(@PathVariable String customerName) {
53
49
*/
54
50
@ GetMapping ("/customer/{id}" )
55
51
public ResponseEntity <Customers > getCustomerById (@ PathVariable ("id" ) String id ) {
56
- log .info ("CUSTOMER: getCustomerById" );
57
52
Optional <Customers > customerData = customersRepository .findById (id );
58
53
try {
59
54
return customerData .map (customers -> new ResponseEntity <>(customers , HttpStatus .OK ))
@@ -70,7 +65,6 @@ public ResponseEntity<Customers> getCustomerById(@PathVariable("id") String id)
70
65
*/
71
66
@ GetMapping ("/customer/byemail/{email}" )
72
67
public List <Customers > getCustomerByEmail (@ PathVariable ("email" ) String email ) {
73
- log .info ("CUSTOMER: getCustomerByEmail" );
74
68
return customersRepository .findByCustomerEmailIsContaining (email );
75
69
}
76
70
@@ -81,7 +75,6 @@ public List<Customers> getCustomerByEmail(@PathVariable("email") String email) {
81
75
*/
82
76
@ PostMapping ("/customer" )
83
77
public ResponseEntity <Customers > createCustomer (@ RequestBody Customers customer ) {
84
- log .info ("CUSTOMER: createCustomer" );
85
78
try {
86
79
Customers newCustomer = customersRepository .save (new Customers (
87
80
customer .getCustomerId (),
@@ -103,7 +96,6 @@ public ResponseEntity<Customers> createCustomer(@RequestBody Customers customer)
103
96
*/
104
97
@ PutMapping ("/customer/{id}" )
105
98
public ResponseEntity <Customers > updateCustomer (@ PathVariable ("id" ) String id , @ RequestBody Customers customer ) {
106
- log .info ("CUSTOMER: updateCustomer" );
107
99
Optional <Customers > customerData = customersRepository .findById (id );
108
100
try {
109
101
if (customerData .isPresent ()) {
@@ -127,7 +119,6 @@ public ResponseEntity<Customers> updateCustomer(@PathVariable("id") String id, @
127
119
*/
128
120
@ DeleteMapping ("/customer/{customerId}" )
129
121
public ResponseEntity <HttpStatus > deleteCustomer (@ PathVariable ("customerId" ) String customerId ) {
130
- log .info ("CUSTOMER: deleteCustomer" );
131
122
try {
132
123
customersRepository .deleteById (customerId );
133
124
return new ResponseEntity <>(HttpStatus .NO_CONTENT );
@@ -143,7 +134,6 @@ public ResponseEntity<HttpStatus> deleteCustomer(@PathVariable("customerId") Str
143
134
*/
144
135
@ PostMapping ("/customer/applyLoan/{amount}" )
145
136
public ResponseEntity <HttpStatus > applyForLoan (@ PathVariable ("amount" ) long amount ) {
146
- log .info ("CUSTOMER: applyForLoan" );
147
137
try {
148
138
// Check Credit Rating
149
139
// Amount vs Rating approval?
0 commit comments