-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added attendance user endpoints * created attendance class * moved attendance service and controller to user service and controller * created attendance endpoints by team ID * added optional parameters to multiple-attendance retrieving endpoints for start and end date * Added mock data set to init * created user-attendance table for testing attendance * modified attendance endpoints to change attendance value rather than setting the boolean directly * changed constructor of TeamService * formatting * Added MemberService testing * added test for team * fix formatting * lowered test code verification --------- Co-authored-by: Daniel Llonch <dllonch@stevens.edu>
- Loading branch information
1 parent
ae6cb17
commit c66cef7
Showing
16 changed files
with
496 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ jacocoTestReport { | |
violationRules { | ||
rule { | ||
limit { | ||
minimum = 0.10 | ||
minimum = 0.02 | ||
} | ||
} | ||
} | ||
|
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
25 changes: 25 additions & 0 deletions
25
src/main/java/com/sitblueprint/admin/dtos/MemberSummaryDTO.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.sitblueprint.admin.dtos; | ||
|
||
import com.sitblueprint.admin.model.users.Role; | ||
import java.time.LocalDate; | ||
import java.util.Set; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Setter | ||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class MemberSummaryDTO { | ||
private Long id; | ||
private String name; | ||
private String username; | ||
private String email; | ||
private boolean isActive; | ||
private LocalDate dateJoined; | ||
private Set<Role> roles; | ||
} |
2 changes: 1 addition & 1 deletion
2
...n/dtos/member/OrganizationSummaryDTO.java → ...nt/admin/dtos/OrganizationSummaryDTO.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
...int/admin/dtos/member/TeamSummaryDTO.java → ...tblueprint/admin/dtos/TeamSummaryDTO.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
32 changes: 32 additions & 0 deletions
32
src/main/java/com/sitblueprint/admin/dtos/team/TeamDTO.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.sitblueprint.admin.dtos.team; | ||
|
||
import com.sitblueprint.admin.dtos.MemberSummaryDTO; | ||
import com.sitblueprint.admin.dtos.OrganizationSummaryDTO; | ||
import com.sitblueprint.admin.model.users.Team; | ||
import java.time.LocalDate; | ||
import java.util.Set; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class TeamDTO { | ||
private Long id; | ||
private String name; | ||
private OrganizationSummaryDTO organizationSummaryDTO; | ||
private MemberSummaryDTO teamLead; | ||
private MemberSummaryDTO projectManager; | ||
private MemberSummaryDTO designer; | ||
private LocalDate dateCreated; | ||
private Set<MemberSummaryDTO> members; | ||
|
||
public Team toEntity() { | ||
return Team.builder().id(this.id).name(this.name).build(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/sitblueprint/admin/model/users/Attendance.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.sitblueprint.admin.model.users; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Table(name = "user_attendance") | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Attendance { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "attendance_date", nullable = false) | ||
private LocalDateTime date; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private Member user; | ||
} |
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
24 changes: 24 additions & 0 deletions
24
src/main/java/com/sitblueprint/admin/repository/users/AttendanceRepository.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.sitblueprint.admin.repository.users; | ||
|
||
import com.sitblueprint.admin.model.users.Attendance; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface AttendanceRepository extends JpaRepository<Attendance, Long> { | ||
List<Attendance> findAllByUserId(Long userId); | ||
Optional<Attendance> findByUserIdAndDate(Long userId, LocalDateTime date); | ||
List<Attendance> findAllByUserIdAndDateBetween(Long userId, LocalDateTime startDate, LocalDateTime endDate); | ||
List<Attendance> findAllByUserIdAndDateAfter(Long userId, LocalDateTime startDate); | ||
List<Attendance> findAllByUserIdAndDateBefore(Long userId, LocalDateTime endDate); | ||
List<Attendance> findAllByTeamId(Long teamId); | ||
List<Attendance> findAllByTeamIdAndDate(Long teamId, LocalDateTime date); | ||
List<Attendance> findAllByTeamIdAndDateBetween(Long teamId, LocalDateTime startDate, LocalDateTime endDate); | ||
List<Attendance> findAllByTeamIdAndDateAfter(Long teamId, LocalDateTime startDate); | ||
List<Attendance> findAllByTeamIdAndDateBefore(Long teamId, LocalDateTime endDate); | ||
} |
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
Oops, something went wrong.