88
99import com .example .customer .model .Customers ;
1010import com .example .customer .repository .CustomersRepository ;
11- import lombok .extern .slf4j .Slf4j ;
1211import org .springframework .http .HttpStatus ;
1312import org .springframework .http .ResponseEntity ;
1413import org .springframework .web .bind .annotation .DeleteMapping ;
2322
2423@ RestController
2524@ RequestMapping ("/api/v1" )
26- @ Slf4j
2725public class CustomerController {
2826 final CustomersRepository customersRepository ;
2927
@@ -34,14 +32,12 @@ public CustomerController(CustomersRepository customersRepository) {
3432 @ ResponseStatus (HttpStatus .OK )
3533 @ GetMapping ("/customer" )
3634 public List <Customers > findAll () {
37- log .info ("CUSTOMER: findAll" );
3835 return customersRepository .findAll ();
3936 }
4037
4138 @ ResponseStatus (HttpStatus .OK )
4239 @ GetMapping ("/customer/name/{customerName}" )
4340 public List <Customers > findByCustomerByName (@ PathVariable String customerName ) {
44- log .info ("CUSTOMER: findByCustomerByName" );
4541 return customersRepository .findByCustomerNameIsContaining (customerName );
4642 }
4743
@@ -53,7 +49,6 @@ public List<Customers> findByCustomerByName(@PathVariable String customerName) {
5349 */
5450 @ GetMapping ("/customer/{id}" )
5551 public ResponseEntity <Customers > getCustomerById (@ PathVariable ("id" ) String id ) {
56- log .info ("CUSTOMER: getCustomerById" );
5752 Optional <Customers > customerData = customersRepository .findById (id );
5853 try {
5954 return customerData .map (customers -> new ResponseEntity <>(customers , HttpStatus .OK ))
@@ -70,7 +65,6 @@ public ResponseEntity<Customers> getCustomerById(@PathVariable("id") String id)
7065 */
7166 @ GetMapping ("/customer/byemail/{email}" )
7267 public List <Customers > getCustomerByEmail (@ PathVariable ("email" ) String email ) {
73- log .info ("CUSTOMER: getCustomerByEmail" );
7468 return customersRepository .findByCustomerEmailIsContaining (email );
7569 }
7670
@@ -81,7 +75,6 @@ public List<Customers> getCustomerByEmail(@PathVariable("email") String email) {
8175 */
8276 @ PostMapping ("/customer" )
8377 public ResponseEntity <Customers > createCustomer (@ RequestBody Customers customer ) {
84- log .info ("CUSTOMER: createCustomer" );
8578 try {
8679 Customers newCustomer = customersRepository .save (new Customers (
8780 customer .getCustomerId (),
@@ -103,7 +96,6 @@ public ResponseEntity<Customers> createCustomer(@RequestBody Customers customer)
10396 */
10497 @ PutMapping ("/customer/{id}" )
10598 public ResponseEntity <Customers > updateCustomer (@ PathVariable ("id" ) String id , @ RequestBody Customers customer ) {
106- log .info ("CUSTOMER: updateCustomer" );
10799 Optional <Customers > customerData = customersRepository .findById (id );
108100 try {
109101 if (customerData .isPresent ()) {
@@ -127,7 +119,6 @@ public ResponseEntity<Customers> updateCustomer(@PathVariable("id") String id, @
127119 */
128120 @ DeleteMapping ("/customer/{customerId}" )
129121 public ResponseEntity <HttpStatus > deleteCustomer (@ PathVariable ("customerId" ) String customerId ) {
130- log .info ("CUSTOMER: deleteCustomer" );
131122 try {
132123 customersRepository .deleteById (customerId );
133124 return new ResponseEntity <>(HttpStatus .NO_CONTENT );
@@ -143,7 +134,6 @@ public ResponseEntity<HttpStatus> deleteCustomer(@PathVariable("customerId") Str
143134 */
144135 @ PostMapping ("/customer/applyLoan/{amount}" )
145136 public ResponseEntity <HttpStatus > applyForLoan (@ PathVariable ("amount" ) long amount ) {
146- log .info ("CUSTOMER: applyForLoan" );
147137 try {
148138 // Check Credit Rating
149139 // Amount vs Rating approval?
0 commit comments