SamagraX-Stencil / stencil

NestJS on steroids 💪
https://stencil.samagra.io
MIT License
28 stars 30 forks source link

[C4GT] CRUD APIs out of the box #2

Open techsavvyash opened 9 months ago

techsavvyash commented 9 months ago

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)

Product Name

Stencil

Organisation Name

SamagraX

Tech Skills Needed

TypeScript, CRUD

Mentors

@RyanWalker277

Complexity

Medium

Domain

Category

Backend

Sub Category

APIs, CRUD

bandevedant commented 7 months ago

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

RyanWalker277 commented 7 months ago

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

Soham-27 commented 7 months ago

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

Sandeep0306 commented 7 months ago

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

RyanWalker277 commented 6 months ago

@bandevedant is there any update on the progress?

Sandeep0306 commented 6 months ago

@RyanWalker277 bro assign it to me ?

bandevedant commented 6 months ago

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

ALOK9442 commented 6 months ago

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

techsavvyash commented 6 months ago

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

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

ALOK9442 commented 6 months ago

we have to use nest not express?

techsavvyash commented 6 months ago

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.

Apurv428 commented 6 months ago

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

techsavvyash commented 6 months ago

@Apurv428 its in the root of this project.

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

Apurv428 commented 6 months ago

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

techsavvyash commented 6 months ago

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

Apurv428 commented 6 months ago

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

Apurv428 commented 6 months ago

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;
}
techsavvyash commented 6 months ago

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

Apurv428 commented 6 months ago

Okay, thanks!

Yash-Sajwan24 commented 6 months ago

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

aryangandhi05 commented 6 months ago

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?

Apurv428 commented 6 months ago

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

techsavvyash commented 6 months ago

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

Yash-Sajwan24 commented 6 months ago

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

Paras-codes commented 5 months ago

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

Savio629 commented 5 months ago

Any updates @Apurv428 ?

Apurv428 commented 5 months ago

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

DarrenDsouza7273 commented 2 months ago

.

techsavvyash commented 2 months ago

Resources

Srijan25 commented 4 weeks ago

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

Savio629 commented 4 weeks ago

@Srijan25 I'm currently working on this