stencil icon indicating copy to clipboard operation
stencil copied to clipboard

[C4GT] CRUD APIs out of the box

Open techsavvyash opened this issue 2 years ago • 34 comments

Create CRUD APIs out of the box

Description

The goal of this project is to develop a set of CRUD (Create, Read, Update, Delete) APIs that can be easily integrated into various applications. These APIs should provide a standardized and efficient way to perform basic CRUD operations on a given data model. Also write relevant tests.

Goals

  1. Standardized Operations: Ensure that the APIs follow industry standards for CRUD operations.
  2. Flexibility: Allow customization of the APIs to adapt to different data models and requirements.

Acceptance Criteria

  1. Create API: Implement an API endpoint that allows the creation of a new record in the db.

  2. Read API: Develop an API endpoint for retrieving records from the db table based on specified parameters. It should support pagination for large datasets.

  3. Update API: Create an API endpoint to update an existing record in the db.

  4. Delete API: Implement an API endpoint to delete a record from the db.

  5. Documentation: Provide comprehensive documentation on the APIs. Include it in the form of a READMe.md in the specific module you create. It will be added to the official Stencil Docs

Checklist (To be filled by the developer)

  • [ ] Create API endpoint is implemented and tested.
  • [ ] Read API endpoint is implemented and tested, supporting pagination.
  • [ ] Update API endpoint is implemented and tested.
  • [ ] Delete API endpoint is implemented and tested.
  • [ ] Documentation is complete and includes examples.
  • [ ] The code follows best practices for scalability.
  • [ ] The APIs conform to industry standards for CRUD operations.

Product Name

Stencil

Organisation Name

SamagraX

Tech Skills Needed

TypeScript, CRUD

Mentors

@RyanWalker277

Complexity

Medium

Domain

Category

Backend

Sub Category

APIs, CRUD

techsavvyash avatar Dec 02 '23 07:12 techsavvyash

@RyanWalker277 @techsavvyash we have to just write the api's in typescript can you please say me the file structure of the folder ...or can u please explain me what is expected .Thank you.

bandevedant avatar Feb 11 '24 04:02 bandevedant

@RyanWalker277 @techsavvyash we have to just write the api's in typescript can you please say me the file structure of the folder ...or can u please explain me what is expected .Thank you.

Hey @bandevedant, you can take reference from here: https://geekiebarbs.hashnode.dev/build-a-crud-api-with-typescript-nodejs-express-and-postgresql

We need to provide sample CRUD APIs when a new project is initialised. The samples/01-all-features is a nest project. You have to make your contributions there.

RyanWalker277 avatar Feb 11 '24 08:02 RyanWalker277

Hello @RyanWalker277 sir , can you please assign me this issue to work on?

Soham-27 avatar Feb 11 '24 12:02 Soham-27

Hi, @RyanWalker277 is someone working on it? if not can you assign it to me?

Sandeep0306 avatar Feb 21 '24 07:02 Sandeep0306

@bandevedant is there any update on the progress?

RyanWalker277 avatar Feb 23 '24 06:02 RyanWalker277

@RyanWalker277 bro assign it to me ?

Sandeep0306 avatar Feb 28 '24 14:02 Sandeep0306

yes @Sandeep0306 go for it I am in with some other stuff

bandevedant avatar Feb 28 '24 14:02 bandevedant

@RyanWalker277 @techsavvyash we have to just write the api's in typescript can you please say me the file structure of the folder ...or can u please explain me what is expected .Thank you.

Hey @bandevedant, you can take reference from here: https://geekiebarbs.hashnode.dev/build-a-crud-api-with-typescript-nodejs-express-and-postgresql

We need to provide sample CRUD APIs when a new project is initialised. The samples/01-all-features is a nest project. You have to make your contributions there.

@RyanWalker277 hello sir, can you tell more about this, I am confused about exactly what customization required?

ALOK9442 avatar Feb 28 '24 15:02 ALOK9442

Hey @ALOK9442 Refer this: https://github.com/nestjsx/crud

Since we are using Prisma, we need something similar which works with Prisma.

techsavvyash avatar Feb 28 '24 15:02 techsavvyash

we have to use nest not express?

ALOK9442 avatar Feb 28 '24 17:02 ALOK9442

