-
Notifications
You must be signed in to change notification settings - Fork 3
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
include label in get all task end point #126
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@@ -1,4 +1,6 @@ | |||
namespace BlotzTask.Models | |||
using BlotzTask.Data.Entities; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not Using entities in models
The idea is to encap all entity related only at data layer. (loose couple to improve the maintainability, in future if the app grow larger, our database related things only have dependent at data layer and does not blend across whole application)
@@ -9,5 +11,6 @@ public class TaskItemDTO | |||
public bool IsDone { get; set; } | |||
public DateTime CreatedAt { get; set; } | |||
public DateTime UpdatedAt { get; set; } | |||
public Label Label { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of using label entity, i will create a new DTO class for label
public Label Label { get; set; } | |
public Label Label { get; set; } | |
public LabelDTO Label { get; set; } | |
.Select(x => new TaskItemDTO | ||
{ | ||
Id = x.Id, | ||
Title = x.Title | ||
Title = x.Title, | ||
Label = x.Label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
over here you will need to map to new dto once you create dto class
Benefit, now you only return necessary data you need to the endpoint, e.g. you dont need label id you just dont need to have it in dto (encapsulation)
Modify get all task endpoint to include label