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

feat: DBC and HeeUser requests from TSS #252

Merged
merged 11 commits into from
Jul 12, 2024
48 changes: 29 additions & 19 deletions src/main/java/uk/nhs/tis/sync/dto/DmsDtoType.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,29 @@
@Getter
public enum DmsDtoType {

CONTACT_DETAILS(ContactDetailsDTO.class, "tcs", "ContactDetails", null),
CURRICULUM(CurriculumDTO.class, "tcs", "Curriculum", CurriculumMapper.class),
CURRICULUM_MEMBERSHIP(CurriculumMembershipWrapperDto.class, "tcs", "CurriculumMembership",
CONTACT_DETAILS(ContactDetailsDTO.class, Schemas.TCS, "ContactDetails", null),
CURRICULUM(CurriculumDTO.class, Schemas.TCS, "Curriculum", CurriculumMapper.class),
CURRICULUM_MEMBERSHIP(CurriculumMembershipWrapperDto.class, Schemas.TCS, "CurriculumMembership",
CurriculumMembershipMapper.class),
DBC_DETAILS(DBCDTO.class, "reference", "DBC", null),
GDC_DETAILS(GdcDetailsDTO.class, "tcs", "GdcDetails", null),
GMC_DETAILS(GmcDetailsDTO.class, "tcs", "GmcDetails", null),
GRADE(GradeDTO.class, "reference", "Grade", GradeMapper.class),
HEE_USER(HeeUserDTO.class, "auth", "HeeUser", HeeUserMapper.class),
PERSON(PersonDTO.class, "tcs", "Person", PersonMapper.class),
PERSONAL_DETAILS(PersonalDetailsDTO.class, "tcs", "PersonalDetails", null),
PLACEMENT_DETAILS(PlacementSummaryDTO.class, "tcs", "Placement", PlacementSummaryMapper.class),
PLACEMENT_SPECIALTY(PlacementSpecialtyDTO.class, "tcs", "PlacementSpecialty",
DBC_DETAILS(DBCDTO.class, Schemas.REFERENCE, "DBC", null),
GDC_DETAILS(GdcDetailsDTO.class, Schemas.TCS, "GdcDetails", null),
GMC_DETAILS(GmcDetailsDTO.class, Schemas.TCS, "GmcDetails", null),
GRADE(GradeDTO.class, Schemas.REFERENCE, "Grade", GradeMapper.class),
HEE_USER(HeeUserDTO.class, Schemas.AUTH, "HeeUser", HeeUserMapper.class),
PERSON(PersonDTO.class, Schemas.TCS, "Person", PersonMapper.class),
PERSONAL_DETAILS(PersonalDetailsDTO.class, Schemas.TCS, "PersonalDetails", null),
PLACEMENT_DETAILS(PlacementSummaryDTO.class, Schemas.TCS, "Placement",
PlacementSummaryMapper.class),
PLACEMENT_SPECIALTY(PlacementSpecialtyDTO.class, Schemas.TCS, "PlacementSpecialty",
PlacementSpecialtyMapper.class),
POST(PostDTO.class, "tcs", "Post", PostMapper.class),
PROGRAMME(ProgrammeDTO.class, "tcs", "Programme", ProgrammeMapper.class),
PROGRAMME_MEMBERSHIP(ProgrammeMembershipDTO.class, "tcs", "ProgrammeMembership",
POST(PostDTO.class, Schemas.TCS, "Post", PostMapper.class),
PROGRAMME(ProgrammeDTO.class, Schemas.TCS, "Programme", ProgrammeMapper.class),
PROGRAMME_MEMBERSHIP(ProgrammeMembershipDTO.class, Schemas.TCS, "ProgrammeMembership",
ProgrammeMembershipMapper.class),
QUALIFICATION(QualificationDTO.class, "tcs", "Qualification", QualificationMapper.class),
SITE(SiteDTO.class, "reference", "Site", SiteMapper.class),
SPECIALTY(SpecialtyDTO.class, "tcs", "Specialty", SpecialtyMapper.class),
TRUST(TrustDTO.class, "reference", "Trust", TrustMapper.class);
QUALIFICATION(QualificationDTO.class, Schemas.TCS, "Qualification", QualificationMapper.class),
SITE(SiteDTO.class, Schemas.REFERENCE, "Site", SiteMapper.class),
SPECIALTY(SpecialtyDTO.class, Schemas.TCS, "Specialty", SpecialtyMapper.class),
TRUST(TrustDTO.class, Schemas.REFERENCE, "Trust", TrustMapper.class);

private final Class<?> dtoType;
private final String schema;
Expand All @@ -86,4 +87,13 @@ public static DmsDtoType fromDto(Object dto) {
}
return null;
}

/**
* Define the schema names.
*/
private static class Schemas {
JosephKelly marked this conversation as resolved.
Show resolved Hide resolved
public static final String AUTH = "auth";
public static final String REFERENCE = "reference";
public static final String TCS = "tcs";
}
}
21 changes: 6 additions & 15 deletions src/test/java/uk/nhs/tis/sync/mapper/HeeUserMapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import com.transformuk.hee.tis.profile.service.dto.HeeUserDTO;
import com.transformuk.hee.tis.profile.service.dto.UserProgrammeDTO;
import com.transformuk.hee.tis.profile.service.dto.UserTrustDTO;
import java.util.HashSet;
import java.util.Set;
import org.junit.Test;
import java.util.Collections;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand All @@ -26,25 +25,17 @@ public void setUp() {

heeUserDto = new HeeUserDTO();
heeUserDto.setActive(true);
HashSet<UserProgrammeDTO> assocProgrammes = new HashSet<>();
assocProgrammes.add(new UserProgrammeDTO());
heeUserDto.setAssociatedProgrammes(assocProgrammes);
HashSet<UserTrustDTO> userTrusts = new HashSet<>();
userTrusts.add(new UserTrustDTO());
heeUserDto.setAssociatedTrusts(userTrusts);
heeUserDto.setAssociatedProgrammes(Collections.singleton(new UserProgrammeDTO()));
heeUserDto.setAssociatedTrusts(Collections.singleton(new UserTrustDTO()));
heeUserDto.setFirstName("first name");
heeUserDto.setName("name");
Set<String> dbcs = new HashSet<>();
dbcs.add("dbc1");
heeUserDto.setDesignatedBodyCodes(dbcs);
heeUserDto.setDesignatedBodyCodes(Collections.singleton("dbc1"));
heeUserDto.setEmailAddress("email");
heeUserDto.setGmcId("gmc");
heeUserDto.setLastName("last name");
heeUserDto.setPassword("password");
heeUserDto.setPhoneNumber("phone");
HashSet<RoleDTO> roles = new HashSet<>();
roles.add(new RoleDTO());
heeUserDto.setRoles(roles);
heeUserDto.setRoles(Collections.singleton(new RoleDTO()));
heeUserDto.setTemporaryPassword(true);
}

Expand Down
Loading