Sha256: 55d695a0ebd3ea849315752961d859fc35b402b343e6bad48bbe4231c6cbe832

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

import { Models } from "loco-js";

class Comment extends Models.Base {
  static identity = "Article.Comment";

  static remoteName = "Comment";

  static resources = {
    url: "/user/articles/:articleId/comments",
    paginate: { per: 10 },
    main: {
      url: "/articles/:articleId/comments",
      paginate: { per: 5, param: "page-num" }
    },
    admin: {
      url: "/admin/articles/:articleId/comments",
      paginate: { per: 5 }
    }
  };

  static attributes = {
    author: {
      validations: {
        presence: true
      }
    },
    text: {
      validations: {
        presence: true,
        vulgarity: true
      }
    },
    articleId: {
      type: "Int",
      validations: {
        presence: true
      },
      remoteName: "article_id"
    },
    createdAt: {
      type: "Date",
      remoteName: "created_at"
    },
    updatedAt: {
      type: "Date",
      remoteName: "updated_at"
    },
    emotion: {
      type: "Int"
    },
    pinned: {
      type: "Boolean"
    },
    adminRate: {
      type: "Int",
      remoteName: "admin_rate"
    },
    approved: {
      type: "Boolean"
    }
  };

  constructor(data) {
    super(data);
  }
}

export default Comment;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loco-rails-3.0.5 test/dummy/frontend/js/models/article/Comment.js
loco-rails-3.0.4 test/dummy/frontend/js/models/article/Comment.js