Skip to content

Conversation

enriquezrene
Copy link
Contributor

Please don't merge this PR before this PR is merged and deployed ioet/time-tracker-backend#197

@@ -9,6 +9,8 @@ export interface Entry {
project_id?: string;
owner_email?: string;
description?: string;
customer_id?: string;
Copy link
Contributor

@juanultimate juanultimate Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When are these fields going to be null or undefined (since you are defining them as optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you are creating an entry.

Copy link
Contributor

@juanultimate juanultimate Jul 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the type used when creating time entries 👉 https://github.com/ioet/time-tracker-ui/pull/472/files#diff-bd34e3ddb205e30a185a58e351ccd04eL14 , so I think these new fields might not be optional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The time_entry table has the project id information, the customer info is not saved as part of it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True fact. However, from my perspective, the time_entry table is encapsulated into the API. The frontend does not ( and should not ) know about the database data structures. The frontend does ( and should ) know only about the data structures the endpoints are using ( which might be different from the database structures). In this case, the Entry model/data structure/DTO represents the payload received from the /time-entries endpoint. Therefore, the customer and project information is not going to be empty since there is no way to create an entry without specifying the project ( and thus the customer).

Copy link
Contributor

@juanultimate juanultimate Jul 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, I think we can improve this data structure using compound objects. Something like this:

interface Entry {
  id: string;
  running: boolean;
  start_date: Date;
  end_date?: Date;
  activity_id?: string;
  technologies: string[];
  uri?: string;
  project :{
    id: String
    name: String
   customer:{
      id: String
      name: String
  },
  ...... 
}

This might be done on a different issue since it should involve the backend as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, good idea

@enriquezrene enriquezrene merged commit 2414f1c into master Jul 21, 2020
@enriquezrene enriquezrene deleted the 453-include-guids-on-report branch July 21, 2020 18:32
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

Successfully merging this pull request may close these issues.

2 participants