How to use the redux-orm.attr function in redux-orm

To help you get started, we’ve selected a few redux-orm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GiraffeTools / GiraffeTools / frontend / porcupine / models / link.js View on Github external
.toModelArray()
            .forEach((link) => {
              // #TODO check if this is safe when REMOVE_NODE deletes nodeModel
              if (link.portFromModel.outputParent.id == payload.parameterId) {
                link.portToModel.inputParent.update(payload.newValues);
              }
            });

        break;
    }
    return undefined;
  }
}
Link.modelName = 'Link';
Link.fields = {
  id: attr(),
  portFrom: fk({
    to: 'Port',
    as: 'portFromModel',
    relatedName: 'outputLinks',
  }),
  portTo: fk({
    to: 'Port',
    as: 'portToModel',
    relatedName: 'inputLinks',
  }),
};

export default Link;
github SEL-Columbia / dokomoforms / dokomoforms / static / src / admin / js / create-survey / redux / models.babel.js View on Github external
const nodes = this.nodes.toModelArray().map(node => node.denormalize());
        const buckets = this.buckets.toModelArray().map(bucket => bucket.denormalize());
        let data = Object.assign({}, this.ref, {nodes: nodes})
        if (buckets.length) data = Object.assign(data, {buckets: buckets})
        console.log('this data', this.ref.id, data)
        delete data.id;
        delete data.node;
        return data;
    }
};

Survey.modelName = 'Survey';

Survey.fields = {
    id: attr(),
    default_language: attr(),
    node: fk('Node', 'sub_surveys')
};


class Bucket extends CRUDModel {
    denormalize() {
        const data = Object.assign({}, this.ref)
        delete data.id;
        delete data.survey;
        return data;
    }
};

Bucket.modelName = 'Bucket';

Bucket.fields = {
github N3TC4T / Nearby-Live / src / redux / core / system-notifications / models.js View on Github external
static get fields() {
        return {
            id: attr(),
            type: attr(),
            new: attr(),
            param: attr(),
            date: attr(),
            txt: attr(),
            img: attr()
        };
    }
github N3TC4T / Nearby-Live / src / redux / core / conversations / models.js View on Github external
static get fields() {
        return {
            id: attr(),
            messages: many('Message'),
            gold: attr(),
            img: attr(),
            last: attr(),
            lastid: attr(),
            msg: attr(),
            name: attr(),
            new: attr(),
            staff: attr(),
            total: attr(),
            initialized: attr({getDefault: false})
        };
    }
github meltyshev / planka / client / src / models / Card.js View on Github external
Model, attr, fk, many,
} from 'redux-orm';

import ActionTypes from '../constants/ActionTypes';
import Config from '../constants/Config';

export default class extends Model {
  static modelName = 'Card';

  static fields = {
    id: attr(),
    position: attr(),
    name: attr(),
    description: attr(),
    dueDate: attr(),
    timer: attr(),
    isSubscribed: attr({
      getDefault: () => false,
    }),
    isActionsFetching: attr({
      getDefault: () => false,
    }),
    isAllActionsFetched: attr({
      getDefault: () => false,
    }),
    listId: fk({
      to: 'List',
      as: 'list',
      relatedName: 'cards',
    }),
    boardId: fk({
      to: 'Board',
github piximi / application / src / models / image.js View on Github external
import { attr, fk, Model } from 'redux-orm';

class Image extends Model {}

Image.modelName = 'image';

Image.fields = {
  category: fk('category', 'images'),
  checksum: attr(),
  data: attr(),
  id: attr()
};

export default Image;
github ksco / reblog / src / models / Comment.js View on Github external
static get fields() {
    return {
      id: attr(),
      body: attr(),
      createdAt: attr(),
      updatedAt: attr(),
      user: fk('User', 'comments'),
      post: fk('Post', 'comments'),
    }
  }
github N3TC4T / Nearby-Live / src / redux / core / conversations / models.js View on Github external
static get fields() {
        return {
            id: attr(),
            messages: many('Message'),
            gold: attr(),
            img: attr(),
            last: attr(),
            lastid: attr(),
            msg: attr(),
            name: attr(),
            new: attr(),
            staff: attr(),
            total: attr(),
            initialized: attr({getDefault: false})
        };
    }
github N3TC4T / Nearby-Live / src / redux / core / conversations / models.js View on Github external
static get fields() {
        return {
            id: attr(),
            messages: many('Message'),
            gold: attr(),
            img: attr(),
            last: attr(),
            lastid: attr(),
            msg: attr(),
            name: attr(),
            new: attr(),
            staff: attr(),
            total: attr(),
            initialized: attr({getDefault: false})
        };
    }
github N3TC4T / Nearby-Live / src / redux / core / conversations / models.js View on Github external
static get fields() {
        return {
            body: attr(),
            date: attr(),
            dir: attr(),
            id: attr({getDefault: uuid.v4}),
            msgid: attr(),
            sent: attr({getDefault: () => true}),
            unread: attr({getDefault: () => true})
        };
    }

redux-orm

Simple ORM to manage and query your state trees

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis