Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split database entities and response serialized objects (DTO) #379

Open
kinow opened this issue Jan 16, 2022 · 0 comments
Open

Split database entities and response serialized objects (DTO) #379

kinow opened this issue Jan 16, 2022 · 0 comments

Comments

@kinow
Copy link
Member

kinow commented Jan 16, 2022

It's normally considered a bad practice to have the database model classes also being used to send data to the user in responses.

It's better - and IMHO easier to maintain - to have the database model classes with its single responsibility, and move all de/serialization specifics to DTO's (or any other acronym like VO/POJO/DO/etc used in the project).

Description

Part of #254 . Realized I was having to deal with the MongoDB specifics and also with how data is de/serialized 😥 It would have been a bit simpler should these two were separated entities.

Expected Behavior

Separate classes, separate concerns.

Actual Behavior

Possible Fix

Steps to Reproduce

NA

Context

Your Environment

  • Version used:
  • Environment name and version (e.g. Chrome 39, Java 1.8):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant