nestia icon indicating copy to clipboard operation
nestia copied to clipboard

Can you continue the development of NestJS CRUD?

Open afilp opened this issue 8 months ago • 10 comments

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

afilp avatar Oct 19 '23 20:10 afilp

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.

samchon avatar Oct 27 '23 07:10 samchon

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

afilp avatar Oct 27 '23 11:10 afilp

Not typeorm, but prisma

samchon avatar Oct 27 '23 12:10 samchon

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!

afilp avatar Oct 27 '23 13:10 afilp

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 avatar Oct 28 '23 06:10 samchon

@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

samchon avatar Oct 28 '23 15:10 samchon

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.?

afilp avatar Oct 28 '23 15:10 afilp

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

samchon avatar Oct 28 '23 15:10 samchon

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!

afilp avatar Oct 29 '23 14:10 afilp

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.

  • PaginationUtil
  • Utilization case (BBS System)
    • https://github.com/samchon/backend/blob/cb702166e58b684bfffcdc70ae7bd4b7e53be13b/src/providers/common/BbsArticleProvider.ts#L33-L45
    • https://github.com/samchon/backend/blob/cb702166e58b684bfffcdc70ae7bd4b7e53be13b/src/providers/common/BbsArticleProvider.ts#L118-L203

samchon avatar Oct 29 '23 15:10 samchon