Code Monkey home page Code Monkey logo

nestjs-crud's Introduction

👋 Hi, I’m Xavi.

  • 💙 I love football ⚽, FC Barcelona fan 🔵🔴
  • 🏂 Snowboarder
  • 🎾 Padel lover
  • 💻 Always being on the lookout for amazing side projects to feed my learning curiosity
  • 📢 Favourite languages and frameworks: TS, JS, React, Vue
  • 📫 You can reach me through my twitter or LinkedIn.
Xavi's Github Stats Xavi's Top Languages

nestjs-crud's People

Contributors

xavism avatar

Stargazers

 avatar

Forkers

luisriverag

nestjs-crud's Issues

add entity definition in swagger definition

Hi this will be more simple to discuss here i believe.

so:


This doesn't work

// base.controller

    @ApiResponse({ status: 200, description: 'Ok'})
    async findAll(): Promise<T[]> {
        return this.IBaseService.getAll()
    }

// user.controller
    @ApiResponse({status: 200, description: 'Entity retrieved successfully.', type: User, isArray: true})
    findAll(): Promise<User[]> {
        return super.findAll();
    }

As the parent decorator are not used and nest care not of the methods as the @Get user is not on specified on the method


This doesn't work either

// base.controller
    @ApiResponse({ status: 200, description: 'Ok'})
    async findAll(): Promise<T[]> {
        return this.IBaseService.getAll()
    }

// user.controller
    @Get
    @ApiResponse({status: 200, description: 'Entity retrieved successfully.', type: User, isArray: true})
    findAll(): Promise<User[]> {
        return super.findAll();
    }

i'm digging in decorator inerithance. To see if i can find a solution. (I'm not a typescript master yet ;) )



This doesn't work either

// base.controller
    @ApiResponse({ status: 200, description: 'Ok'})
    async findAll(): Promise<T[]> {
        return this.IBaseService.getAll()
    }

// user.controller
    @Get
    @ApiResponse({type: User, isArray: true})
    findAll(): Promise<User[]> {
        return super.findAll();
    }

the @ApiResponse status and description are mandatory.


This work

// base.controller
    @Get()
    @ApiResponse({ status: 200, description: 'Ok'})
    async findAll(): Promise<T[]> {
        return this.IBaseService.getAll()
   }

// user.controller
    @Get()
    @ApiResponse({status: 200, description: 'Entity retrieved successfully.', type: User, isArray: true})
    findAll(): Promise<User[]> {
        return super.findAll();
    }

But you must redefine all the decorator. (it override the parent class decorator) and defeat a bit the pupose of having the a base controller don't you thing ?

Configuración de la capa de base de datos ORM

Buenas Xavi! ¿Cómo estás?
Estuve el jueves pasado en tu charla de nest.js y tengo mucho interés en aprender sobre este framework.
Estoy intentando poner en marcha los dos repos que preparaste, me van a ser super útiles, y simplemente quería preguntarte o pedirte el esquema de mysql (la tabla User, etc.) que has utilizado para montarlo bien por completo.
Muchas gracias por la charla y por tu atención!
Un saludo!

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.