Skip to content

Commit

Permalink
added created at property for change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
vpClockodo committed Oct 5, 2023
1 parent 8b5e133 commit 01d9f98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/models/workTimes.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,26 @@ const createChangeRequest = ({
date,
id,
status = WorkTimeChangeRequestStatus.Requested,
createdAt,
}: {
date: Date;
id: number;
status?: WorkTimeChangeRequestStatus;
createdAt?: Date;
}): WorkTimeChangeRequest => {
const changes = generateChangeRequestChanges({
count: faker.datatype.number({ min: 1, max: 4 }),
date,
});
const isoDate = isoDateFromDateTime(date);
const isoCreatedAt = isoDateFromDateTime(createdAt ?? new Date());

return {
id,
date: isoDate,
usersId: 0,
changes,
createdAt: isoCreatedAt,
...(status === WorkTimeChangeRequestStatus.Declined
? {
status: WorkTimeChangeRequestStatus.Declined,
Expand Down
1 change: 1 addition & 0 deletions src/models/workTimes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type WorkTimeChangeRequest = {
id: number;
date: IsoDate;
usersId: number;
createdAt: IsoDate;
changes: Array<WorkTimeChangeRequestInterval>;
} & (
| {
Expand Down

0 comments on commit 01d9f98

Please sign in to comment.