-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cdff30
commit f1c3ffb
Showing
2 changed files
with
26 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,14 @@ | |
|
||
import com.production.ehayvanbackendapi.DTO.CustomerDTO; | ||
import com.production.ehayvanbackendapi.DTO.PetDTO; | ||
import com.production.ehayvanbackendapi.DTO.VeterinarianDTO; | ||
import com.production.ehayvanbackendapi.DTO.request.CreateOrUpdateCustomerDTO; | ||
import com.production.ehayvanbackendapi.DTO.request.RegisterCustomerDTO; | ||
import com.production.ehayvanbackendapi.Services.CustomerService; | ||
import com.production.ehayvanbackendapi.Services.VeterinarianService; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import org.springframework.http.HttpStatus; | ||
|
@@ -23,9 +26,12 @@ | |
@RequestMapping("/api/customers") | ||
public class CustomerController { | ||
private final CustomerService customerService; | ||
private final VeterinarianService veterinarianService; | ||
|
||
public CustomerController(CustomerService customerService) { | ||
|
||
public CustomerController(CustomerService customerService, VeterinarianService veterinarianService) { | ||
this.customerService = customerService; | ||
this.veterinarianService = veterinarianService; | ||
} | ||
|
||
@GetMapping("/{id}") | ||
|
@@ -74,14 +80,28 @@ public ResponseEntity<CustomerDTO> getCustomerLogin(@PathVariable String email, | |
} | ||
} | ||
|
||
// @GetMapping("/loginAdmin/{email}/{password}") | ||
// public ResponseEntity<CustomerDTO> AdminLogin(@PathVariable String email, | ||
// @PathVariable String password){ | ||
// CustomerDTO response = customerService.customerLogin(email, password); | ||
// if(response != null&& Objects.equals(email, "[email protected]")){ | ||
// return new ResponseEntity<>(response, HttpStatus.OK); | ||
// } else { | ||
// return new ResponseEntity<>(HttpStatus.NOT_FOUND); | ||
// } | ||
// } | ||
|
||
@GetMapping("/loginAdmin/{email}/{password}") | ||
public ResponseEntity<CustomerDTO> getAdminLogin(@PathVariable String email, | ||
@PathVariable String password){ | ||
public String getAdminLogin(@PathVariable String email, | ||
@PathVariable String password, Model model){ | ||
CustomerDTO response = customerService.customerLogin(email, password); | ||
if(response != null&& Objects.equals(email, "[email protected]")){ | ||
return new ResponseEntity<>(response, HttpStatus.OK); | ||
List<VeterinarianDTO> veterinarians = veterinarianService.getAllVeterinarians(); | ||
model.addAttribute("veterinarians", veterinarians); | ||
model.addAttribute("viewType", "default"); | ||
return "redirect:/api/veterinarians/desktop"; | ||
} else { | ||
return new ResponseEntity<>(HttpStatus.NOT_FOUND); | ||
return "redirect:/api/customers/login"; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters