How to use the @foal/typeorm.middleware function in @foal/typeorm

To help you get started, we’ve selected a few @foal/typeorm 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 FoalTS / foal / packages / cli / src / generate / specs / service / test-foo-bar.service.entity-resource-collection.ts View on Github external
properties: {
    // To complete
  },
  required: [ /* To complete */ ],
  type: 'object',
};

export class TestFooBarCollection extends EntityResourceCollection {
  // tslint:disable-next-line:whitespace
  entityClass = TestFooBar;
  allowedOperations: EntityResourceCollection['allowedOperations'] = [
    'create', 'findById', 'find', 'modifyById', 'updateById', 'deleteById'
  ];

  middlewares = [
    middleware('create|modifyById|updateById', ({ data }) => validate(schema, data))
  ];
}