Ajout attribut createdAt dans le model movieComment + id par défaut en uid().
Gestion de l'evévènement provenant du formulaire de commentaires avec l'ajout de la méthode handleSubmitEvent() dans la page des détails.
Showing
3 changed files
with
18 additions
and
5 deletions
1 | ------ Dispo à la prochaine release ------------ | 1 | ------ Dispo à la prochaine release ------------ |
2 | +- Installation vuelidate et vuelidate/validator. | ||
2 | - Ajout composant SkeletonMovieDetailLoader. | 3 | - Ajout composant SkeletonMovieDetailLoader. |
4 | +- Ajout Model + Interface credit. | ||
5 | +- Ajout composant ScoreAndVote. | ||
6 | +- Ajout composant MovieGender. | ||
7 | +- Ajout composant Poster. | ||
8 | +- Ajout composant BackdropImage. | ||
9 | +- Ajout composant MovieCommentForm. | ||
10 | +- Ajout model + interface MovieComment. |
@@ -21,7 +21,8 @@ export class MovieComment extends Model { | @@ -21,7 +21,8 @@ export class MovieComment extends Model { | ||
21 | static fields() { | 21 | static fields() { |
22 | return { | 22 | return { |
23 | // Attributs. | 23 | // Attributs. |
24 | - id: this.number(null), | 24 | + id: this.uid(), |
25 | + createdAt: this.string(''), | ||
25 | username: this.string(''), | 26 | username: this.string(''), |
26 | message: this.string(''), | 27 | message: this.string(''), |
27 | rating: this.string(''), | 28 | rating: this.string(''), |
@@ -7,7 +7,8 @@ import { Movie } from "~/models/movie"; | @@ -7,7 +7,8 @@ import { Movie } from "~/models/movie"; | ||
7 | import type { MovieInterface } from "~/interfaces/movie"; | 7 | import type { MovieInterface } from "~/interfaces/movie"; |
8 | import { Credit } from "~/models/credit"; | 8 | import { Credit } from "~/models/credit"; |
9 | import type { CreditsResponse } from "~/interfaces/credit"; | 9 | import type { CreditsResponse } from "~/interfaces/credit"; |
10 | -import type { Comment } from "~/type/commentForm"; | 10 | +import type { MovieCommentInterface } from "~/interfaces/movieComment"; |
11 | +import { MovieComment } from "~/models/movieComment"; | ||
11 | //#endregion | 12 | //#endregion |
12 | 13 | ||
13 | //#region --Declaration--. | 14 | //#region --Declaration--. |
@@ -104,9 +105,12 @@ async function fetchCredits(id: number | string) { | @@ -104,9 +105,12 @@ async function fetchCredits(id: number | string) { | ||
104 | } | 105 | } |
105 | } | 106 | } |
106 | 107 | ||
107 | -function handleSubmitEvent(event: Comment) { | 108 | +//Ce n'est pas le film du siècle cependant, il est suffisamment intéressant pour passer une bonne soirée ! |
108 | - //todo : faire la gestion des commentaire avec un nouveau model + liaison. | 109 | +function handleSubmitEvent(event: MovieCommentInterface) { |
109 | - console.log('submitted', event) | 110 | + isSubmitting.value = true; |
111 | + event.movie_id = unref(movieId); | ||
112 | + useRepo(MovieComment).save(event); | ||
113 | + isSubmitting.value = false; | ||
110 | } | 114 | } |
111 | 115 | ||
112 | //#endregion | 116 | //#endregion |
-
Please register or login to post a comment