XingFramework/Relayer

View on GitHub
dist/relayer/serializers/ListResourceSerializer.js

Summary

Maintainability
A
3 hrs
Test Coverage
import Serializer from "./Serializer.js";
import ManyResourceSerializer from "./ManyResourceSerializer.js";
import {Inject, factory} from "../injector.js";

export default class ListResourceSerializer extends Serializer {

  constructor(manyResourceSerializerFactory,
    resource) {
    super(resource);
    this.manyResourceSerializerFactory = manyResourceSerializerFactory;
  }

  serialize() {
    var data = this.manyResourceSerializerFactory(this.resource).serialize();
    this.resource.resource.pathSet("$.data", data);
    return this.resource.resource.response;
  }
}

Inject(factory(ManyResourceSerializer))(ListResourceSerializer);