Skip to content

[$100] Update Resource Booking model to not store time, only dates #204

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

Closed
maxceem opened this issue Apr 20, 2021 · 14 comments
Closed

[$100] Update Resource Booking model to not store time, only dates #204

maxceem opened this issue Apr 20, 2021 · 14 comments

Comments

@maxceem
Copy link
Contributor

maxceem commented Apr 20, 2021

Task

  • Update Resource Booking model startDate and endDate fields so they only store dates without time, same like WorkPeriod.startDate/endDate.
  • Create a migration script that updates all the existent records to store only dates without time (Just cut the time and timezone or any simple way). And it updates the DB model accordingly.
  • Update all Joi schemas so they only accept dates without time and timezone for Resource Booking create/update operations.
  • Make sure that filtering and sorting by start/end dates work good for Resource Booking endoint.
  • Update logic of automatic WorkPeriod creation. Now we don't need timezone conversion. Logic should use Resource Booking dates without time and timezone now. See logic description for create and update https://github.com/topcoder-platform/taas-apis/wiki/TaaS---Scope,-Status-and-permissions#work-period-wp-automation-and-constraints
  • Update all Postman endpoints accordingly, so they all work good.
  • Update Swagger if needed.
  • Update demo data populate by npm run local:init if needed so if works good.
  • Update ES processor test data https://github.com/topcoder-platform/taas-es-processor/tree/feature/work-periods/test/messages and make sure unit and e2e tests pass there.
  • Make sure that data in ES is also stored without time and timezone.
  • Unit tests in TaaS API should pass.
  • Lint should pass.
  • Update anything else which might be affected by this change.

References

@maxceem maxceem added the CF label Apr 20, 2021
@maxceem maxceem added this to the v1.6.0 - Work Periods milestone Apr 20, 2021
@maxceem maxceem changed the title Update Resource Booking model to not store time, only dates [$100] Update Resource Booking model to not store time, only dates Apr 21, 2021
@maxceem
Copy link
Contributor Author

maxceem commented Apr 21, 2021

Challenge https://www.topcoder.com/challenges/3f8d8c21-23b6-4410-9239-62c4ed928fd9 has been created for this ticket.

This is an automated message for maxceem via Topcoder X

@maxceem
Copy link
Contributor Author

maxceem commented Apr 21, 2021

@imcaizheng @eisbilir feel free to pick up this issue as per #1

Please, pick up one issue at a time. It's preferable to complete issues within 12 hours, but maximum of 24 hours.

@maxceem
Copy link
Contributor Author

maxceem commented Apr 21, 2021

@eisbilir, please sign-up with Topcoder X tool

This is an automated message for maxceem via Topcoder X

@maxceem maxceem assigned eisbilir and unassigned eisbilir Apr 21, 2021
@maxceem
Copy link
Contributor Author

maxceem commented Apr 21, 2021

@eisbilir, please sign-up with Topcoder X tool

This is an automated message for maxceem via Topcoder X

@maxceem
Copy link
Contributor Author

maxceem commented Apr 21, 2021

@eisbilir I would take care of Topcoder X tool, please feel free to work on this issue.

@eisbilir
Copy link
Member

eisbilir commented Apr 21, 2021

@maxceem we need to execute new migration script 2021-04-21-make-resource-booking-dates-store-no-timestamp.js before 2021-04-10-populate-work-periods-for-resource-bookings.js so, the populator script will be able to use updated resource booking dates. Can I name the new migration script as 2021-04-09-make-resource-booking-dates-store-no-timestamp.js, so that it can run before 2021-04-10-populate-work-periods-for-resource-bookings.js ?

@maxceem
Copy link
Contributor Author

maxceem commented Apr 21, 2021

Yes, can rename that script.

@eisbilir
Copy link
Member

eisbilir commented Apr 21, 2021

@maxceem I removed the timezone conversion.
According to https://github.com/topcoder-platform/taas-apis/wiki/Work-Periods-(WP)-Automation-and-Constraints#work-period-wp-automation-and-constraints following statements are not implemented yet.

NOTE, that during creating Work Periods we should NOT set daysWorked and should keep it as null.

Once startDate or endDate is set, we don't allow removing them.

Default Days Worked calucalation ...

are they in the scope of this issue?

@maxceem
Copy link
Contributor Author

maxceem commented Apr 21, 2021

@eisbilir ah sorry wrong link. Here is the correct one https://github.com/topcoder-platform/taas-apis/wiki/TaaS---Scope,-Status-and-permissions#work-period-wp-automation-and-constraints (I've fixed the description above).

No, in this issue keep the same logic, and just remove time and timezone. We would handle other updates separately by other issues https://github.com/topcoder-platform/taas-apis/issues?q=is%3Aissue+is%3Aopen+label%3ACF.

@eisbilir
Copy link
Member

eisbilir commented Apr 21, 2021

PR created #214
taas-es-processor#46

@maxceem
Copy link
Contributor Author

maxceem commented Apr 22, 2021

Thank you @eisbilir all the PRs works good for me as per local testing. The payment is processed https://www.topcoder.com/challenges/a880287b-52f0-4b12-9cdc-450a5e948b39

@sandhiyakavi
Copy link
Collaborator

Verified below scenarios. Working as expected.

  1. Newly created/updated RB doesn't include Time zone.
  2. Existing RB doesn't include time details.
  3. Not able to create/update dates of RB with Time zone .
  4. Filtering the RB by startdate/End date is working correctly.
  5. The WP created are displaying the dates and daysworked correctly now.

@maxceem
Copy link
Contributor Author

maxceem commented Apr 23, 2021

Thank you for verification @sandhiyakavi.
Closing as it was only DEV issue.

@maxceem maxceem closed this as completed Apr 23, 2021
@maxceem
Copy link
Contributor Author

maxceem commented Apr 23, 2021

Challenge 3f8d8c21-23b6-4410-9239-62c4ed928fd9 has been cancelled

This is an automated message for maxceem via Topcoder X

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants