Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Bruno Predot
/
tmdb_test
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Bruno Predot
2025-05-13 17:46:55 +0200
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
3d5fd1a33e994449a070cb3bbf530850c52d44bc
3d5fd1a3
2 parents
412a8380
99e7900b
Merge branch 'hotfix/0.3.2'
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
86 additions
and
47 deletions
components/MovieCard.vue
components/MovieCommentList.vue
components/details/ScoreAndVote.vue
components/form/MovieCommentForm.vue
eslint.config.mjs
interfaces/credit.ts
interfaces/movie.ts
models/movieComment.ts
package.json
pages/movies/[id]/index.vue
type/commentForm.ts
vite.config.ts
vitest.config.m.ts
components/MovieCard.vue
View file @
3d5fd1a
...
...
@@ -37,8 +37,12 @@ defineProps({
</div>
</div>
<div class="p-4">
<h2 class="text-lg font-bold mb-1 line-clamp-1">{{ movie.title }}</h2>
<p class="text-sm text-gray-400">{{ useDateFormat(movie.release_date, "DD-MM-YYYY") }}</p>
<h2 class="text-lg font-bold mb-1 line-clamp-1">
{{ movie.title }}
</h2>
<p class="text-sm text-gray-400">
{{ useDateFormat(movie.release_date, "DD-MM-YYYY") }}
</p>
</div>
</section>
</template>
...
...
components/MovieCommentList.vue
View file @
3d5fd1a
...
...
@@ -47,7 +47,9 @@ watch(
{{ comment.rating }}
</section>
</div>
<p :id="`message${index}`" class="text-gray-300">{{ comment.message }}</p>
<p :id="`message${index}`" class="text-gray-300">
{{ comment.message }}
</p>
</div>
</section>
<!-- Si aucun commentaire -->
...
...
components/details/ScoreAndVote.vue
View file @
3d5fd1a
<script lang="ts" setup>
//#region --Props--.
const props =
defineProps({
defineProps({
score: {
type: Number,
required: true,
...
...
@@ -35,7 +35,9 @@ const formatVoteCount = (count: number) => {
</section>
<section>
<p class="font-semibold">Note TMDB</p>
<div class="text-sm text-gray-400">{{ formatVoteCount(nbVote) }}</div>
<div class="text-sm text-gray-400">
{{ formatVoteCount(nbVote) }}
</div>
</section>
</section>
</template>
...
...
components/form/MovieCommentForm.vue
View file @
3d5fd1a
...
...
@@ -56,9 +56,9 @@ const formData = reactive({
const v$ = useVuelidate(rules, formData);
//#endregion
const errormessages = computed(() => {
return v$.value.message.$errors.map((e) => e.$message);
});
//
const errormessages = computed(() => {
//
return v$.value.message.$errors.map((e) => e.$message);
//
});
//#region --Function--.
async function submitComment() {
...
...
@@ -129,7 +129,7 @@ function handleMessageEvent(event: string) {
</span>
<span v-else>Publier le commentaire</span>
</v-btn>
<v-btn class="mt-6 mr-4" color="primary" @click="clear"> effacer</v-btn>
<v-btn class="mt-6 mr-4" color="primary" @click="clear"> effacer
</v-btn>
</VForm>
</section>
</template>
...
...
eslint.config.mjs
View file @
3d5fd1a
// @ts-check
import withNuxt from "./.nuxt/eslint.config.mjs";
import js from "@eslint/js";
import eslintPluginVue from "eslint-plugin-vue";
import ts from "typescript-eslint";
export default withNuxt();
// Your custom configs here
export default withNuxt(
// Your custom configs here
js.configs.recommended,
...ts.configs.recommended,
...eslintPluginVue.configs["flat/recommended"],
{
files: ["*.vue", "**/*.vue"],
languageOptions: {
parserOptions: {
parser: "@typescript-eslint/parser",
},
},
rules: {
"vue/multi-word-component-names": "off",
},
},
// your custom flat configs go here, for example:
// {
// files: ['**/*.ts', '**/*.tsx'],
// rules: {
// 'no-console': 'off' // allow console.log in TypeScript files
// }
// },
// {
// ...
// }
);
...
...
interfaces/credit.ts
View file @
3d5fd1a
...
...
@@ -9,8 +9,8 @@ export interface CreditInterface {
export
type
CreditsResponse
=
{
id
:
number
;
cast
:
CreditInterface
[]
,
crew
:
CreditInterface
[]
,
cast
:
CreditInterface
[]
;
crew
:
CreditInterface
[]
;
movie_id
:
unknown
;
movie
:
MovieInterface
;
}
}
;
...
...
interfaces/movie.ts
View file @
3d5fd1a
import
type
{
Credit
Interface
,
Credit
sResponse
}
from
"~/interfaces/credit"
;
import
type
{
CreditsResponse
}
from
"~/interfaces/credit"
;
export
interface
MovieInterface
{
id
:
number
;
...
...
@@ -12,7 +12,7 @@ export interface MovieInterface {
popularity
:
number
;
poster_path
:
string
|
null
;
release_date
:
string
;
runtime
:
number
runtime
:
number
;
title
:
string
;
video
:
boolean
;
vote_average
:
number
;
...
...
@@ -21,6 +21,6 @@ export interface MovieInterface {
}
export
type
Genre
=
{
id
:
number
,
name
:
string
,
}
\ No newline at end of file
id
:
number
;
name
:
string
;
};
...
...
models/movieComment.ts
View file @
3d5fd1a
...
...
@@ -22,10 +22,10 @@ export class MovieComment extends Model {
return
{
// Attributs.
id
:
this
.
uid
(),
createdAt
:
this
.
string
(
''
),
username
:
this
.
string
(
''
),
message
:
this
.
string
(
''
),
rating
:
this
.
string
(
''
),
createdAt
:
this
.
string
(
""
),
username
:
this
.
string
(
""
),
message
:
this
.
string
(
""
),
rating
:
this
.
string
(
""
),
// Relations.
movie_id
:
this
.
attr
(
null
),
movie
:
this
.
belongsTo
(
Movie
,
"movie_id"
,
"id"
),
...
...
package.json
View file @
3d5fd1a
...
...
@@ -9,7 +9,7 @@
"generate"
:
"nuxt generate"
,
"preview"
:
"nuxt preview"
,
"postinstall"
:
"nuxt prepare"
,
"lint:js"
:
"eslint --ext \".ts,.vue\" ."
,
"lint:js"
:
"eslint --ext \".ts,.vue\" .
--fix
"
,
"lint:prettier"
:
"prettier --write ."
,
"lint"
:
"npm run lint:js && npm run lint:prettier"
,
"format"
:
"prettier --write \"{components,pages,plugins,middleware,layouts,composables,assets}/**/*.{js,jsx,ts,tsx,vue,html,css,scss,json,md}\""
,
...
...
pages/movies/[id]/index.vue
View file @
3d5fd1a
...
...
@@ -173,7 +173,9 @@ onMounted(() => {
<!-- Informations du film -->
<section class="w-full md:w-2/3 lg:w-3/4">
<h1 class="text-3xl md:text-4xl font-bold mb-2">{{ movie.title }}</h1>
<h1 class="text-3xl md:text-4xl font-bold mb-2">
{{ movie.title }}
</h1>
<p v-if="movie.release_date" class="text-gray-400 mb-4">
{{ useDateFormat(movie.release_date, "DD-MM-YYYY") }} • {{ formatRuntime(movie.runtime) }}
</p>
...
...
@@ -187,7 +189,9 @@ onMounted(() => {
<!-- Synopsis -->
<div class="mb-6">
<h2 class="text-xl font-bold mb-2">Synopsis</h2>
<p class="text-gray-300">{{ movie.overview || "Aucun synopsis disponible." }}</p>
<p class="text-gray-300">
{{ movie.overview || "Aucun synopsis disponible." }}
</p>
</div>
<!-- Réalisateur et têtes d'affiche -->
...
...
type/commentForm.ts
View file @
3d5fd1a
export
type
Comment
=
{
username
:
string
message
:
string
rating
:
number
}
\ No newline at end of file
username
:
string
;
message
:
string
;
rating
:
number
;
};
...
...
vite.config.ts
View file @
3d5fd1a
// vite.config.js
import
vue
from
'@vitejs/plugin-vue'
import
vue
from
"@vitejs/plugin-vue"
;
export
default
{
plugins
:
[
vue
()],
...
...
@@ -8,4 +8,4 @@ export default {
environment
:
"happy-dom"
,
// Additional test configurations can be added here
},
}
\ No newline at end of file
};
...
...
vitest.config.m.ts
View file @
3d5fd1a
import
{
defineVitestConfig
}
from
'@nuxt/test-utils/config'
import
vue
from
'@vitejs/plugin-vue'
import
{
fileURLToPath
}
from
'node:url'
import
{
defineVitestConfig
}
from
"@nuxt/test-utils/config"
;
import
{
fileURLToPath
}
from
"node:url"
;
export
default
defineVitestConfig
({
/**
...
...
@@ -8,31 +7,31 @@ export default defineVitestConfig({
* any custom Vitest config you require
*/
test
:
{
environment
:
'nuxt'
,
environment
:
"nuxt"
,
globals
:
true
,
// you can optionally set Nuxt-specific environment options
environmentOptions
:
{
nuxt
:
{
rootDir
:
fileURLToPath
(
new
URL
(
'./'
,
import
.
meta
.
url
)),
domEnvironment
:
'happy-dom'
,
// 'happy-dom' (default) or 'jsdom'
rootDir
:
fileURLToPath
(
new
URL
(
"./"
,
import
.
meta
.
url
)),
domEnvironment
:
"happy-dom"
,
// 'happy-dom' (default) or 'jsdom'
overrides
:
{
// other Nuxt config you want to pass
},
mock
:
{
intersectionObserver
:
true
,
indexedDb
:
true
,
}
}
,
},
},
coverage
:
{
provider
:
'v8'
,
reporter
:
[
'text'
,
'json'
,
'html'
],
}
provider
:
"v8"
,
reporter
:
[
"text"
,
"json"
,
"html"
],
}
,
},
resolve
:
{
alias
:
{
'~'
:
fileURLToPath
(
new
URL
(
'./'
,
import
.
meta
.
url
)),
'@'
:
fileURLToPath
(
new
URL
(
'./'
,
import
.
meta
.
url
)),
}
}
})
"~"
:
fileURLToPath
(
new
URL
(
"./"
,
import
.
meta
.
url
)),
"@"
:
fileURLToPath
(
new
URL
(
"./"
,
import
.
meta
.
url
)),
}
,
}
,
})
;
...
...
Please
register
or
login
to post a comment