Skip to content
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

HRIS-379 [BE] API for My Daily Time Record > Index #319

Merged
merged 8 commits into from
Aug 2, 2024

Conversation

sunasterisk-jejercito
Copy link
Contributor

Issue Link

https://framgiaph.backlog.com/view/HRIS-379

Definition of Done

  • Users can get the time entries for a specific user
  • User information can be requested given a user ID just like in ASP.NET

Notes

  • None

Pre-condition

Db has to be running

Commands to run
npm run dev

Expected Output

It should show user's time entries and user details

Screenshots/Recordings

TimeEntriesByEmployeeId query
timeEntriesByEmployeeId

UserbyId query
userById

Comment on lines +22 to +24
it('should be defined', () => {
expect(resolver).toBeDefined();
});
Copy link

Choose a reason for hiding this comment

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

this testing is useless, it only checks resolver if defined or undefined in this testcase
You can do:

  1. delete this test file

OR

  1. or create a new test case that is doing api integration testing that checks returned key valued pairs data.

Comment on lines 48 to 81
const mappedTimesheet: TimeEntryDTO = {
user: timeEntry.user,
startTime: timeEntry.startTime ?
timeEntry.startTime.toISOString().slice(11, 19)
: null,
endTime: timeEntry.endTime ?
timeEntry.endTime.toISOString().slice(11, 19)
: null,
workedHours: timeEntry.workedHours || null,
trackedHours: timeEntry.trackedHours || null,
timeIn: timeEntry.timeIn || null,
timeOut: timeEntry.timeOut || null,
date: timeEntry.date,
late: late,
undertime: undertime,
eslChangeShift: timeEntry.eslChangeShiftRequests.length === 0 ?
null
: timeEntry.eslChangeShiftRequests,
status: workStatus,
isLeaderApproved: timeEntry.overtime?.isLeaderApproved || null,
changeShift: timeEntry.changeShiftRequest || null,
id: timeEntry.id,
userId: timeEntry.userId,
timeInId: timeEntry.timeInId || null,
timeOutId: timeEntry.timeOutId || null,
breakStartTime: timeEntry.breakStartTime,
breakEndTime: timeEntry.breakEndTime,
overtime: timeEntry.overtime || null,
changeShiftRequest: timeEntry.changeShiftRequest || null,
workInterruptions: timeEntry.workInterruptions,
eslOffsets: timeEntry.eslOffsets || null,
createdAt: timeEntry.createdAt || null,
updatedAt: timeEntry.updatedAt || null
};
Copy link

Choose a reason for hiding this comment

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

why do you need to map all of the fields? its not efficient
Isn't the default value null if there's no data?

you can also do this:

const formatTime = (time) => time ? time.toISOString().slice(11, 19) : null;

return {
    ...timeEntry,
    // below fields that needs calculation like below
    startTime: formatTime(timeEntry.startTime),
    endTime: formatTime(timeEntry.endTime),
}

@Miguel21Monacillo Miguel21Monacillo merged commit dec7913 into develop Aug 2, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants