Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BettyB979 committed Nov 22, 2023
1 parent 090c270 commit 0215e3f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum ContactEventType {
private Long id;
private Date eventDate;
@NonNull
@JdbcTypeCode(SqlTypes.INTEGER)
@Enumerated(EnumType.ORDINAL)
private ContactEventType type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -38,21 +38,17 @@
+ "|| @AuthorizeMethodDecider.isAdmin() ")
@Tag(name = "7-User", description = "Enpoints to create, update, delete and find users, their events and accreditations")
@Slf4j
@RequiredArgsConstructor
public class SourceAccreditationController {

@Autowired
private SourceAccreditationService sourceAccreditationService;
private final SourceAccreditationService sourceAccreditationService;

@Autowired
private SourceService sourceService;
private final SourceService sourceService;

@Autowired
private UserService userService;
private final UserService userService;

@Autowired
private ViewService viewService;
private final ViewService viewService;

@Autowired
private ModelMapper modelMapper;

@Operation(summary = "Search for source accreditations by source id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@Validated
@RequiredArgsConstructor
public class UserController {

private final UserService userService;

private final SourceService sourceService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -36,16 +36,14 @@
+ "|| @AuthorizeMethodDecider.isAdmin() ")
@Slf4j
@Tag(name = "7-User", description = "Enpoints to create, update, delete and find users, their events and accreditations")
@RequiredArgsConstructor
public class UserEventController {

@Autowired
private ModelMapper modelMapper;
private final ModelMapper modelMapper;

@Autowired
UserService userService;
private final UserService userService;

@Autowired
UserEventService userEventService;
private final UserEventService userEventService;

@Operation(summary = "Search for userEvents by user's id")
@GetMapping(value = Constants.API_USERS_ID_USEREVENTS, produces = "application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.OneToOne;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;

import lombok.*;

import java.util.Date;

@Entity
@Data
@Getter@Setter
@NoArgsConstructor
public class SourceAccreditation {

Expand All @@ -29,7 +25,6 @@ public class SourceAccreditation {
private String idUser;

@OneToOne
@EqualsAndHashCode.Exclude
private Source source;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package fr.insee.survey.datacollectionmanagement.user.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;

import java.util.Set;

@Entity
@Data
@Getter
@Setter
@Table(name = "InternalUsers")
public class User {

Expand All @@ -20,12 +22,11 @@ public enum UserRoleType {
@Id
private String identifier;

@JdbcTypeCode(SqlTypes.INTEGER)
@Enumerated(EnumType.ORDINAL)
private UserRoleType role;

@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@EqualsAndHashCode.Exclude
@ToString.Exclude
private Set<UserEvent> userEvents;

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.Date;

@Entity
@Data
@Getter@Setter
@NoArgsConstructor
public class UserEvent {

Expand All @@ -24,6 +24,7 @@ public enum UserEventType {
private Date eventDate;
@NonNull
@Enumerated(EnumType.ORDINAL)
@JdbcTypeCode(SqlTypes.INTEGER)
private UserEventType type;

@ManyToOne
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/data.sql
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
create domain if not exists jsonb as json;

0 comments on commit 0215e3f

Please sign in to comment.