lab6 mvc done
This commit is contained in:
parent
b6b676717c
commit
322353ff16
@ -2,10 +2,12 @@ package ru.ulstu.is.sbapp.controllers;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.ulstu.is.sbapp.configuration.WebConfiguration;
|
||||
import ru.ulstu.is.sbapp.database.model.Artist;
|
||||
import ru.ulstu.is.sbapp.database.model.Song;
|
||||
import ru.ulstu.is.sbapp.database.model.UserRole;
|
||||
import ru.ulstu.is.sbapp.database.service.AlbumService;
|
||||
|
||||
import java.util.List;
|
||||
@ -33,6 +35,7 @@ public class AlbumController {
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Secured({UserRole.AsString.ADMIN})
|
||||
public AlbumDTO createAlbum(@RequestBody @Valid AlbumDTO albumDTO){
|
||||
return new AlbumDTO(albumService.addAlbum(albumDTO.getAlbumName()));
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package ru.ulstu.is.sbapp.controllers;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.ulstu.is.sbapp.configuration.WebConfiguration;
|
||||
import ru.ulstu.is.sbapp.database.model.UserRole;
|
||||
import ru.ulstu.is.sbapp.database.service.ArtistService;
|
||||
|
||||
import java.util.List;
|
||||
@ -29,6 +32,7 @@ public class ArtistController {
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Secured({UserRole.AsString.ADMIN})
|
||||
public ArtistDTO createArtist(@RequestBody @Valid ArtistDTO artistDTO){
|
||||
return new ArtistDTO(artistService.addArtist(artistDTO.getArtistName(), artistDTO.getGenre()));
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package ru.ulstu.is.sbapp.controllers;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.ulstu.is.sbapp.configuration.WebConfiguration;
|
||||
import ru.ulstu.is.sbapp.database.model.UserRole;
|
||||
import ru.ulstu.is.sbapp.database.service.AlbumService;
|
||||
import ru.ulstu.is.sbapp.database.service.SongService;
|
||||
|
||||
@ -32,6 +35,7 @@ public class SongController {
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Secured({UserRole.AsString.ADMIN})
|
||||
public SongDTO createSong(@RequestBody @Valid SongDTO songDTO){
|
||||
return new SongDTO(songService.addSong(songDTO.getSongName(), songDTO.getDuration()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user