ForestAdmin/forest-express

View on GitHub
src/services/exposed/record-creator.js

Summary

Maintainability
A
35 mins
Test Coverage
D
60%
const AbstractRecordService = require('./abstract-records-service');
const ResourceDeserializer = require('../../deserializers/resource');

class RecordCreator extends AbstractRecordService {
  create(record) {
    return new this.Implementation.ResourceCreator(this.model, this.params, record, this.user)
      .perform();
  }

  deserialize(body) {
    return new ResourceDeserializer(this.Implementation, this.model, body, true, {
      omitNullAttributes: true,
    })
      .perform();
  }
}

module.exports = RecordCreator;