From d12e8a5f61ef50a3fc9a335ea29debf9a0b34da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2=D0=B0=D1=82=D1=8C=D1=8F=D0=BD=D0=B0=20=D0=90=D1=80?= =?UTF-8?q?=D1=82=D0=B0=D0=BC=D0=BE=D0=BD=D0=BE=D0=B2=D0=B0?= Date: Sun, 11 Jun 2023 00:25:47 +0400 Subject: [PATCH] lab5 --- build.gradle | 10 +- .../is/sbapp/Repository/ISongRepository.java | 2 +- .../ru/ulstu/is/sbapp/WebConfiguration.java | 9 +- .../is/sbapp/controllers/AlbumController.java | 3 +- .../sbapp/controllers/AlbumMvcController.java | 154 ++++++++++++++++++ .../sbapp/controllers/ArtistController.java | 3 +- .../ulstu/is/sbapp/controllers/ArtistDTO.java | 3 + .../controllers/ArtistMvcController.java | 84 ++++++++++ .../is/sbapp/controllers/SongController.java | 4 +- .../ulstu/is/sbapp/controllers/SongDTO.java | 4 +- .../sbapp/controllers/SongMvcController.java | 67 ++++++++ .../sbapp/database/service/AlbumService.java | 11 ++ .../sbapp/database/service/ArtistService.java | 1 + .../sbapp/database/service/SongService.java | 4 +- .../database/util/error/AdviceController.java | 3 +- .../templates/add-artist-to-album.html | 37 +++++ .../templates/add-songs-to-album.html | 37 +++++ src/main/resources/templates/album-edit.html | 27 +++ src/main/resources/templates/album.html | 56 +++++++ src/main/resources/templates/artist-edit.html | 29 ++++ src/main/resources/templates/artist.html | 50 ++++++ src/main/resources/templates/default.html | 40 +++++ src/main/resources/templates/error.html | 13 ++ src/main/resources/templates/index.html | 13 ++ src/main/resources/templates/song-edit.html | 29 ++++ src/main/resources/templates/song.html | 54 ++++++ .../resources/templates/view-artists.html | 30 ++++ src/main/resources/templates/view-songs.html | 36 ++++ 28 files changed, 801 insertions(+), 12 deletions(-) create mode 100644 src/main/java/ru/ulstu/is/sbapp/controllers/AlbumMvcController.java create mode 100644 src/main/java/ru/ulstu/is/sbapp/controllers/ArtistMvcController.java create mode 100644 src/main/java/ru/ulstu/is/sbapp/controllers/SongMvcController.java create mode 100644 src/main/resources/templates/add-artist-to-album.html create mode 100644 src/main/resources/templates/add-songs-to-album.html create mode 100644 src/main/resources/templates/album-edit.html create mode 100644 src/main/resources/templates/album.html create mode 100644 src/main/resources/templates/artist-edit.html create mode 100644 src/main/resources/templates/artist.html create mode 100644 src/main/resources/templates/default.html create mode 100644 src/main/resources/templates/error.html create mode 100644 src/main/resources/templates/index.html create mode 100644 src/main/resources/templates/song-edit.html create mode 100644 src/main/resources/templates/song.html create mode 100644 src/main/resources/templates/view-artists.html create mode 100644 src/main/resources/templates/view-songs.html diff --git a/build.gradle b/build.gradle index 7162d35..cda1630 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,15 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'com.h2database:h2:2.1.210' implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.5' - implementation 'org.jetbrains:annotations:24.0.0' + + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' + implementation 'org.springframework.boot:spring-boot-devtools' + implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' + implementation 'org.webjars:bootstrap:5.1.3' + implementation 'org.webjars:jquery:3.6.0' + implementation 'org.webjars:font-awesome:6.1.0' + + implementation 'org.jetbrains:annotations:24.0.0' implementation 'org.jetbrains:annotations:24.0.0' implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.hibernate.validator:hibernate-validator' diff --git a/src/main/java/ru/ulstu/is/sbapp/Repository/ISongRepository.java b/src/main/java/ru/ulstu/is/sbapp/Repository/ISongRepository.java index 30cacc7..a32a689 100644 --- a/src/main/java/ru/ulstu/is/sbapp/Repository/ISongRepository.java +++ b/src/main/java/ru/ulstu/is/sbapp/Repository/ISongRepository.java @@ -8,6 +8,6 @@ import ru.ulstu.is.sbapp.database.model.Song; import java.util.List; public interface ISongRepository extends JpaRepository { - @Query("SELECT s.songs FROM Album s WHERE :song MEMBER OF s.songs") + @Query("SELECT a.songs FROM Album a WHERE :song MEMBER OF a.songs") List findSongsInAlbum(@Param("song") Song song); } diff --git a/src/main/java/ru/ulstu/is/sbapp/WebConfiguration.java b/src/main/java/ru/ulstu/is/sbapp/WebConfiguration.java index 35da531..8592909 100644 --- a/src/main/java/ru/ulstu/is/sbapp/WebConfiguration.java +++ b/src/main/java/ru/ulstu/is/sbapp/WebConfiguration.java @@ -2,12 +2,19 @@ package ru.ulstu.is.sbapp; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration -class WebConfiguration implements WebMvcConfigurer { +public class WebConfiguration implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**").allowedMethods("*"); } + public static final String REST_API = "/api"; + @Override + public void addViewControllers(ViewControllerRegistry registry) { + WebMvcConfigurer.super.addViewControllers(registry); + registry.addViewController("artist"); + } } \ No newline at end of file diff --git a/src/main/java/ru/ulstu/is/sbapp/controllers/AlbumController.java b/src/main/java/ru/ulstu/is/sbapp/controllers/AlbumController.java index 9881ac7..7269cdc 100644 --- a/src/main/java/ru/ulstu/is/sbapp/controllers/AlbumController.java +++ b/src/main/java/ru/ulstu/is/sbapp/controllers/AlbumController.java @@ -3,6 +3,7 @@ package ru.ulstu.is.sbapp.controllers; import jakarta.validation.Valid; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import ru.ulstu.is.sbapp.WebConfiguration; import ru.ulstu.is.sbapp.database.model.Artist; import ru.ulstu.is.sbapp.database.model.Song; import ru.ulstu.is.sbapp.database.service.AlbumService; @@ -11,7 +12,7 @@ import java.util.List; import java.util.Map; @RestController -@RequestMapping("/album") +@RequestMapping(WebConfiguration.REST_API + "/album") public class AlbumController { private final AlbumService albumService; diff --git a/src/main/java/ru/ulstu/is/sbapp/controllers/AlbumMvcController.java b/src/main/java/ru/ulstu/is/sbapp/controllers/AlbumMvcController.java new file mode 100644 index 0000000..f74e6f9 --- /dev/null +++ b/src/main/java/ru/ulstu/is/sbapp/controllers/AlbumMvcController.java @@ -0,0 +1,154 @@ +package ru.ulstu.is.sbapp.controllers; + +import jakarta.validation.Valid; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; +import ru.ulstu.is.sbapp.database.model.Artist; +import ru.ulstu.is.sbapp.database.model.Song; +import ru.ulstu.is.sbapp.database.service.AlbumService; +import ru.ulstu.is.sbapp.database.service.ArtistService; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Controller +@RequestMapping("/album") +public class AlbumMvcController { + private final AlbumService albumService; + private final ArtistService artistService; + + public AlbumMvcController(AlbumService albumService, ArtistService artistService) + { + this.albumService = albumService; + this.artistService = artistService; + } + + @GetMapping + public String getAlbums(Model model) { + model.addAttribute("albums", + albumService.findAllAlbums().stream() + .map(AlbumDTO::new) + .toList()); + return "album"; + } + + @GetMapping(value = {"/edit", "/edit/{id}"}) + public String editAlbum(@PathVariable(required = false) Long id, + Model model) { + if (id == null || id <= 0) { + model.addAttribute("albumDTO", new AlbumDTO()); + } else { + model.addAttribute("albumId", id); + model.addAttribute("albumDTO", new AlbumDTO(albumService.findAlbum(id))); + } + return "album-edit"; + } + + @PostMapping(value = {"/", "/{id}"}) + public String saveAlbum(@PathVariable(required = false) Long id, + @ModelAttribute @Valid AlbumDTO albumDTO, + BindingResult bindingResult, + Model model) { + if (bindingResult.hasErrors()) { + model.addAttribute("errors", bindingResult.getAllErrors()); + return "album-edit"; + } + if (id == null || id <= 0) { + albumService.addAlbum(albumDTO.getAlbumName()); + } else { + albumService.updateAlbum(id, albumDTO.getAlbumName()); + } + return "redirect:/album"; + } + + @PostMapping("/delete/{id}") + public String deleteAlbum(@PathVariable Long id) { + albumService.deleteAlbum(id); + return "redirect:/album"; + } + + + @GetMapping("/songs/{id}") + public String getSongsFromAlbum(@PathVariable Long id, Model model) { + List songs = albumService.getSongFromAlbum(id); + model.addAttribute("songs", songs); + return "view-songs"; + } + + @GetMapping("/artists/{id}") + public String getArtistsFromAlbum(@PathVariable Long id, Model model) { + List artists = albumService.getArtistInAlbum(id); + model.addAttribute("artists", artists); + return "view-artists"; + } + + @GetMapping("/getSongsUndefined/{id}") + public String getSongsFromUndefinedAlbum(@PathVariable Long id, Model model){ + List songs = albumService.getSongsUndefined(); + model.addAttribute("undefinedSongs", songs); + model.addAttribute("albumId", id); + model.addAttribute("albumDTO", new AlbumDTO(albumService.findAlbum(id))); + return "add-songs-to-album"; + } + + @PostMapping("/addSongs/{id}") + public String addSongToAlbum(@PathVariable Long id, + @RequestParam("songId") List songsIds){ + List songIdsAsLong = songsIds.stream() + .map(Long::parseLong) + .collect(Collectors.toList()); + + albumService.addSongToAlbum(id, songIdsAsLong); + return "redirect:/album"; + } + + @PostMapping("/deleteSongFromAlbum/{id}") + public String deleteSongFromAlbum(@PathVariable Long id) { + albumService.deleteSongFromAlbum(id); + return "redirect:/album"; + } + + @GetMapping("/getArtistsUndefined/{id}") + public String getArtistsFromUndefinedAlbum(@PathVariable Long id, Model model){ + List artists = albumService.getArtistsUndefined(id); + model.addAttribute("undefinedArtists", artists); + model.addAttribute("albumId", id); + model.addAttribute("albumDTO", new AlbumDTO(albumService.findAlbum(id))); + return "add-artist-to-album"; + } + + @PostMapping("/addArtists/{id}") + public String addArtistToAlbum(@PathVariable Long id, + @RequestParam("artistId") List artistIds){ + List artistIdsAsLong = artistIds.stream() + .map(Long::parseLong) + .collect(Collectors.toList()); + + albumService.addArtistToAlbum(id, artistIdsAsLong); + return "redirect:/album"; + } + + @GetMapping("/getAll") + public String getAll(Model model){ + Map> report = albumService.getAll(); + return "report"; + } + +// @GetMapping("/addArtistToAlbum/{id}") +// public String addArtistToAlbumForm(@PathVariable Long id, Model model) { +// model.addAttribute("albumDTO", new AlbumDTO(albumService.findAlbum(id))); +// model.addAttribute("albumId", id); +// model.addAttribute("artists", artistService.findAllArtists()); +// return "add-artist-to-album"; +// } +// +// @PostMapping("/addArtistToAlbum/{id}") +// public String addArtistToAlbum(@PathVariable Long id, +// @RequestParam("artistId") List artistIds) { +// albumService.addArtistToAlbum(id, artistIds); +// return "redirect:/album"; +// } +} diff --git a/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistController.java b/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistController.java index c0f724f..a4cdd20 100644 --- a/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistController.java +++ b/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistController.java @@ -2,12 +2,13 @@ package ru.ulstu.is.sbapp.controllers; import jakarta.validation.Valid; import org.springframework.web.bind.annotation.*; +import ru.ulstu.is.sbapp.WebConfiguration; import ru.ulstu.is.sbapp.database.service.ArtistService; import java.util.List; @RestController -@RequestMapping("/artist") +@RequestMapping(WebConfiguration.REST_API + "/artist") public class ArtistController { private final ArtistService artistService; diff --git a/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistDTO.java b/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistDTO.java index c851f9b..2594906 100644 --- a/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistDTO.java +++ b/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistDTO.java @@ -37,6 +37,9 @@ public class ArtistDTO { public void setGenre(String genre){ this.genre = genre; } + public void setArtistName(String artistName){ + this.artistName = artistName; + } public List getAlbumIds(){ return albumIds; diff --git a/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistMvcController.java b/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistMvcController.java new file mode 100644 index 0000000..017f43a --- /dev/null +++ b/src/main/java/ru/ulstu/is/sbapp/controllers/ArtistMvcController.java @@ -0,0 +1,84 @@ +package ru.ulstu.is.sbapp.controllers; + +import jakarta.validation.Valid; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; +import ru.ulstu.is.sbapp.database.service.AlbumService; +import ru.ulstu.is.sbapp.database.service.ArtistService; + +import java.util.List; + +@Controller +@RequestMapping("/artist") +public class ArtistMvcController { + private final ArtistService artistService; + + private final AlbumService albumService; + + public ArtistMvcController(ArtistService artistService, AlbumService albumService) + { + this.artistService = artistService; + this.albumService = albumService; + } + + @GetMapping + public String getArtists(Model model) { + model.addAttribute("artists", + artistService.findAllArtists().stream() + .map(ArtistDTO::new) + .toList()); + return "artist"; + } + + @GetMapping(value = {"/edit", "/edit/{id}"}) + public String editArtist(@PathVariable(required = false) Long id, + Model model) { + if (id == null || id <= 0) { + model.addAttribute("artistDTO", new ArtistDTO()); + } else { + model.addAttribute("artistId", id); + model.addAttribute("artistDTO", new ArtistDTO(artistService.findArtist(id))); + } + return "artist-edit"; + } + + @PostMapping(value = {"/", "/{id}"}) + public String saveArtist(@PathVariable(required = false) Long id, + @ModelAttribute @Valid ArtistDTO artistDTO, + BindingResult bindingResult, + Model model) { + if (bindingResult.hasErrors()) { + model.addAttribute("errors", bindingResult.getAllErrors()); + return "artist-edit"; + } + if (id == null || id <= 0) { + artistService.addArtist(artistDTO.getArtistName(), artistDTO.getGenre()); + } else { + artistService.updateArtist(id, artistDTO.getArtistName(), artistDTO.getGenre()); + } + return "redirect:/artist"; + } + + @PostMapping("/delete/{id}") + public String deleteArtist(@PathVariable Long id) { + artistService.deleteArtist(id); + return "redirect:/artist"; + } + + @GetMapping("/addArtistToAlbum/{id}") + public String addArtistToAlbumForm(@PathVariable Long id, Model model) { + model.addAttribute("artistDTO", new ArtistDTO(artistService.findArtist(id))); + model.addAttribute("artistId", id); + model.addAttribute("albums", albumService.findAllAlbums()); + return "add-artist-to-album"; + } + + @PostMapping("/addArtistToAlbum/{id}") + public String addArtistToAlbum(@PathVariable Long id, + @RequestParam("albumId") List albumIds) { + artistService.addArtistToAlbum(id, albumIds); + return "redirect:/artist"; + } +} diff --git a/src/main/java/ru/ulstu/is/sbapp/controllers/SongController.java b/src/main/java/ru/ulstu/is/sbapp/controllers/SongController.java index 7267a95..6405747 100644 --- a/src/main/java/ru/ulstu/is/sbapp/controllers/SongController.java +++ b/src/main/java/ru/ulstu/is/sbapp/controllers/SongController.java @@ -2,13 +2,14 @@ package ru.ulstu.is.sbapp.controllers; import jakarta.validation.Valid; import org.springframework.web.bind.annotation.*; +import ru.ulstu.is.sbapp.WebConfiguration; import ru.ulstu.is.sbapp.database.service.AlbumService; import ru.ulstu.is.sbapp.database.service.SongService; import java.util.List; @RestController -@RequestMapping("/song") +@RequestMapping(WebConfiguration.REST_API + "/song") public class SongController { private final SongService songService; private final AlbumService albumService; @@ -51,5 +52,4 @@ public class SongController { .map(AlbumDTO::new) .toList(); } - } diff --git a/src/main/java/ru/ulstu/is/sbapp/controllers/SongDTO.java b/src/main/java/ru/ulstu/is/sbapp/controllers/SongDTO.java index e6ab665..ea53685 100644 --- a/src/main/java/ru/ulstu/is/sbapp/controllers/SongDTO.java +++ b/src/main/java/ru/ulstu/is/sbapp/controllers/SongDTO.java @@ -39,11 +39,11 @@ public class SongDTO { return albumId; } - public void setAlbumId(long id){ + public void setAlbumId(Long id){ this.albumId = id; } - public void setId(long id){ + public void setId(Long id){ this.id = id; } diff --git a/src/main/java/ru/ulstu/is/sbapp/controllers/SongMvcController.java b/src/main/java/ru/ulstu/is/sbapp/controllers/SongMvcController.java new file mode 100644 index 0000000..ed1b3e5 --- /dev/null +++ b/src/main/java/ru/ulstu/is/sbapp/controllers/SongMvcController.java @@ -0,0 +1,67 @@ +package ru.ulstu.is.sbapp.controllers; + +import jakarta.validation.Valid; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; +import ru.ulstu.is.sbapp.database.service.AlbumService; +import ru.ulstu.is.sbapp.database.service.SongService; + +@Controller +@RequestMapping("/song") +public class SongMvcController { + private final SongService songService; + private final AlbumService albumService; + + public SongMvcController(SongService songService, AlbumService albumService) + { + this.songService = songService; + this.albumService = albumService; + } + + @GetMapping + public String getSongs(Model model) { + model.addAttribute("songs", + songService.findAllSongs().stream() + .map(SongDTO::new) + .toList()); + return "song"; + } + + @GetMapping(value = {"/edit", "/edit/{id}"}) + public String editSong(@PathVariable(required = false) Long id, + Model model) { + model.addAttribute("Albums", albumService.findAllAlbums()); + if (id == null || id <= 0) { + model.addAttribute("songDTO", new SongDTO()); + } else { + model.addAttribute("songId", id); + model.addAttribute("songDTO", new SongDTO(songService.findSong(id))); + } + return "song-edit"; + } + + @PostMapping(value = {"/", "/{id}"}) + public String saveSong(@PathVariable(required = false) Long id, + @ModelAttribute @Valid SongDTO songDTO, + BindingResult bindingResult, + Model model) { + if (bindingResult.hasErrors()) { + model.addAttribute("errors", bindingResult.getAllErrors()); + return "song-edit"; + } + if (id == null || id <= 0) { + songService.addSong(songDTO.getSongName(), songDTO.getDuration()); + } else { + songService.updateSong(id, songDTO.getSongName(), songDTO.getDuration()); + } + return "redirect:/song"; + } + + @PostMapping("/delete/{id}") + public String deleteSong(@PathVariable Long id) { + songService.deleteSong(id); + return "redirect:/song"; + } +} diff --git a/src/main/java/ru/ulstu/is/sbapp/database/service/AlbumService.java b/src/main/java/ru/ulstu/is/sbapp/database/service/AlbumService.java index 7592c6e..c6c5b25 100644 --- a/src/main/java/ru/ulstu/is/sbapp/database/service/AlbumService.java +++ b/src/main/java/ru/ulstu/is/sbapp/database/service/AlbumService.java @@ -127,6 +127,17 @@ public class AlbumService { albumRepository.save(currentAlbum); } + @Transactional + public List getArtistsUndefined(Long albumId){ + List artists = new ArrayList<>(); + for(Artist artist : artistService.findAllArtists()){ + if(!artist.getAlbumIds().contains(albumId)){ + artists.add(artist); + } + } + return artists; + } + @Transactional public Map> getAll(){ return albumRepository.getAll().stream() diff --git a/src/main/java/ru/ulstu/is/sbapp/database/service/ArtistService.java b/src/main/java/ru/ulstu/is/sbapp/database/service/ArtistService.java index 1d0b64f..0f4dda2 100644 --- a/src/main/java/ru/ulstu/is/sbapp/database/service/ArtistService.java +++ b/src/main/java/ru/ulstu/is/sbapp/database/service/ArtistService.java @@ -47,6 +47,7 @@ public class ArtistService { } final Artist currentArtist = findArtist(id); currentArtist.setArtistName(name); + currentArtist.setGenre(genre); return artistRepository.save(currentArtist); } diff --git a/src/main/java/ru/ulstu/is/sbapp/database/service/SongService.java b/src/main/java/ru/ulstu/is/sbapp/database/service/SongService.java index 3f4d54e..e8cf050 100644 --- a/src/main/java/ru/ulstu/is/sbapp/database/service/SongService.java +++ b/src/main/java/ru/ulstu/is/sbapp/database/service/SongService.java @@ -23,7 +23,7 @@ public class SongService { @Transactional public Song addSong(String songName, Double duration){ - if (!StringUtils.hasText(songName) || !StringUtils.hasText(String.valueOf(duration))) { + if (!StringUtils.hasText(songName) || duration == null) { throw new IllegalArgumentException("Song name or duration is null or empty"); } final Song song = new Song(songName, duration); @@ -43,7 +43,7 @@ public class SongService { @Transactional public Song updateSong(Long id, String name, Double duration) { - if (!StringUtils.hasText(name) || !StringUtils.hasText(String.valueOf(duration))) { + if (!StringUtils.hasText(name) || duration == null) { throw new IllegalArgumentException("Song name or duration is null or empty"); } final Song currentSong = findSong(id); diff --git a/src/main/java/ru/ulstu/is/sbapp/database/util/error/AdviceController.java b/src/main/java/ru/ulstu/is/sbapp/database/util/error/AdviceController.java index 69450bb..7b29c2c 100644 --- a/src/main/java/ru/ulstu/is/sbapp/database/util/error/AdviceController.java +++ b/src/main/java/ru/ulstu/is/sbapp/database/util/error/AdviceController.java @@ -6,6 +6,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestController; import ru.ulstu.is.sbapp.database.service.AlbumNotFoundException; import ru.ulstu.is.sbapp.database.service.ArtistNotFoundException; import ru.ulstu.is.sbapp.database.service.SongNotFoundException; @@ -13,7 +14,7 @@ import ru.ulstu.is.sbapp.database.util.validation.ValidationException; import java.util.stream.Collectors; -@ControllerAdvice +@ControllerAdvice(annotations = RestController.class) public class AdviceController { @ExceptionHandler({ AlbumNotFoundException.class, diff --git a/src/main/resources/templates/add-artist-to-album.html b/src/main/resources/templates/add-artist-to-album.html new file mode 100644 index 0000000..f8a9573 --- /dev/null +++ b/src/main/resources/templates/add-artist-to-album.html @@ -0,0 +1,37 @@ + + + + + +
+
+
+
+ + +
+
+ +
    +
  • +
    + + +
    +
  • +
+
+
+ + + Назад + +
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/add-songs-to-album.html b/src/main/resources/templates/add-songs-to-album.html new file mode 100644 index 0000000..16bd3d8 --- /dev/null +++ b/src/main/resources/templates/add-songs-to-album.html @@ -0,0 +1,37 @@ + + + + + +
+
+
+
+ + +
+
+ +
    +
  • +
    + + +
    +
  • +
+
+
+ + + Назад + +
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/album-edit.html b/src/main/resources/templates/album-edit.html new file mode 100644 index 0000000..49a336d --- /dev/null +++ b/src/main/resources/templates/album-edit.html @@ -0,0 +1,27 @@ + + + + + +
+
+
+
+ + +
+
+ + + Назад + +
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/album.html b/src/main/resources/templates/album.html new file mode 100644 index 0000000..8f06af4 --- /dev/null +++ b/src/main/resources/templates/album.html @@ -0,0 +1,56 @@ + + + +
+

Альбомы

+ +
+ + + + + + + + + + + + + +
Название
+ +
+ +
+
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/artist-edit.html b/src/main/resources/templates/artist-edit.html new file mode 100644 index 0000000..cad7060 --- /dev/null +++ b/src/main/resources/templates/artist-edit.html @@ -0,0 +1,29 @@ + + + + + +
+
+
+
+ + + + +
+
+ + + Назад + +
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/artist.html b/src/main/resources/templates/artist.html new file mode 100644 index 0000000..83daf0a --- /dev/null +++ b/src/main/resources/templates/artist.html @@ -0,0 +1,50 @@ + + + +
+

Исполнители

+ +
+ + + + + + + + + + + + + + + +
ИмяЖанр
+
+ + Изменить + + +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/default.html b/src/main/resources/templates/default.html new file mode 100644 index 0000000..4a56bc1 --- /dev/null +++ b/src/main/resources/templates/default.html @@ -0,0 +1,40 @@ + + + + + Streaming Service + + + + + + + + + +
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html new file mode 100644 index 0000000..f960e68 --- /dev/null +++ b/src/main/resources/templates/error.html @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html new file mode 100644 index 0000000..a7a11f2 --- /dev/null +++ b/src/main/resources/templates/index.html @@ -0,0 +1,13 @@ + + + + + +
+
It's works!
+ ERROR +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/song-edit.html b/src/main/resources/templates/song-edit.html new file mode 100644 index 0000000..a99a451 --- /dev/null +++ b/src/main/resources/templates/song-edit.html @@ -0,0 +1,29 @@ + + + + + +
+
+
+
+ + + + +
+
+ + + Назад + +
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/song.html b/src/main/resources/templates/song.html new file mode 100644 index 0000000..b4c89a0 --- /dev/null +++ b/src/main/resources/templates/song.html @@ -0,0 +1,54 @@ + + + + + +
+

Песни

+ +
+ + + + + + + + + + + + + + + + + +
НазваниеПродолжительностьАльбом
+
+ + Изменить + + +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/view-artists.html b/src/main/resources/templates/view-artists.html new file mode 100644 index 0000000..6d03da3 --- /dev/null +++ b/src/main/resources/templates/view-artists.html @@ -0,0 +1,30 @@ + + + + + +
+
+ + + + + + + + + + + + + + + Назад + +
ИмяЖанр
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/view-songs.html b/src/main/resources/templates/view-songs.html new file mode 100644 index 0000000..8bf9467 --- /dev/null +++ b/src/main/resources/templates/view-songs.html @@ -0,0 +1,36 @@ + + + + + +
+
+ + + + + + + + + + + + + + + + + Назад + +
НазваниеПродолжительность
+
+ +
+
+
+
+ + \ No newline at end of file