credit.ts 597 Bytes
import { Model } from "pinia-orm";
import { Movie } from "~/models/movie";

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

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

  static fields() {
    return {
      // Attributs.
      id: this.number(null),
      cast: this.attr([]),
      crew: this.attr([]),
      // Relations.
      movie_id: this.attr(null),
      movie: this.belongsTo(Movie, "movie_id", "id"),
    };
  }

  static piniaOptions = {
    persist: true,
  };
}