How to use the ember-data.EmbeddedRecordsMixin function in ember-data

To help you get started, we’ve selected a few ember-data 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 plantinformatics / pretzel / frontend / app / serializers / block.js View on Github external
import Ember from 'ember';
import DS from 'ember-data';
import ApplicationSerializer from './application';

const { EmbeddedRecordsMixin } = DS;
const { Mixin } = Ember;

export default ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
  normalize(model, hash, prop) {
    var ret = this._super(...arguments);
    return ret;
  },
  serialize(snapshot, options) {
    let json = this._super(...arguments);
    delete json.features
    delete json.createdAt
    delete json.updatedAt
    return json;
  },
  serializeIntoHash: function(hash, type, record, options) {
    let serial = this.serialize(record, options);
    //edit hash in place because the calling function (adapters/application.js)
    // does not use the return by default
    Object.keys(serial).forEach(function(key) {
github plantinformatics / pretzel / frontend / app / serializers / block.js View on Github external
import Ember from 'ember';
import DS from 'ember-data';
import ApplicationSerializer from './application';

const { EmbeddedRecordsMixin } = DS;
const { Mixin } = Ember;

export default ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
  normalize(model, hash, prop) {
    var ret = this._super(...arguments);
    return ret;
  },
  serialize(snapshot, options) {
    let json = this._super(...arguments);
    delete json.workspaces
    delete json.createdAt
    delete json.updatedAt
    return json;
  },
  serializeIntoHash: function(hash, type, record, options) {
    let serial = this.serialize(record, options);
    //edit hash in place because the calling function (adapters/application.js)
    // does not use the return by default
    Object.keys(serial).forEach(function(key) {
github genkgo / ember-localforage-adapter / tests / dummy / app / serializers / customer.js View on Github external
import DS from 'ember-data';
import LFSerializer from 'ember-localforage-adapter/serializers/localforage';

export default LFSerializer.extend(
  DS.EmbeddedRecordsMixin, {
    attrs: {
      addresses: { embedded: 'always' },
      hour: { embedded: 'always' }
    }
  }
);
github dustinfarris / ember-django-adapter / tests / dummy / app / serializers / embedded-post-comment.js View on Github external
import DRFSerializer from './drf';
import DS from 'ember-data';

export default DRFSerializer.extend(DS.EmbeddedRecordsMixin, {
  attrs: {
    post: {serialize: 'id', deserialize: 'records'}
  }
});
github apache / ambari / contrib / views / hive20 / src / main / resources / ui / app / serializers / table.js View on Github external
* to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import DS from 'ember-data';

export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
});
github transitland / mobility-explorer / app / data / transitland / stop-station / serializer.js View on Github external
import DS from 'ember-data';
import TransitlandSerializer from "../serializer";

export default TransitlandSerializer.extend(DS.EmbeddedRecordsMixin, {
  attrs: {
    stop_platforms: {
      deserialize: 'records'
    },
    stop_egresses: {
      deserialize: 'records'
    }
  },
	modelNameFromPayloadKey: function(payloadKey){
		return "data/transitland/stop-station";
	}
});
github gothinkster / ember-realworld / app / serializers / article.js View on Github external
import DS from 'ember-data';

export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
  primaryKey: 'slug',
  attrs: {
    author: { embedded: 'always' },
    tagList: {
      serialize: 'ids',
      deserialize: 'records',
    },
  },

  normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
    payload.articles = payload.articles.map(article => {
      return this.normalizeArticle(article);
    });
    payload.meta = {
      articlesCount: payload.articlesCount,
    };
github plantinformatics / pretzel / frontend / app / serializers / geneticmap.js View on Github external
import Ember from 'ember';
import DS from 'ember-data';
import ApplicationSerializer from './application';

export default ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
  normalize(model, hash, prop) {
    var ret = this._super(...arguments);
    return ret;
  },

  attrs: {
    chromosomes: { embedded: 'always' }
  }
});
github Flexberry / ember-flexberry-designer / addon / serializers / application-offline.js View on Github external
import DS from 'ember-data';
import OfflineSerializer from 'ember-flexberry-data/serializers/offline';

export default OfflineSerializer.extend(DS.EmbeddedRecordsMixin, {
  attrs: {
  }
});
github alphasights / ember-graphql-adapter / addon / serializer.js View on Github external
import { assert } from '@ember/debug';
import { isNone, typeOf } from '@ember/utils';
import { get } from '@ember/object';
import { camelize } from '@ember/string';
import DS from 'ember-data';
import { pluralize, singularize } from 'ember-inflector';

export default DS.JSONSerializer.extend(DS.EmbeddedRecordsMixin, {
  isNewSerializerAPI: true,

  normalizeCase(string) {
    return camelize(string);
  },

  serializeIntoHash(hash, typeClass, snapshot, options) {
    if (snapshot.id) {
      hash[get(this, 'primaryKey')] = snapshot.id;
    }
    this._super(hash, typeClass, snapshot, options);
  },

  serializeAttribute(snapshot, json, key, attribute) {
    let type = attribute.type;