- Increased varchar limit from 100 to 250 on PhotoUrl

- Added profile update request for admin panel
This commit is contained in:
Индекс Зиро 2025-02-20 12:22:42 +03:00
parent 34169e70d2
commit b37e4bce34
2 changed files with 7 additions and 2 deletions

View File

@ -35,6 +35,7 @@ public class EntranceController {
@Operation(description = "Get user's last entries. Username is taken from Authentication", summary = "Get user's last entry") @Operation(description = "Get user's last entries. Username is taken from Authentication", summary = "Get user's last entry")
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Request Successful."), @ApiResponse(responseCode = "200", description = "Request Successful."),
@ApiResponse(responseCode = "204", description = "No Entrances."),
@ApiResponse(responseCode = "401", description = "Unauthorized"), @ApiResponse(responseCode = "401", description = "Unauthorized"),
}) })
public ResponseEntity<EntranceDTO> getLastEntrance() { public ResponseEntity<EntranceDTO> getLastEntrance() {

View File

@ -41,9 +41,13 @@ public class EntranceServiceImpl implements EntranceService {
public ResponseEntity<EntranceDTO> getLastEntrance(Authentication auth) { public ResponseEntity<EntranceDTO> getLastEntrance(Authentication auth) {
Employee employee = employeeRepository.findByLogin(auth.getName()); Employee employee = employeeRepository.findByLogin(auth.getName());
List<EntranceDTO> entrances = employee.getEntrances().stream().map(EntranceMapper::convertToDTO).toList(); List<EntranceDTO> entrances = employee.getEntrances().stream().map(EntranceMapper::convertToDTO).toList();
System.out.println(entrances.getLast()); if(entrances.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
else {
return new ResponseEntity<>(entrances.getLast(), HttpStatus.OK); return new ResponseEntity<>(entrances.getLast(), HttpStatus.OK);
} }
}
@Override @Override
public ResponseEntity<Page<EntranceDTO>> getAllEntrances(Pageable pageable) { public ResponseEntity<Page<EntranceDTO>> getAllEntrances(Pageable pageable) {