ajaynegi45 / LibraryMan-API

Revolutionize book management with LibraryMan! Easily track stock, borrowers, and due dates, streamlining operations for schools, companies, and libraries worldwide, ensuring efficient and organized book lending.
MIT License
44 stars 49 forks source link

[FEATURE] 1. Add Data transfer object(DTOs) 2. use builder pattern #52

Closed anishmu20 closed 1 month ago

anishmu20 commented 1 month ago

Is this feature already requested?

Problem or Missing Functionality

When an API is requested, the controller receives the request and calls the corresponding method in the service layer. The service layer contains the business logic and interacts with the repository to fetch or modify data. In this process, instead of directly exposing the entity (which represents the database structure), it is a good practice to use DTOs Data Transfer Objects to handle the data that is sent back to the client. This ensures that the internal structure of the entity is not exposed directly, enhancing security and flexibility in modifying the API's output structure without affecting the database layer.

Feature Description

Workflow 1.Controller:Receives API requests from the client. 2.Controller -> Service Layer: The controller delegates the logic execution to the service layer. 3.Service Layer: Applies business logic and interacts with the repository to modify or fetch data. 4.Repository: Interacts with the database to perform data operations. 5.DTO (Data Transfer Object): Instead of exposing the database entity directly, the service layer converts entities to DTOs, ensuring that the internal database structure is not exposed to the client. 6.Entity -> Database: The entity represents the database structure, but it's used internally without being directly exposed. Assign me this task under gssoc-ext tag

Screenshots

No response

Would you like to work on this feature?

Yes

Implementation Plan

The plan is to first create Data Transfer Object (DTO) classes to decouple the entity from the exposed API structure. Then, modify the service layer logic to work with these DTOs, ensuring clean data handling between layers. Finally, the service layer will be refactored to use the Builder Pattern for constructing DTOs, improving flexibility and readability in object creation.

ajaynegi45 commented 1 month ago

Hi @anishmu20,

Thank you for expressing your interest in working on the "1. Add Data transfer object(DTOs) 2. use builder pattern" issue. I'm delighted to inform you that I have assigned this issue to you. Your willingness to contribute to our project is much appreciated.

Feel free to start working, and if you have any questions or need assistance during the process, please don't hesitate to reach out.

anishmu20 commented 1 month ago

will this task consider under gssoc-ext ?

ajaynegi45 commented 1 month ago

will this task consider under gssoc-ext ?

Yes

andrade-filipe commented 1 month ago

i'd like to work on this issue! i also requested on Optimize Database Queries to Reduce the Number of Calls #24 , i want to help both issues

andrade-filipe commented 1 month ago

@anishmu20 i need to contact you, so we can work together and not on 2 different branches

anishmu20 commented 1 month ago

task done PULL REQUEST done i have doubt related to the project i need to discuss @ajaynegi45 .

ajaynegi45 commented 1 month ago

task done PULL REQUEST done

contact me on linkedin

shubham7151 commented 1 month ago

HI there, Hope you all are well, I found this repo under hacktoberfest , project seem interesting and actively growing would like to share my views and contribute towards this issue. looking forward to hear back Thanks!! @ajaynegi45

ajaynegi45 commented 1 month ago

project seem interesting and actively growing would like to share my views and contribute towards this issue.

This is solved and you can contribute other issues or projects.

all project: https://bento.me/codiescoder