Skip to content

Commit

Permalink
Merge pull request #75 from bandalgomsu/main
Browse files Browse the repository at this point in the history
refactor : properties 수정
  • Loading branch information
bandalgomsu authored Jun 19, 2024
2 parents 4327492 + 5252027 commit a08f215
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.example.jolvre.exhibition.repository.ExhibitImageRepository;
import com.example.jolvre.exhibition.repository.ExhibitQueryDslRepository;
import com.example.jolvre.exhibition.repository.ExhibitRepository;
import com.example.jolvre.notification.entity.NotificationType;
import com.example.jolvre.notification.service.NotificationService;
import com.example.jolvre.user.entity.User;
import com.example.jolvre.user.service.UserService;
Expand All @@ -41,12 +40,11 @@ public class ExhibitService {
private final DiaryRepository diaryRepository;
private final ExhibitCommentRepository exhibitCommentRepository;

private final WebClient webClient;
private final NotificationService notificationService;


private final ExhibitQueryDslRepository exhibitQueryDslRepository;


@Transactional
public ExhibitUploadResponse uploadExhibit(ExhibitUploadRequest request, Long userId) {
Expand Down Expand Up @@ -240,52 +238,7 @@ public ExhibitInvitationResponse createInvitation(Long exhibitId) {

}


@Transactional
public void uploadComment(Long exhibitId, Long loginUserId, ExhibitCommentUploadRequest request) {
Exhibit exhibit = exhibitRepository.findById(exhibitId).orElseThrow(
ExhibitNotFoundException::new);
User user = userService.getUserById(loginUserId);

ExhibitComment comment = ExhibitComment.builder()
.exhibit(exhibit)
.user(user)
.content(request.getContent()).build();

exhibitCommentRepository.save(comment);

notificationService.commentNotificationCreate(loginUserId, exhibit.getUser().getId(),
user.getNickname() + "님이 감상평을 남겼습니다", NotificationType.EXHIBIT_COMMENT);
}

@Transactional
public ExhibitCommentInfoResponses getAllCommentInfo(Long exhibitId) {
List<ExhibitComment> comments = exhibitCommentRepository.findAllByExhibitId(exhibitId);

return ExhibitCommentInfoResponses.toDTO(comments);
}

@Transactional
public void updateComment(Long commentId, Long loginUserId, ExhibitCommentUpdateRequest request) {
ExhibitComment comment = exhibitCommentRepository.findByIdAndUserId(commentId, loginUserId)
.orElseThrow(CommentNotFoundException::new);

comment.updateContent(request.getContent());

exhibitCommentRepository.save(comment);
}

@Transactional
public void deleteComment(Long commentId, Long loginUserId) {
ExhibitComment comment = exhibitCommentRepository.findByIdAndUserId(commentId, loginUserId)
.orElseThrow(CommentNotFoundException::new);

exhibitCommentRepository.delete(comment);
}


// 키워드 기반 전시 조회

public Page<ExhibitInfoResponse> getExhibitInfoByKeyword(String keyword, Pageable pageable) {
return exhibitQueryDslRepository.findAllByFilter(true, keyword, pageable);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ spring.mail.properties.mail.transport.protocol=smtp
#Redis
spring.data.redis.host=${REDIS_HOST}
spring.data.redis.port=${REDIS_PORT}
#Kafka
spring.kafka.bootstrap-servers=localhost:9092
spring.kafka.consumer.group-id=jolvre
#Model API
model.api.url=${MODEL_API_URL}

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ spring.mail.properties.mail.transport.protocol=smtp
#Redis
spring.data.redis.host=${REDIS_HOST}
spring.data.redis.port=${REDIS_PORT}
#Kafka
spring.kafka.bootstrap-servers=localhost:9092
spring.kafka.consumer.group-id=jolvre
34 changes: 0 additions & 34 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,38 +1,4 @@
spring.application.name=Graduate_Minions

spring.profiles.include=oauth,swagger,email,redis,actuator,aws
spring.datasource.driver-class-name=${DB_CLASS}
spring.datasource.url=${DB_URL}
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
#devtools
spring.devtools.restart.enabled=false
#JPA
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.generate-ddl=true
#jwt
jwt.secretKey=${JWT_SECRET_KEY}
jwt.access.expiration=3600000
jwt.access.header=Authorization
jwt.refresh.expiration=1209600000
jwt.refresh.header=Authorization-refresh
#verifyStudent
verify.student.apiKey=${VERIFY_STUDENT_APIKEY}
#File
spring.servlet.multipart.maxFileSize=20MB
spring.servlet.multipart.maxRequestSize=20MB
#Kafka
spring.kafka.bootstrap-servers=localhost:9092
spring.kafka.consumer.group-id=jolvre
#spring.kafka.consumer.auto-offset-reset=earliest
#spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
#spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
#spring.kafka.consumer.client-id=
#spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
#spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer

spring.profiles.active=dev,prod
spring.profiles.include=oauth

Expand Down

0 comments on commit a08f215

Please sign in to comment.