Skip to content

Commit

Permalink
ISSUE-58: Update the MovieDetails component.
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlo-bystrytskyi committed Oct 23, 2024
1 parent 47972d9 commit 1a2a596
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import lombok.NonNull;

@Builder
public record MovieRatingResponse(@NonNull String id, @NonNull String movieName, Integer rating, boolean isWatched) {
public record MovieRatingResponse(@NonNull String movieId, @NonNull String movieName, Integer rating, boolean isWatched) {
public static MovieRatingResponse from(Rating rating, Movie movie) {
return MovieRatingResponse.builder()
.id(movie.getId())
.movieId(movie.getId())
.movieName(movie.getName())
.rating(rating.getRating())
.isWatched(rating.isWatched())
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Component/App/Main/Tab/MovieList/ListElement.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MovieType from "../../../../../Type/MovieType.tsx";
import MovieRatingType from "../../../../../Type/MovieRatingType.tsx";

export default function ListElement({ movie }: { movie: MovieType }) {
export default function ListElement({ movie }: { movie: MovieRatingType }) {
return (
<div>
{movie.movieName} {/* Use the movie object directly */}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Component/App/Main/Tab/MovieList/WatchedList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import MovieType from "../../../../../Type/MovieType.tsx";
import ListElement from "./ListElement.tsx";
import MovieRatingType from "../../../../../Type/MovieRatingType.tsx";


export default function WatchedList({ data }: { data: MovieType[] }) {
export default function WatchedList({ data }: { data: MovieRatingType[] }) {
return (
<div>
MovieList
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Component/App/Main/WatchedTab.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import EditMovieForm from "../EditMovieForm.tsx";
import {useFetch} from "../../../Hooks/useFetch.ts";
import MovieType from "../../../Type/MovieType.tsx";
import WatchedList from "./Tab/MovieList/WatchedList.tsx";
import MovieRatingType from "../../../Type/MovieRatingType.tsx";

export default function WatchedTab() {
const {data, state } = useFetch<MovieType>("http://localhost:5173/api/movie/watched");
const {data, state } = useFetch<MovieRatingType>("http://localhost:5173/api/movie/watched");
if (state === "loading") {
return <div>Loading...</div>;
}
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/Type/MovieRatingType.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

type MovieRatingType = {
movieId: string,
movieName: string
isWatched: boolean,
rating: number
}

export default MovieRatingType;

0 comments on commit 1a2a596

Please sign in to comment.