hjohnson12 / Kanban-Tasker

A simple personal kanban board for Windows 10 Universal Windows Platform (UWP) to manage tasks and create a simple and easy workflow for each board
Other
269 stars 45 forks source link

Data Transfer Objects #5

Closed sam-wheat closed 5 years ago

sam-wheat commented 5 years ago

I suggest some Data Transfer Objects (DTO) for the classes used by Kanban. What do you think:

public class BoardDTO
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Notes { get; set; }

    public virtual ICollection<TaskDTO> Tasks { get; set; }
}

public class TaskDTO
{
    public int Id { get; set; }
    public int? BoardId { get; set; }
    public string DateCreated { get; set; }
    public string Title { get; set; }
    public string Description { get; set; }
    public string Category { get; set; }
    public int? ColumnIndex { get; set; }
    public string ColorKey { get; set; }
    public string Tags { get; set; }

    public virtual BoardDTO Board { get; set; }
}
sam-wheat commented 5 years ago

Will definitely make the api more maintainable and readable. We can write methods like

List<Task> tasks = dataProvider.GetTasks();

Task task = new Task{...};
var result = dataProvider.SaveTask(task);

instead of passing all the properties around.

I think we should decouple the UI from the business logic layer and domain model. This will allow a clean API. You think so too?

hjohnson12 commented 5 years ago

Will definitely make the api more maintainable and readable. We can write methods like

List<Task> tasks = dataProvider.GetTasks();

Task task = new Task{...};
var result = dataProvider.SaveTask(task);

instead of passing all the properties around.

I think we should decouple the UI from the business logic layer and domain model. This will allow a clean API. You think so too?

Sorry for the late reply! But I definitely agree. It will be much more maintainable too, especially with the cleanup in the VMs. I saw a few of your changes in the PR, I'll finish looking and do some testing, then merge in :)

leaderanalytics commented 5 years ago

Sounds good! BTW I implemented the workaround suggested by UWP team so the nav menu is back to normal. Please feel free to ask about the code. Some of the dependency injection stuff is hard to grasp at first. It will all come together when we add some additional Data Providers.

hjohnson12 commented 5 years ago

Sounds good, I'll take a look and let you know if I have any questions! I've done a little work with dependency injection, but not too much!