From 1c6f26f14491b16114e12025640c5723905d00bf Mon Sep 17 00:00:00 2001 From: Anu Viswan Date: Sat, 28 Jun 2025 07:32:50 +0530 Subject: [PATCH] added recent movies in dashboard --- .../nt/src/apiService/MovieApiService.ts | 25 ++++++- .../private/movie/MovieMiniCard.vue | 67 +++++++++++++++++++ .../nt/src/pages/private/DashboardPage.vue | 67 ++++++++++++++++++- .../types/apirequestresponsetypes/Movie.ts | 4 ++ 4 files changed, 157 insertions(+), 6 deletions(-) create mode 100644 client/nt.webclient/vue3withtypescript/nt/src/components/private/movie/MovieMiniCard.vue diff --git a/client/nt.webclient/vue3withtypescript/nt/src/apiService/MovieApiService.ts b/client/nt.webclient/vue3withtypescript/nt/src/apiService/MovieApiService.ts index 0ebb74e8..b2436488 100644 --- a/client/nt.webclient/vue3withtypescript/nt/src/apiService/MovieApiService.ts +++ b/client/nt.webclient/vue3withtypescript/nt/src/apiService/MovieApiService.ts @@ -1,5 +1,5 @@ import { ApiServiceBase } from './ApiServiceBase'; -import { ISearchMoviesResponse,MovieResponse } from '@/types/apirequestresponsetypes/Movie'; +import { IRecentMoviesResponse, ISearchMoviesResponse,MovieResponse } from '@/types/apirequestresponsetypes/Movie'; import { Movie } from "@/types/MovieTypes" import { DocumentNode, gql } from '@apollo/client/core'; @@ -8,7 +8,6 @@ class MovieApiService extends ApiServiceBase { searchTerm: string ): Promise { - console.log('ready - create query') const search_movie: DocumentNode = gql` query findMovieQuery($searchTerm:String!) { findMovie(searchTerm: $searchTerm) { @@ -26,13 +25,33 @@ class MovieApiService extends ApiServiceBase { } } } - ` + `; console.log('ready to search for movies') const response = await this.queryGraphQl(search_movie,{ searchTerm}) const movies = response.findMovie.map(movieResponse => (ConvertToMovieDto(movieResponse))); return movies; } + + public async GetRecentMovies(count:number):Promise{ + + const recent_movie: DocumentNode = gql` + query recentMovieQuery($count:Int){ + recentMovies(count: $count){ + title, + movieLanguage, + releaseDate + cast{ + name + } + } + } + `; + + const response = await this.queryGraphQl(recent_movie,{count}); + const movies = response.recentMovies.map(movieResponse => (ConvertToMovieDto(movieResponse))); + return movies; + } } function ConvertToMovieDto(movieResponse:MovieResponse):Movie{ diff --git a/client/nt.webclient/vue3withtypescript/nt/src/components/private/movie/MovieMiniCard.vue b/client/nt.webclient/vue3withtypescript/nt/src/components/private/movie/MovieMiniCard.vue new file mode 100644 index 00000000..ddcbb331 --- /dev/null +++ b/client/nt.webclient/vue3withtypescript/nt/src/components/private/movie/MovieMiniCard.vue @@ -0,0 +1,67 @@ + + + + diff --git a/client/nt.webclient/vue3withtypescript/nt/src/pages/private/DashboardPage.vue b/client/nt.webclient/vue3withtypescript/nt/src/pages/private/DashboardPage.vue index 9acebb43..9ac54df5 100644 --- a/client/nt.webclient/vue3withtypescript/nt/src/pages/private/DashboardPage.vue +++ b/client/nt.webclient/vue3withtypescript/nt/src/pages/private/DashboardPage.vue @@ -1,7 +1,68 @@ - + + + diff --git a/client/nt.webclient/vue3withtypescript/nt/src/types/apirequestresponsetypes/Movie.ts b/client/nt.webclient/vue3withtypescript/nt/src/types/apirequestresponsetypes/Movie.ts index 55e722e1..1b44db26 100644 --- a/client/nt.webclient/vue3withtypescript/nt/src/types/apirequestresponsetypes/Movie.ts +++ b/client/nt.webclient/vue3withtypescript/nt/src/types/apirequestresponsetypes/Movie.ts @@ -5,6 +5,10 @@ export interface ISearchMoviesResponse extends IGraphQlResponseBase { } +export interface IRecentMoviesResponse extends IGraphQlResponseBase{ + recentMovies : MovieResponse[] +} + export interface MovieResponse { title: string; movieLanguage: string;