movie.ts 895 Bytes
import { Model } from "pinia-orm";

export class Movie extends Model {
  /**
   *
   * @return {string}
   */
  static get entity() {
    return "Movie";
  }

  /**
   *
   * @return {string}
   */
  static get primaryKey() {
    return "id";
  }

  static fields() {
    return {
      // Attributs.
      id: this.number(null),
      adult: this.boolean(false),
      backdrop_pat: this.string(null),
      genre_ids: this.attr([]),
      original_language: this.string(null),
      original_title: this.string(null),
      overview: this.string(null),
      popularity: this.number(null),
      poster_path: this.string(null),
      release_date: this.string(null),
      title: this.string(null),
      video: this.boolean(false),
      vote_average: this.number(null),
      vote_count: this.number(null),
      // Relations.
    };
  }

  static piniaOptions = {
    persist: true,
  };

}