samchon / nestia

NestJS Helper Libraries + TypeScript OpenAPI generator
https://nestia.io/
MIT License
1.85k stars 95 forks source link

Can you continue the development of NestJS CRUD? #670

Open afilp opened 1 year ago

afilp commented 1 year ago

Feature Request

It appears that due to your passion and deep knowledge you are the perfect developer to create the best NestJS CRUD library out there.

So, a humble request, can you please, please fork this abandoned NestJS CRUD library and continue its development? It used to be a great library and still is, but has some problems now as the years passed.

https://github.com/nestjsx/crud/issues/710

P.S. This is a fork with some new commits but with no feature development, just trying to be compatible with the latest NestJS version: https://github.com/gid-oss/dataui-nestjs-crud#readme

samchon commented 1 year ago

As I'm using not typeorm but prisma instead, I'm not familiar with above libraries.

At least to support those automatic CRUD, you should suggest the detailed specs what you want.

afilp commented 1 year ago

You are using typeorm or prisma? Not sure I understood. Thanks!

samchon commented 1 year ago

Not typeorm, but prisma

afilp commented 1 year ago

You could create the best NestJS CRUD library out there, by forking the existing abandoned one and merging all PRs that address many issues!

For example, we would really need this feature to exist in the NestJS CRUD package: https://github.com/nestjsx/crud/pull/754

Yes, it is in TypeORM but it seems that could do that too, based on your good work in nestia.

We are thousands of NestJS developers out there that are left behind.

See for example how many weekly downloads exist, despite the package is abandoned:

image

We are all in a great need to see this package supporting many more missing features (like querying in an array and many more, see PRs).

Thanks a lot!

samchon commented 1 year ago

Analyzed the target libraries and understood that your suggestion can be accomplished just by developing an abstract class capsuled in a function, so that need not to make independent library. I will show you the abstract class and its utilization case detaily at tomorrow. For reference, the abstract class would not be affected whatever your ORM is.

export function CrudController(props: CrudController.IProps) {
    @Controller(props.path)
    class CrudController {
        ....
    }
    return CrudController;
}
samchon commented 1 year ago

@afilp Here is the example.

As you can see, no special library required.

Just copy and paste the abstract controller class and customize for your use case.

  1. Abstract CRUD controller class: AuthorizedCrudController
  2. Derived class utilizing the abstract CRUD class: BbsArticlesController
  3. Test functions for demonstration i. test_api_bbs_article_create ii. test_api_bbs_article_update iii. test_api_bbs_article_delete

Github Actions Result: https://github.com/samchon/nestia-auto-crud-example/actions/runs/6677610452/job/18147796260

afilp commented 1 year ago

Thanks @samchon , I am not sure I get this, is what you propose a replacement of the NestJS CRUD library? If yes, does it have all the support for filters, plus filtering inside an array (that is missing), etc.?

samchon commented 1 year ago

If you need additional features, define them into the abstract class.

afilp commented 1 year ago

Ok, if we were to migrate from that package to yours, do you have utilities for easy CRUD development? (with all the filters that they support, etc.?). For example, filters are here (but also look at all other features please) : https://github.com/nestjsx/crud/wiki/Requests#filter-conditions

Thanks a lot!

samchon commented 1 year ago

I have not abstracted such detailly because I think that each API has each story. Also, I do not design database table to be correspondent with DTO schema to be 1:1 relationship. I think that as basic principle of database and DTO structures are different, they've to be different. Furthermore, as I'm using Prisma ORM, which supports type safe APIs, so that taking advantages from auto-completions with type hints, I don't need such features.

Therefore, I can't understand why such features are required. It is your mind that defining such deeply abstracted abstract class, but I won't support it.

Anyway, I've just made utility functions like pagination case of below.

In my commercial project, there're a little bit more utility components, but it is not possible to disclose them publictly.