| 1 | package com.nikola.web3ednevnikbackend.controller;
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 | import com.nikola.web3ednevnikbackend.dto.gradingSystem.FullUsnaOcenkaResponseDTO;
|
|---|
| 6 |
|
|---|
| 7 | import com.nikola.web3ednevnikbackend.repository.gradingSystemRepository.FullListKrajnaOcenkaResponseDTO;
|
|---|
| 8 | import com.nikola.web3ednevnikbackend.repository.gradingSystemRepository.FullPismenaOcenkaResponseDTO;
|
|---|
| 9 | import com.nikola.web3ednevnikbackend.service.grades.OcenkaService;
|
|---|
| 10 |
|
|---|
| 11 | import org.springframework.http.HttpStatus;
|
|---|
| 12 | import org.springframework.http.ResponseEntity;
|
|---|
| 13 | import org.springframework.security.access.prepost.PreAuthorize;
|
|---|
| 14 | import org.springframework.web.bind.annotation.*;
|
|---|
| 15 |
|
|---|
| 16 | import java.util.List;
|
|---|
| 17 |
|
|---|
| 18 | @RestController
|
|---|
| 19 | @RequestMapping("/api/ocenka")
|
|---|
| 20 | public class OcenkaController {
|
|---|
| 21 | private final OcenkaService ocenkaService;
|
|---|
| 22 |
|
|---|
| 23 | public OcenkaController(OcenkaService ocenkaService) {
|
|---|
| 24 | this.ocenkaService = ocenkaService;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | @PreAuthorize("hasAnyRole('KLASEN_RAKOVODITEL','DIREKTOR_ADMIN', 'PREDMETEN_NASTAVNIK')")
|
|---|
| 28 | @GetMapping("/usnaOcenka")
|
|---|
| 29 | public ResponseEntity<List<FullUsnaOcenkaResponseDTO>> getAllUsnaOcenka(){
|
|---|
| 30 |
|
|---|
| 31 | List<FullUsnaOcenkaResponseDTO> usniOcenki = this.ocenkaService.getAllUsniOcenki();
|
|---|
| 32 | return new ResponseEntity<>(usniOcenki, HttpStatus.OK);
|
|---|
| 33 | }
|
|---|
| 34 | @GetMapping("/pismenaOcenka")
|
|---|
| 35 | @PreAuthorize("hasAnyRole('KLASEN_RAKOVODITEL','DIREKTOR_ADMIN', 'PREDMETEN_NASTAVNIK')")
|
|---|
| 36 | public ResponseEntity<List<FullPismenaOcenkaResponseDTO>> getAllPismenaOcenka(){
|
|---|
| 37 |
|
|---|
| 38 | List<FullPismenaOcenkaResponseDTO> pismeniOcenki = this.ocenkaService.getAllPismeniOcenki();
|
|---|
| 39 | return new ResponseEntity<>(pismeniOcenki, HttpStatus.OK);
|
|---|
| 40 | }
|
|---|
| 41 | @GetMapping("/krajnaOcenka")
|
|---|
| 42 | @PreAuthorize("hasAnyRole('KLASEN_RAKOVODITEL','DIREKTOR_ADMIN', 'PREDMETEN_NASTAVNIK')")
|
|---|
| 43 | public ResponseEntity<List<FullListKrajnaOcenkaResponseDTO>> getAllKrajniOcenki(){
|
|---|
| 44 |
|
|---|
| 45 | List<FullListKrajnaOcenkaResponseDTO> krajniOcenki = this.ocenkaService.getAllKrajniOcenki();
|
|---|
| 46 | return new ResponseEntity<>(krajniOcenki, HttpStatus.OK);
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 | }
|
|---|