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

fix: 잘못된 파일 삭제 #75

Merged
merged 7 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ dependencies {
implementation 'com.opencsv:opencsv:5.5.2'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'jakarta.persistence:jakarta.persistence-api:3.1.0'
implementation 'com.opencsv:opencsv:5.5.2'

implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jakarta'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@
import com.gamsa.activity.dto.ActivityDetailResponse;
import com.gamsa.activity.dto.ActivityFilterRequest;
import com.gamsa.activity.dto.ActivityFindSliceResponse;
import com.gamsa.activity.dto.ActivitySaveRequest;
import com.gamsa.activity.service.ActivityService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@RestController
Expand Down Expand Up @@ -52,10 +43,4 @@ public Slice<ActivityFindSliceResponse> findSlice(
public ActivityDetailResponse findById(@PathVariable("activity-id") Long activityId) {
return activityService.findById(activityId);
}

@PostMapping
public ResponseEntity<String> save(@RequestBody ActivitySaveRequest saveRequest) {
activityService.save(saveRequest);
return new ResponseEntity<>(HttpStatus.CREATED);
}
}
62 changes: 0 additions & 62 deletions src/main/java/com/gamsa/activity/dto/ActivityApiResponse.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class ActivityDetailResponse {
private final boolean adultPossible;
private final boolean teenPossible;
private final boolean groupPossible;
private final BigDecimal latitude;
private final BigDecimal longitude;
private final int actWeek;
private final String actManager;
private final String actPhone;
Expand All @@ -55,6 +57,8 @@ public static ActivityDetailResponse from(Activity activity, Map<QuestionRespons
.adultPossible(activity.isAdultPossible())
.teenPossible(activity.isTeenPossible())
.groupPossible(activity.isGroupPossible())
.latitude(activity.getLatitude())
.longitude(activity.getLongitude())
.actWeek(activity.getActWeek())
.actManager(activity.getActManager())
.actPhone(activity.getActPhone())
Expand Down
32 changes: 19 additions & 13 deletions src/main/java/com/gamsa/activity/dto/ActivityFindSliceResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import com.gamsa.activity.constant.Category;
import com.gamsa.activity.domain.Activity;
import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Getter
@Builder
@RequiredArgsConstructor
Expand All @@ -21,22 +23,26 @@ public class ActivityFindSliceResponse {
private final LocalDateTime actEndDate;
private final int actStartTime;
private final int actEndTime;
private final BigDecimal latitude;
private final BigDecimal longitude;
private final int recruitTotalNum;
private final Category category;

public static ActivityFindSliceResponse from(Activity activity) {
return ActivityFindSliceResponse.builder()
.actId(activity.getActId())
.actTitle(activity.getActTitle())
.actLocation(activity.getActLocation())
.noticeStartDate(activity.getNoticeStartDate())
.noticeEndDate(activity.getNoticeEndDate())
.actStartDate(activity.getActStartDate())
.actEndDate(activity.getActEndDate())
.actStartTime(activity.getActStartTime())
.actEndTime(activity.getActEndTime())
.recruitTotalNum(activity.getRecruitTotalNum())
.category(activity.getCategory())
.build();
.actId(activity.getActId())
.actTitle(activity.getActTitle())
.actLocation(activity.getActLocation())
.noticeStartDate(activity.getNoticeStartDate())
.noticeEndDate(activity.getNoticeEndDate())
.actStartDate(activity.getActStartDate())
.actEndDate(activity.getActEndDate())
.actStartTime(activity.getActStartTime())
.actEndTime(activity.getActEndTime())
.latitude(activity.getLatitude())
.longitude(activity.getLongitude())
.recruitTotalNum(activity.getRecruitTotalNum())
.category(activity.getCategory())
.build();
}
}
11 changes: 8 additions & 3 deletions src/main/java/com/gamsa/activity/dto/ActivitySaveRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Getter
Expand All @@ -29,15 +30,17 @@ public class ActivitySaveRequest {
private final boolean adultPossible;
private final boolean teenPossible;
private final boolean groupPossible;
private final BigDecimal latitude;
private final BigDecimal longitude;
private final int actWeek;
private final String actManager;
private final String actPhone;
private final String url;
private final Category category;
private final Long instituteId;
private final String instituteName;
private final Integer sidoGunguCode;

public Activity toModel(Institute institute, District sidoGungu) {
public Activity toModel(Institute institute, District district) {
return Activity.builder()
.actId(actId)
.actTitle(actTitle)
Expand All @@ -53,13 +56,15 @@ public Activity toModel(Institute institute, District sidoGungu) {
.adultPossible(adultPossible)
.teenPossible(teenPossible)
.groupPossible(groupPossible)
.longitude(longitude)
.latitude(latitude)
.actWeek(actWeek)
.actManager(actManager)
.actPhone(actPhone)
.url(url)
.category(category)
.institute(institute)
.sidoGungu(sidoGungu)
.sidoGungu(district)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.gamsa.activity.dto;

import com.gamsa.activity.domain.District;
import com.gamsa.activity.domain.Institute;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.math.BigDecimal;
import java.util.Map;
Expand All @@ -22,13 +19,14 @@ public class InstituteApiResponse {
private String phone;

public InstituteSaveRequest toSaveRequest(Map<String, BigDecimal> coordinates) {

return InstituteSaveRequest.builder()
.name(name)
.location(location)
.sidoCode(sidoCode)
.sidoGunguCode(sidoGunguCode)
.longitude(coordinates.get("longitude"))
.latitude(coordinates.get("latitude"))
.longitude(coordinates.getOrDefault("longitude", new BigDecimal(1)))
.latitude(coordinates.getOrDefault("latitude", new BigDecimal(1)))
.phone(phone)
.build();
}
Expand Down
23 changes: 14 additions & 9 deletions src/main/java/com/gamsa/activity/dto/InstituteDetailResponse.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.gamsa.activity.dto;

import com.gamsa.activity.domain.Institute;
import java.math.BigDecimal;
import com.gamsa.review.dto.QuestionResponse;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.math.BigDecimal;
import java.util.Map;

@Getter
@Builder
@RequiredArgsConstructor
Expand All @@ -17,15 +20,17 @@ public class InstituteDetailResponse {
private final BigDecimal latitude;
private final BigDecimal longitude;
private final String phone;
private final Map<QuestionResponse, BigDecimal> scores;

public static InstituteDetailResponse from(Institute institute) {
public static InstituteDetailResponse from(Institute institute, Map<QuestionResponse, BigDecimal> scores) {
return InstituteDetailResponse.builder()
.instituteId(institute.getInstituteId())
.name(institute.getName())
.location(institute.getLocation())
.latitude(institute.getLatitude())
.longitude(institute.getLongitude())
.phone(institute.getPhone())
.build();
.instituteId(institute.getInstituteId())
.name(institute.getName())
.location(institute.getLocation())
.latitude(institute.getLatitude())
.longitude(institute.getLongitude())
.phone(institute.getPhone())
.scores(scores)
.build();
}
}
Loading
Loading