Skip to content

Commit

Permalink
login for admin is implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
ituitis20-karadagd20 committed Jan 3, 2024
1 parent 3a95915 commit 568f2f3
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Objects;

@RestController
@RequestMapping("/api/customers")
Expand Down Expand Up @@ -73,6 +74,17 @@ public ResponseEntity<CustomerDTO> getCustomerLogin(@PathVariable String email,
}
}

@GetMapping("/loginAdmin/{email}/{password}")
public ResponseEntity<CustomerDTO> getAdminLogin(@PathVariable String email,
@PathVariable String password){
CustomerDTO response = customerService.customerLogin(email, password);
if(response != null&& Objects.equals(email, "admin@admin.com")){
return new ResponseEntity<>(response, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
}

@DeleteMapping("/{id}")
public ResponseEntity<CustomerDTO> deleteCustomer(@PathVariable Integer id){
CustomerDTO deletedCustomer = customerService.deleteCustomer(id);
Expand Down

0 comments on commit 568f2f3

Please sign in to comment.