Skip to content

Commit

Permalink
Merger : develop conflict 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
byeolhaha committed Nov 8, 2023
2 parents 1b89efb + 6a91e33 commit 4eb99f4
Show file tree
Hide file tree
Showing 78 changed files with 1,907 additions and 128 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
run: |
mkdir -p src/main/resources
echo "${{ secrets.APPLICATION_YML_CONTENT }}" > src/main/resources/application.yml
echo "${{ secrets.APPLICATION_COMMERCIAL_YML_CONTENT }}" > src/main/resources/application-commercial.yml
echo "${{ secrets.APPLICATION_DEV_YML_CONTENT }}" > src/main/resources/application-dev.yml
echo "${{ secrets.APPLICATION_OAUTH_YML_CONTENT }}" > src/main/resources/application-oauth.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/develop-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
run: |
mkdir -p src/main/resources
echo "${{ secrets.APPLICATION_YML_CONTENT }}" > src/main/resources/application.yml
echo "${{ secrets.APPLICATION_COMMERCIAL_YML_CONTENT }}" > src/main/resources/application-commercial.yml
echo "${{ secrets.APPLICATION_DEV_YML_CONTENT }}" > src/main/resources/application-dev.yml
echo "${{ secrets.APPLICATION_OAUTH_YML_CONTENT }}" > src/main/resources/application-oauth.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/academies")
Expand All @@ -38,7 +42,8 @@ public ResponseEntity<AcademyGetResponse> getAcademy(@PathVariable Long academyI
@GetMapping(
path = "/complexes",
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<AcademiesByLocationResponses> findByLocation(@ModelAttribute @Valid AcademiesByLocationRequest request) {
public ResponseEntity<AcademiesByLocationResponses> findByLocation(
@ModelAttribute @Valid AcademiesByLocationRequest request) {
AcademiesByLocationResults academiesByLocation =
academyService.findAcademiesByLocation(AcademiesByLocationRequest.to(request));

Expand All @@ -49,8 +54,9 @@ public ResponseEntity<AcademiesByLocationResponses> findByLocation(@ModelAttribu
@GetMapping(
path = "/search",
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<AcademiesByNameResponses> findByName(@ModelAttribute @Valid AcademiesByNameRequest request) {
AcademiesByNameResults academiesByNameResults = academyService.findAcademiesByName(AcademiesByNameRequest.to(request));
public ResponseEntity<AcademiesByNameResponses> findByName(@ModelAttribute @Valid AcademiesByNameRequest request) {
AcademiesByNameResults academiesByNameResults = academyService.findAcademiesByName(
AcademiesByNameRequest.to(request));

return ResponseEntity.status(HttpStatus.OK)
.body(AcademiesByNameResponses.from(academiesByNameResults));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public record AcademiesByLocationRequest(
@NotNull(message = "Longitude cannot be null")
@DecimalMin(value = "-180", message = "Invalid longitude")
Double lng
){
) {

public static AcademiesByLocationParam to(AcademiesByLocationRequest request) {
return new AcademiesByLocationParam(
request.lat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public record AcademiesByNameRequest(
String academyName,
int pageNumber
) {

public static AcademiesByNameParam to(AcademiesByNameRequest request) {
return new AcademiesByNameParam(
request.academyName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public record AcademiesByLocationResponse(
Double latitude,
Double longitude
) {

public static AcademiesByLocationResponse from(AcademiesByLocationResult academiesByLocationResult) {
return new AcademiesByLocationResponse(
academiesByLocationResult.academyId(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package org.guzzing.studayserver.domain.academy.controller.dto.response;

import org.guzzing.studayserver.domain.academy.service.dto.result.AcademiesByLocationResults;

import java.util.List;
import org.guzzing.studayserver.domain.academy.service.dto.result.AcademiesByLocationResults;

public record AcademiesByLocationResponses(
List<AcademiesByLocationResponse> academyGetResponses
) {

public static AcademiesByLocationResponses from(AcademiesByLocationResults academiesByLocationResults) {
return new AcademiesByLocationResponses (
return new AcademiesByLocationResponses(
academiesByLocationResults.academiesByLocationResults()
.stream()
.map(academiesByLocationResult -> AcademiesByLocationResponse.from(academiesByLocationResult))
.toList()
.stream()
.map(academiesByLocationResult -> AcademiesByLocationResponse.from(academiesByLocationResult))
.toList()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public record AcademiesByNameResponse(
Double latitude,
Double longitude
) {

public static AcademiesByNameResponse from(AcademiesByNameResult academiesByNameResult) {
return new AcademiesByNameResponse(
academiesByNameResult.academyId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import org.springframework.data.domain.Slice;


public record AcademiesByNameResponses (
public record AcademiesByNameResponses(
Slice<AcademiesByNameResponse> academiesByNameResponses
) {

public static AcademiesByNameResponses from(AcademiesByNameResults academiesByNameResults) {
return new AcademiesByNameResponses(
academiesByNameResults.academiesByNameResults()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public record AcademyGetResponse(
LessonGetResponses lessonGetResponses,
ReviewPercentGetResponse reviewPercentGetResponse
) {

public static AcademyGetResponse from(AcademyGetResult academyGetResult) {
return new AcademyGetResponse(
academyGetResult.academyName(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.guzzing.studayserver.domain.academy.controller.dto.response;

import org.guzzing.studayserver.domain.academy.service.dto.result.LessonGetResults;
import java.util.List;
import org.guzzing.studayserver.domain.academy.service.dto.result.LessonGetResults;

public record LessonGetResponses(
List<LessonGetResponse> lessons
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
package org.guzzing.studayserver.domain.academy.model;

import jakarta.persistence.*;
import jakarta.persistence.Column;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import java.util.Objects;

import lombok.Getter;
import org.guzzing.studayserver.domain.academy.model.vo.Address;
import org.guzzing.studayserver.domain.academy.model.vo.Location;
Expand All @@ -28,7 +35,7 @@ public class Academy extends BaseEntity {
@Embedded
private Location location;

@Column(name="max_education_fee")
@Column(name = "max_education_fee")
private Long maxEducationFee;

private Point point;
Expand Down Expand Up @@ -80,10 +87,16 @@ public void changePoint(Point point) {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Academy academy = (Academy) o;
return Objects.equals(id, academy.id) && Objects.equals(academyInfo, academy.academyInfo) && Objects.equals(fullAddress, academy.fullAddress) && Objects.equals(location, academy.location) && Objects.equals(maxEducationFee, academy.maxEducationFee) && Objects.equals(point, academy.point);
return Objects.equals(id, academy.id) && Objects.equals(academyInfo, academy.academyInfo) && Objects.equals(
fullAddress, academy.fullAddress) && Objects.equals(location, academy.location) && Objects.equals(
maxEducationFee, academy.maxEducationFee) && Objects.equals(point, academy.point);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ public class ReviewCount {
@Column(nullable = false, name = "kindness_count")
private int kindnessCount;

@Column(nullable = false,name = "good_facility_count")
@Column(nullable = false, name = "good_facility_count")
private int goodFacilityCount;

@Column(nullable = false, name="cheap_fee_count")
@Column(nullable = false, name = "cheap_fee_count")
private int cheapFeeCount;

@Column(nullable = false, name="good_management_count")
@Column(nullable = false, name = "good_management_count")
private int goodManagementCount;

@Column(nullable = false, name="lovely_teaching_count")
@Column(nullable = false, name = "lovely_teaching_count")

private int lovelyTeachingCount;

@Column(nullable = false, name = "reviewers_count")
Expand All @@ -56,7 +57,7 @@ protected ReviewCount() {
}

protected ReviewCount(int kindnessCount, int goodFacilityCount, int cheapFeeCount, int goodManagementCount,
int lovelyTeachingCount, int reviewersCount, Academy academy) {
int lovelyTeachingCount, int reviewersCount, Academy academy) {
this.kindnessCount = kindnessCount;
this.goodFacilityCount = goodFacilityCount;
this.cheapFeeCount = cheapFeeCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import jakarta.persistence.Embedded;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;

import java.util.Objects;

import lombok.Getter;
import org.springframework.util.Assert;

Expand Down Expand Up @@ -36,7 +38,7 @@ protected AcademyInfo(final String academyName, final String phoneNumber, final
}

public static AcademyInfo of(final String name, final String contact, final String shuttle,
final String areaOfExpertise) {
final String areaOfExpertise) {
return new AcademyInfo(name, contact, shuttle, areaOfExpertise);
}

Expand Down Expand Up @@ -64,6 +66,7 @@ public boolean equals(Object o) {
return false;
}
AcademyInfo that = (AcademyInfo) o;

return Objects.equals(academyName, that.academyName) && Objects.equals(phoneNumber, that.phoneNumber) && shuttle == that.shuttle;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public record AcademiesByLocation(
Double latitude,
Double longitude
) {

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.guzzing.studayserver.domain.academy.repository;

public interface AcademiesByName {

Long getAcademyId();

String getAcademyName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ default Academy getById(Long academyId) {
.orElseThrow(() -> new EntityNotFoundException(ErrorCode.NOT_FOUND_ENTITY.getMessage()));
}

@Query(value = "SELECT a.id AS academyId, a.academy_name AS academyName, a.full_address AS fullAddress, a.latitude, a.longitude " +
"FROM academies As a " +
"WHERE MATCH(a.academy_name) AGAINST(:academyName IN BOOLEAN MODE)",
@Query(value =
"SELECT a.id AS academyId, a.academy_name AS academyName, a.full_address AS fullAddress, a.latitude, a.longitude "
+
"FROM academies As a " +
"WHERE MATCH(a.academy_name) AGAINST(:academyName IN BOOLEAN MODE)",
countQuery = "SELECT COUNT(a.id) FROM academies As a WHERE MATCH(a.academy_name) AGAINST(:academyName IN BOOLEAN MODE)",
nativeQuery = true)
Slice<AcademiesByName> findAcademiesByName(@Param("academyName") String academyName, Pageable pageable);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.guzzing.studayserver.domain.academy.repository.academy;

import java.util.List;
import org.guzzing.studayserver.domain.academy.repository.AcademiesByLocation;
import org.guzzing.studayserver.domain.academy.repository.AcademyByFiltering;
import org.guzzing.studayserver.domain.academy.repository.AcademyFilterCondition;

import java.util.List;

public interface AcademyQueryRepository {

List<AcademiesByLocation> findAcademiesByLocation(String pointFormat);

List<AcademyByFiltering> filterAcademies(AcademyFilterCondition academyFilterCondition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

import jakarta.persistence.EntityManager;
import jakarta.persistence.Query;
import java.util.List;
import org.guzzing.studayserver.domain.academy.repository.AcademiesByLocation;
import org.guzzing.studayserver.domain.academy.repository.AcademyByFiltering;
import org.guzzing.studayserver.domain.academy.repository.AcademyFilterCondition;
import org.hibernate.transform.ResultTransformer;
import org.hibernate.type.StandardBasicTypes;


import java.util.List;

public class AcademyQueryRepositoryImpl implements AcademyQueryRepository {

private final EntityManager em;

public AcademyQueryRepositoryImpl(EntityManager em) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.guzzing.studayserver.domain.academy.repository.academy;

import java.util.List;
import org.guzzing.studayserver.domain.academy.model.Academy;
import org.guzzing.studayserver.domain.academy.repository.AcademiesByLocation;
import org.guzzing.studayserver.domain.academy.repository.AcademiesByName;
Expand All @@ -9,8 +10,6 @@
import org.springframework.data.domain.Slice;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AcademyRepository extends AcademyJpaRepository, AcademyQueryRepository {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.data.jpa.repository.JpaRepository;

public interface LessonJpaRepository extends JpaRepository<Lesson, Long> {

List<Lesson> findAllByAcademyId(Long academyId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.List;
import org.guzzing.studayserver.domain.academy.model.Lesson;

public interface LessonRepository extends LessonJpaRepository{
public interface LessonRepository extends LessonJpaRepository {

List<Lesson> findAllByAcademyId(Long academyId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.guzzing.studayserver.domain.academy.model.ReviewCount;

public interface ReviewCountRepository extends ReviewCountJpaRepository{
public interface ReviewCountRepository extends ReviewCountJpaRepository {

ReviewCount getByAcademyId(Long academyId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ public record AcademiesByLocationParam(
Double baseLatitude,
Double baseLongitude
) {

public static AcademiesByLocationParam of(Double baseLatitude,
Double baseLongitude) {
Double baseLongitude) {
return new AcademiesByLocationParam(baseLatitude, baseLongitude);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public record AcademiesByNameParam(
String academyName,
int pageNumber
) {

public static AcademiesByNameParam of(String academyName, int pageNumber) {
return new AcademiesByNameParam(academyName, pageNumber);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.guzzing.studayserver.domain.academy.service.dto.result;

import org.guzzing.studayserver.domain.academy.repository.AcademiesByLocation;

import java.util.List;
import org.guzzing.studayserver.domain.academy.repository.AcademiesByLocation;

public record AcademiesByLocationResults(
List<AcademiesByLocationResult> academiesByLocationResults
) {

public static AcademiesByLocationResults to(List<AcademiesByLocation> academiesByLocations) {
return new AcademiesByLocationResults(
academiesByLocations.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public record AcademiesByNameResult(
Double latitude,
Double longitude
) {

public static AcademiesByNameResult from(AcademiesByName academiesByName) {
return new AcademiesByNameResult(
academiesByName.getAcademyId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
public record AcademiesByNameResults(
Slice<AcademiesByNameResult> academiesByNameResults
) {

public static AcademiesByNameResults to(Slice<AcademiesByName> academiesByNames) {
return new AcademiesByNameResults(
academiesByNames.map(AcademiesByNameResult::from));
Expand Down
Loading

0 comments on commit 4eb99f4

Please sign in to comment.