Skip to content

Commit

Permalink
Merge pull request #57 from soma-lighthouse/develop
Browse files Browse the repository at this point in the history
[LH-199] Fix matching api
  • Loading branch information
YoungJun-L authored Nov 21, 2023
2 parents c1144ed + 4f4c09b commit 5f2b9c9
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 23 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-batch'
implementation 'io.netty:netty-resolver-dns-native-macos:4.1.72.Final:osx-aarch_64'
implementation 'io.micrometer:micrometer-registry-prometheus'

implementation('com.amazonaws:aws-java-sdk-s3:1.12.527') {
exclude group: 'commons-logging', module: 'commons-logging'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,7 @@
@RequiredArgsConstructor
@Component
public class LoggingFilter extends OncePerRequestFilter {

/**
* servletPath:/api/v1/user/form/interests
* <p>
* After request [GET /api/v1/user/form/country, client=0:0:0:0:0:0:0:1, headers=[user-agent:"PostmanRuntime/7.35.0", accept:"*{@literal /}*", host:"localhost:8080", accept-encoding:"gzip, deflate, br", connection:"keep-alive"]]
* <p>
* pathInfo:null
* <p>
* headers:
* <p>
* user-agent: PostmanRuntime/7.35.0
* <p>
* host
*/

@Override
protected void doFilterInternal(@NotNull final HttpServletRequest request,
@NotNull final HttpServletResponse response,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SecurityFilterChain securityFilterChain(final HttpSecurity http) throws Exceptio
.authorizeHttpRequests()
.requestMatchers("/api/v1/admin/**").hasAuthority("ADMIN")
.requestMatchers(HttpMethod.POST, "/api/v1/auth/**", "/api/v1/user/upload/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/v1/user/form/**", "/actuator/health").permitAll()
.requestMatchers(HttpMethod.GET, "/api/v1/user/form/**", "/actuator/**").permitAll()
.requestMatchers(HttpMethod.GET, "/.well-known/**").permitAll()
.requestMatchers("/swagger-ui/**", "/v3/api-docs/**").permitAll()
.anyRequest().authenticated()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public class MatchController {

@GetMapping("/{uuid}/matches")
public ResponseEntity<ResponseDto<MatchedMemberProfilesResponse>> get(@PathVariable final String uuid,
@RequestParam(required = false) final Long nextId,
@RequestParam(required = false) final Long next,
@RequestParam(defaultValue = "10") final int pageSize) {
if (nextId == null) {
if (next == null) {
matchManager.replaceWithNewMatchedMember(uuid);
}
return ResponseEntity.ok(ResponseDto.success(matchManager.read(uuid, nextId, pageSize)));
return ResponseEntity.ok(ResponseDto.success(matchManager.read(uuid, next, pageSize)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void updatePreferredCountries(final Member member, final List<String> pr
}

if (!deletedCountryCodes.isEmpty()) {
preferredCountryRepository.deleteAllByCountryIn(countryRepository.findAllByCodeIn(deletedCountryCodes));
preferredCountryRepository.deleteAllByCountryIn(member, countryRepository.findAllByCodeIn(deletedCountryCodes));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ public interface PreferredCountryRepository extends JpaRepository<PreferredCount

@Modifying
@Transactional
@Query("DELETE FROM PreferredCountry p WHERE p.country.country IN :countries")
void deleteAllByCountryIn(@Param("countries") final List<Country> countries);
@Query("DELETE FROM PreferredCountry p WHERE p.member.member = :member AND p.country.country IN :countries")
void deleteAllByCountryIn(@Param("member") final Member member, @Param("countries") final List<Country> countries);

@Modifying
@Query("DELETE FROM PreferredCountry p WHERE p.member.member = :member")
void deleteAllByMember(@Param("member") final Member member);

}
2 changes: 1 addition & 1 deletion src/main/resources/security
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void deleteAllByCountryIn() {
preferredCountryRepository.saveAll(List.of(preferredKorea, preferredUs));

// when
preferredCountryRepository.deleteAllByCountryIn(List.of(korea, us));
preferredCountryRepository.deleteAllByCountryIn(member, List.of(korea, us));

// then
List<PreferredCountry> actual = preferredCountryRepository.findAllByMember(member);
Expand Down

0 comments on commit 5f2b9c9

Please sign in to comment.