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-04-26 13:14:53 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
233e747169b4aefea48102704fbf1a3fc5700b84
233e7471
1 parent
979b1318
Ajout model + interface MovieComment.
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
interfaces/movieComment.ts
models/movieComment.ts
pages/movies/[id]/index.vue
interfaces/movieComment.ts
0 → 100644
View file @
233e747
import
type
{
MovieInterface
}
from
"~/interfaces/movie"
;
export
interface
MovieCommentInterface
{
username
:
string
;
message
:
string
;
rating
:
number
;
movie_id
:
unknown
;
movie
:
MovieInterface
;
}
...
...
models/movieComment.ts
0 → 100644
View file @
233e747
import
{
Model
}
from
"pinia-orm"
;
import
{
Movie
}
from
"~/models/movie"
;
export
class
MovieComment
extends
Model
{
/**
*
* @return {string}
*/
static
get
entity
()
{
return
"MovieComment"
;
}
/**
*
* @return {string}
*/
static
get
primaryKey
()
{
return
"id"
;
}
static
fields
()
{
return
{
// Attributs.
id
:
this
.
number
(
null
),
username
:
this
.
string
(
''
),
message
:
this
.
string
(
''
),
rating
:
this
.
string
(
''
),
// Relations.
movie_id
:
this
.
attr
(
null
),
movie
:
this
.
belongsTo
(
Movie
,
"movie_id"
,
"id"
),
};
}
static
piniaOptions
=
{
persist
:
true
,
};
}
...
...
pages/movies/[id]/index.vue
View file @
233e747
...
...
@@ -105,6 +105,7 @@ async function fetchCredits(id: number | string) {
}
function handleSubmitEvent(event: Comment) {
//todo : faire la gestion des commentaire avec un nouveau model + liaison.
console.log('submitted', event)
}
...
...
@@ -183,6 +184,7 @@ onMounted(() => {
</div>
</div>
<!-- Comments form. -->
<h3 class="text-xl font-bold mt-8 mb-4">Ajouter un commentaire</h3>
<form-movie-comment-form @event:submit="handleSubmitEvent" />
</section>
</div>
...
...
Please
register
or
login
to post a comment