Skip to content

Commit

Permalink
fix: 프로젝트 구조 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
capDoYeonLee committed Sep 29, 2024
1 parent 12bfeb2 commit eedeac7
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 7 deletions.
3 changes: 3 additions & 0 deletions BE/error/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dependencies {
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation group: 'org.javassist', name: 'javassist', version: '3.15.0-GA'
implementation group: 'org.modelmapper', name: 'modelmapper', version: '2.3.9'

// implementation 'org.springframework.cloud:spring-cloud-starter-config'
// implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
Expand All @@ -52,6 +53,8 @@ dependencies {

implementation 'org.hibernate:hibernate-validator:5.2.4.Final'

implementation("org.slf4j:slf4j-simple:1.7.36")

//implementation 'org.springframework.boot:spring-boot-starter-security'
}

Expand Down
3 changes: 1 addition & 2 deletions BE/error/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- MYSQL_ROOT_PASSWORD=root
command: [ "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--lower_case_table_names=1", "--max_connections=2048", "--wait_timeout=3600" ]
ports:
- "13306:3306"
- "3306:3306"
volumes: #볼륨 지정
- ./resources/develop-environment/mysql-init.d:/docker-entrypoint-initdb.d
networks: #사용할 네트워크 지정
Expand Down Expand Up @@ -44,7 +44,6 @@ services:
SPRING_REDIS_PORT: 6379
SPRING_REDIS_PASSWORD: root


networks: #사용할 네트워크 지정
- error-network
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class ApiResponseBody {
@Getter
@AllArgsConstructor
public static class FailureBody implements Serializable { //직렬화를 왜 한거지?
public static class FailureBody implements Serializable {
private String status;
private String code;
private String message;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.demo.schedule.application.dto;

import com.example.demo.auth.persistence.MemberEntity;
import com.example.demo.common.support.dto.AbstractDto;
import com.example.demo.filter.application.model.FilterModel;
import com.example.demo.filter.persistence.FilterEntity;
Expand All @@ -24,5 +25,6 @@ public class CreateScheduleRequest implements AbstractDto {
private String eventPlace;
private String scheduleType;
private FilterEntity filter;
private MemberEntity member;

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.example.demo.schedule.application.model;


import com.example.demo.auth.application.support.Member;
import com.example.demo.auth.persistence.MemberEntity;
import com.example.demo.common.support.AbstractModel;
import com.example.demo.filter.application.model.FilterModel;
import com.example.demo.filter.persistence.FilterEntity;
Expand All @@ -24,6 +26,7 @@ public class ScheduleModel implements AbstractModel {
private String eventPlace;
private String scheduleType;
private FilterEntity filter;
private MemberEntity member;


public ScheduleModel update(ScheduleModel requestModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public ScheduleEntity toEntity(ScheduleModel source) {
.eventPlace(source.getEventPlace())
.scheduleType(source.getScheduleType())
.filter(source.getFilter())
.filter(source.getFilter())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public ScheduleModel from(CreateScheduleRequest source) {
.eventPlace(source.getEventPlace())
.scheduleType(source.getScheduleType())
.filter(source.getFilter())
.member(source.getMember())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,20 @@
import com.example.demo.schedule.persistence.ScheduleEntity;
import com.example.demo.schedule.persistence.ScheduleRepository;
import com.example.demo.schedule.persistence.ScheduleType;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.modelmapper.ModelMapper;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;
import java.time.temporal.WeekFields;
import java.util.List;
Expand Down Expand Up @@ -50,19 +61,24 @@ public List<YearCalendarResponse> getYearSchedule(int year) {
private final ScheduleEntityConverter entityConverter;
private final ScheduleRepository scheduleRepository;
private final ScheduleResponseConverter responseConverter;
private final ModelMapper modelMapper;


@Override
@Transactional
public CreateScheduleResponse create(final CreateScheduleRequest request) {

//ScheduleModel model = modelMapper.map(request, ScheduleModel.class);
ScheduleModel model = requestConverter.from(request);
Long saveId = createSchedule(model);
return responseConverter.from(saveId);
}

private Long createSchedule(ScheduleModel model) {

ScheduleEntity entity = entityConverter.toEntity(model);
ScheduleEntity save = scheduleRepository.save(entity);
//Long memberId = save.getMember().getId();
return save.getEventId();
}

Expand Down Expand Up @@ -177,5 +193,4 @@ private List<ScheduleModel> filterEntitiesByWeek(final LocalDate wantFindWeek) {
.map(entityConverter::from)
.collect(Collectors.toList());
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.demo.schedule.persistence;

import com.example.demo.auth.persistence.MemberEntity;
import com.example.demo.common.persistence.BaseEntity;
import com.example.demo.filter.application.model.FilterModel;
import com.example.demo.filter.persistence.FilterEntity;
Expand Down Expand Up @@ -39,13 +40,14 @@ public class ScheduleEntity extends BaseEntity {
@Column(nullable = false)
private String eventPlace;

//@Enumerated(EnumType.STRING)
@Column(nullable = false)
private String scheduleType;

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "filter_id")
private FilterEntity filter;


@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_id")
private MemberEntity member;
}

0 comments on commit eedeac7

Please sign in to comment.