Linked to story item 14
As a developer, I want to have an optional way to get only a certain amount of timesheets based on a date range.
To support this, we should add optional startDate and endDate queries to the getTimesheets endpoint on the backend. These should expect to take in an numerical epoch value. If the startDate given is not the start of the week, the backend should round the epcoh to 00:00:00 of that week's Sunday.
The backend should filter DynamoDB queries by:
- any timesheet item whose
StartDate field is >= the startDate query AND
- any timesheet item whose
StartDate field is < the endDate query
Default values for the queries should be as follows:
- If no
startDate query is provided, the default start date should be 3 weeks prior to the current week's Sunday. That is, if today is Friday, May 12th, the default weeks returned should be for Sunday May 7th, Sunday April 30th, and Sunday April 23rd.
- If no
endDate query is provided, the default end date should be the startDate + 1
If no timesheet is found for that week(s), create new TimesheetSchema object for all companies the user belongs to, write them to the BreaktimeTimesheet DynamoDB table, and return the new TimesheetSchemas. By default, the TimesheetSchema attributes that should be populated for a new timesheet are:
UserId : the current user's sub
TimesheetId : a new generated uuid
CompanyId: the companyId it's being generated for
StartDate: the 00:00:00 Sunday epoch for the week of the startDate query, or the appropriate week's epoch if multiple weeks are requested
Status: an status object with each flag undefined
- all arrays (
WeekNotes, HoursData, and ScheduleTableData) should default to empty arrays
Conditions of satisfaction (make sure to test these manually or with automated tests):
Linked to story item 14
As a developer, I want to have an optional way to get only a certain amount of timesheets based on a date range.
To support this, we should add optional
startDateandendDatequeries to thegetTimesheetsendpoint on the backend. These should expect to take in an numerical epoch value. If the startDate given is not the start of the week, the backend should round the epcoh to 00:00:00 of that week's Sunday.The backend should filter DynamoDB queries by:
StartDatefield is >= thestartDatequery ANDStartDatefield is < theendDatequeryDefault values for the queries should be as follows:
startDatequery is provided, the default start date should be 3 weeks prior to the current week's Sunday. That is, if today is Friday, May 12th, the default weeks returned should be for Sunday May 7th, Sunday April 30th, and Sunday April 23rd.endDatequery is provided, the default end date should be thestartDate+ 1If no timesheet is found for that week(s), create new
TimesheetSchemaobject for all companies the user belongs to, write them to the BreaktimeTimesheet DynamoDB table, and return the newTimesheetSchemas. By default, theTimesheetSchemaattributes that should be populated for a new timesheet are:UserId: the current user's subTimesheetId: a new generated uuidCompanyId: the companyId it's being generated forStartDate: the 00:00:00 Sunday epoch for the week of thestartDatequery, or the appropriate week's epoch if multiple weeks are requestedStatus: an status object with each flag undefinedWeekNotes,HoursData, andScheduleTableData) should default to empty arraysConditions of satisfaction (make sure to test these manually or with automated tests):
startDatequery, and I should receive only that week's timesheetstartDateandendDatequery, and I should receive all timesheets for that userstartDatequery, and I should still receive the correct week's timesheet