Giter Club home page Giter Club logo

Comments (4)

zaro avatar zaro commented on June 29, 2024

Is this a feature request?

Also, this is already as you said by overriding the respective method and calling your transform and the super method with the result of the transform.
Overriding also gives you the control of how to handle errors, while with the transform example you give this is not clear at all.

Can you elaborate what exactly is your pain point with overriding crud method, because to me the transform you propose doesn't seems like improvement?

from dataui-nestjs-crud.

its-dibo avatar its-dibo commented on June 29, 2024

transform() is just a lightweight function to transform the body without registering class-based interceptors

from dataui-nestjs-crud.

zaro avatar zaro commented on June 29, 2024

Yes, I get that writing interceptors is too much or such a simple functionality.
But what about overriding ? Something like that:

@Crud({
  model: { ... }
})
@Controller('example')
export class ExampleController {
  constructor( public service: ExampleService,) {
  }

  @Override('createOneBase')
  _createOneBase(
    @ParsedRequest() req: CrudRequest,
    @ParsedBody() dto: any,
  ): Promise<any> {
  const newBody = transform(dto);

  super.createOneBase(req, newBody)
  }

from dataui-nestjs-crud.

zaro avatar zaro commented on June 29, 2024

@its-dibo Is the provided answer working for you?

I am closing the issue, please reopen it in case it is not.

from dataui-nestjs-crud.

Related Issues (20)

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.