Giter VIP home page Giter VIP logo

rest-in-model's People

Contributors

enginustun avatar furkanyilmazx avatar semcelik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rest-in-model's Issues

We should improve model and config definitions

We should improve model and config definitions as below:

export default class Foo extends RestBaseModel {
  getConfig() {
    return {
      headers: {},
      // idField: 'id',  #deprecated
      resultListField: 'result',
      paths: { default: 'foos/', byQuxId: 'foos/{quxId}' },
      endpointName: 'gateway',

      fields: {
        // idField definition deprecated, use primary attribute instead.
        id: { primary: true },
        bar: { default: 'baz' },
      },
    };
  }
}

Add README latest npm version

Use following lines:
[![npm version](https://badge.fury.io/js/office-ui-fabric-react.svg)](https://badge.fury.io/js/office-ui-fabric-react) [![Build Status](https://travis-ci.org/OfficeDev/office-ui-fabric-react.svg?branch=master)](https://travis-ci.org/OfficeDev/office-ui-fabric-react)
And output like that below:
npm version
Build Status

image

Get resultListField from model config

Currently, we are able to specify 'resultListField' in parameter while calling function.
DerivedModelClass.all({ resultList:[], resultListField: 'content' });

If we update code as below:
image

We will be able to define resultListField in model class.
image

restModelToObject method overrides default value

const restModelToObject = (restModel, Type) => {
  const newObject = new Type();
  const config = Type[`${Type.name}_config`];
  if (helper.isObject(config.fields)) {
    const fieldKeys = Object.keys(config.fields);
    for (let i = 0; i < fieldKeys.length; i += 1) {
      const fieldKey = fieldKeys[i];
      newObject[fieldKey] = restModel[config.fields[fieldKey].map || fieldKey];
    }
  }
  return newObject;
};

image

This assignment overrides default value of newObject. It should check if given model's current attribute is undefined then do not assign this attribute of newObject.

Save model as an array feature

Supported end point only accepts array to update multiple records at once. It could be nice to have such support with something like this :

const somethingModelArray = [
  {
    something: 'something1',
    anotherThing: 'anotherThing1',
  },
  {
    something: 'something2',
    anotherThing: 'anotherThing2',
  },
];
const somethingModelArrayInstance = new SomethingModel(somethingModelArray);
somethingModelArrayInstance.save({ modelArray: true });

File Upload

Maybe we will add xhr file upload property.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.