Yes, Stencil is based on Nest not express. The main aim of this ticket to help enable CRUD APIs in a single command for schema models so that the developers don't have to write the same logic again and again.

techsavvyash avatar Feb 29 '24 03:02 techsavvyash

@RyanWalker277 @techsavvyash we have to just write the api's in typescript can you please say me the file structure of the folder ...or can u please explain me what is expected .Thank you.

Hey @bandevedant, you can take reference from here: https://geekiebarbs.hashnode.dev/build-a-crud-api-with-typescript-nodejs-express-and-postgresql

We need to provide sample CRUD APIs when a new project is initialised. The samples/01-all-features is a nest project. You have to make your contributions there.

Hi @RyanWalker277 , where can I find samples/01-all-features project? I am unable to get a link for that.

Apurv428 avatar Mar 01 '24 10:03 Apurv428

@Apurv428 its in the root of this project.

https://github.com/SamagraX-Stencil/stencil/tree/main/sample/01-all-features

techsavvyash avatar Mar 01 '24 11:03 techsavvyash

@techsavvyash @RyanWalker277 I have created the APIs using NestJS. I have a doubt that can there be multiple models in the schema.prisma? If there are multiple models, then can we have the api link as http://localhost:3000/api/v1/model1 http://localhost:3000/api/v1/model2 etc?

Apurv428 avatar Mar 06 '24 08:03 Apurv428

Yes @Apurv428 , the schema.prisma will have multiple models and its fine to have the API routes like this for now

techsavvyash avatar Mar 06 '24 08:03 techsavvyash

Okay, thanks! I will make the PR after making the changes. Can you please assign this to me?

Apurv428 avatar Mar 06 '24 08:03 Apurv428

Hi @techsavvyash , do we need a file in which the models will be stored after retrieving from schema.prisma?

For eg in schema.prisma, the model is as follow:

model Book {
  id Int @id @default(autoincrement())
  title String
  description String?
}

Then do we need to create a file in which the model that is retrived is stored in the format understandable by the api?

export class Book implements Prisma.BookCreateInput {
  id: number;
  title: string;
  description?: string;
}

Apurv428 avatar Mar 07 '24 12:03 Apurv428

Yes @Apurv428, It would be good to have DTOs and Interfaces generated as well.

techsavvyash avatar Mar 07 '24 12:03 techsavvyash

Okay, thanks!

Apurv428 avatar Mar 07 '24 12:03 Apurv428

@techsavvyash I understand the problem, and I believe I have the necessary skills. Could I have the opportunity to work on this?

Yash-Sajwan24 avatar Mar 17 '24 09:03 Yash-Sajwan24

Hello @techsavvyash Sir I want to solve this issue, as i understand it, and i will give my 100% for solving this issue So please, can you assign me this?

aryangandhi05 avatar Mar 17 '24 10:03 aryangandhi05

@Yash-Sajwan24 @aryangandhi05 , I am working on it already!

Apurv428 avatar Mar 17 '24 11:03 Apurv428

@Yash-Sajwan24 @aryangandhi05 the first version of this extension has been very graciously contributed by @Apurv428 and he is continuing to work on this ticket to improve the extension. I suggest the three of you team up and work together, might help expedite the process.

techsavvyash avatar Mar 17 '24 11:03 techsavvyash

@techsavvyash @Apurv428 Yes, I would love to team up.

Yash-Sajwan24 avatar Mar 17 '24 14:03 Yash-Sajwan24

hii @techsavvyash can i also team up with apurv as I have skills in API development and would really like to build this feature

Paras-codes avatar Mar 26 '24 19:03 Paras-codes

Any updates @Apurv428 ?

Savio629 avatar Apr 07 '24 05:04 Savio629

Sorry, due to my exams I was unable to work on it. I would continue the work and would create a PR asap!

Apurv428 avatar Apr 07 '24 05:04 Apurv428

.

DarrenDsouza7273 avatar Jun 28 '24 08:06 DarrenDsouza7273

Resources

techsavvyash avatar Jun 30 '24 17:06 techsavvyash

is this issue resolved or not ? or should i give it a try

Srijan25 avatar Aug 21 '24 08:08 Srijan25