-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #132 Here are some things you should have thought about: **Multi-Tenancy** - [ ] Extended new entities with `AbstractTenantAwareEntity`? - [ ] New entity added to `TenantAwareDatabaseConfiguration`? - [ ] Tested with `dev-multitenant` profile? <!-- Thanks for contributing to the zeiterfassung. Please review the following notes before submitting you pull request. Please look for other issues or pull requests which already work on this topic. Is somebody already on it? Do you need to synchronize? # Security Vulnerabilities 🛑 STOP! 🛑 If your contribution fixes a security vulnerability, please do not submit it. Instead, please write an E-Mail to [email protected] with all the information to recreate the security vulnerability. # Describing Your Changes If, having reviewed the notes above, you're ready to submit your pull request, please provide a brief description of the proposed changes. If they: 🐞 fix a bug, please describe the broken behaviour and how the changes fix it. Please label with 'type: bug' and 'status: new' 🎁 make an enhancement, please describe the new functionality and why you believe it's useful. Please label with 'type: enhancement' and 'status: new' If your pull request relates to any existing issues, please reference them by using the issue number prefixed with #. -->
- Loading branch information
Showing
78 changed files
with
3,961 additions
and
2,327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package de.focusshift.zeiterfassung; | ||
|
||
import java.time.LocalDate; | ||
import java.util.Iterator; | ||
import java.util.NoSuchElementException; | ||
|
||
import static org.springframework.util.Assert.isTrue; | ||
import static org.springframework.util.Assert.notNull; | ||
|
||
/** | ||
* Represents an immutable date range. | ||
* <p> | ||
* A date range represents a period of time between two LocalDates. | ||
* Date range are inclusive of the start and the end date. | ||
* The end date is always greater than or equal to the start date. | ||
* <p> | ||
*/ | ||
public record DateRange(LocalDate startDate, LocalDate endDate) implements Iterable<LocalDate> { | ||
|
||
public DateRange { | ||
notNull(startDate, "expected startDate not to be null"); | ||
notNull(endDate, "expected endDate not to be null"); | ||
isTrue(!startDate.isAfter(endDate), "expected startDate not to be after endDate"); | ||
} | ||
|
||
@Override | ||
public Iterator<LocalDate> iterator() { | ||
return new DateRangeIterator(startDate, endDate); | ||
} | ||
|
||
private static final class DateRangeIterator implements Iterator<LocalDate> { | ||
|
||
private final LocalDate endDate; | ||
private LocalDate cursor; | ||
|
||
DateRangeIterator(LocalDate startDate, LocalDate endDate) { | ||
this.cursor = startDate; | ||
this.endDate = endDate; | ||
} | ||
|
||
@Override | ||
public boolean hasNext() { | ||
return cursor.isBefore(endDate) || cursor.isEqual(endDate); | ||
} | ||
|
||
@Override | ||
public LocalDate next() { | ||
|
||
if (cursor.isAfter(endDate)) { | ||
throw new NoSuchElementException("next date is after endDate which is not in range anymore."); | ||
} | ||
|
||
final LocalDate current = cursor; | ||
cursor = cursor.plusDays(1); | ||
return current; | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/de/focusshift/zeiterfassung/report/ReportDay.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/de/focusshift/zeiterfassung/report/ReportMonth.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/de/focusshift/zeiterfassung/report/ReportWeek.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/java/de/focusshift/zeiterfassung/timeentry/BreakDuration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/java/de/focusshift/zeiterfassung/timeentry/ShouldWorkingHours.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/main/java/de/focusshift/zeiterfassung/timeentry/TimeEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/main/java/de/focusshift/zeiterfassung/timeentry/TimeEntryDay.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/main/java/de/focusshift/zeiterfassung/timeentry/TimeEntryWeek.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/java/de/focusshift/zeiterfassung/timeentry/WorkDuration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.