From 361d0a65ff3dd7467ed90d48fd4a89001a3e882f Mon Sep 17 00:00:00 2001 From: "ityurner02@mail.ru" Date: Thu, 4 May 2023 20:04:29 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=A04=20=D0=BF=D0=BE=D0=BB=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D1=8E?= =?UTF-8?q?=D1=82=20=D1=84=D0=B8=D0=BB=D1=8C=D0=BC=D1=8B=20=D0=B8=20=D0=B6?= =?UTF-8?q?=D0=B0=D0=BD=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/CatalogFilms.vue | 18 +++++++++++------- data.mv.db | Bin 32768 -> 45056 bytes .../is/lab1/DataBase/service/FilmService.java | 16 +++++----------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Frontend/vue-project/src/components/CatalogFilms.vue b/Frontend/vue-project/src/components/CatalogFilms.vue index 6dae233..0db422f 100644 --- a/Frontend/vue-project/src/components/CatalogFilms.vue +++ b/Frontend/vue-project/src/components/CatalogFilms.vue @@ -33,13 +33,13 @@ }, methods: { addGenre(filmId) { - let genreId = document.getElementById('genre').value; - let response = axios.post(`http://localhost:8080/film/add_genre/${filmId}`); + let genreId = document.getElementById('genres').value; + let response = axios.post(`http://localhost:8080/film/add_genre/${filmId}?genre_id=${genreId}`); console.log(response); }, delGenre(filmId) { - let genreId = document.getElementById('genre').value; - let response = axios.delete(`http://localhost:8080/film/del_genre/${filmId}`); + let genreId = document.getElementById('genres').value; + let response = axios.delete(`http://localhost:8080/film/del_genre/${filmId}?genre_id=${genreId}`); console.log(response); }, itemsGenres(genreIds) { @@ -87,7 +87,7 @@ :selectedItems="this.selectedItemsGenres">
- +
- +
+ + +
\ No newline at end of file diff --git a/data.mv.db b/data.mv.db index a977f73d80b74bbab7b4f5400ede9d0d82b38451..f1103738a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Rxy-Ib9d%C-Nv0;sJXVfZYVxRO6q*OB z)ts#Y+~f7#V=S{XXy*@Cedozas#j)KeS3lFxoP(A;Jy!O-#egor^(9K-v}5}$Ij^0 z@^xUSeoEEq(%(O398(?4G-?tt`#-V2xuFCEW5WMiD71;|zlvgR2^ z5Fn$h>nQYy?UZ!`mQ#2^Q05D-%Y4Oj*mFQ)g1tpgq)logu)5;F~vjj~eR+%q|FT>m!YKHHWUC&1zR)exl6y}%Fg!vmqK_P)DG2UqCycv@ruGm1piMYY3j2QkxyIz{(oZf#K}|TFHKFq zF?0INn{S;xcmC}Q(naOnyWM6_i4Dz-x%Jk{f&%eB6{RxsLz$VM>s@fCwHB%4uz9!D z?SZSM+W-d^xQUdjs%3>v=%6r!m%NUwtIATNyQEyTO_dm?Z3Us@!F$~^kd2Y!>bkB4 zmgxtcV>uo+R2@aHc-QwlUv~`;nW5w0P$gHvUSDmsFM$v80TZOa>6!LN#6HcJbwpkU zqx%EaSjq#K@+_qtk#mJ!HfDrg0fYMaLB6y~v0ozPl7zNW0*&F4oU6PG$UPkwxuIV$ z1~7qilxLWEj=2e+cPvlMUWKN;{hN+$^`mvyHR!H|vAYXA?t6S9tfOY3qaKg$C@SYz zT_imE!lN%d`aoszd0~`mZw%&QT-ToP=;zqN#bx2qXT<5^a-lOm=Z6*^{fH_qe!&5f zMc()vlKVaOg>}4)M_+26yHq;HnAR^}oe(jtd~?6d4wxvtv!&ScGWut&LpO80r6Y4y zX7<<=F|BkPR-<-$lS$;=zI$GdL1l`qF4 filmOpt = filmRepository.findById(filmId); - - if (filmOpt.isEmpty()) { + Film film = findFilm(filmId); + if (film == null) { throw new EntityNotFoundException(String.format("Film with id [%s] is not found", filmId)); - } - Film film = filmOpt.get(); - + } final Genre genre = genreService.findGenre(genreId); if (genre == null) { throw new EntityNotFoundException(String.format("Genre with id [%s] is not found", genreId)); @@ -89,13 +86,10 @@ public class FilmService { @Transactional public Film deleteGenre(Long filmId, Long genreId) { - final Optional filmOpt = filmRepository.findById(filmId); - - if (filmOpt.isEmpty()) { + Film film = findFilm(filmId); + if (film == null) { throw new EntityNotFoundException(String.format("Film with id [%s] is not found", filmId)); } - Film film = filmOpt.get(); - final Genre genre = genreService.findGenre(genreId); if (genre == null) { throw new EntityNotFoundException(String.format("Genre with id [%s] is not found", genreId));