-
Notifications
You must be signed in to change notification settings - Fork 0
Check #8
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
Open
jaekkang
wants to merge
28
commits into
main
Choose a base branch
from
ProgramController
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Check #8
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
e853545
Init: Create program controller + test
jaekkang e3454ef
Style: Remove test + enum (not use)
jaekkang cdb3183
Feat: Add method for find by theme in program service
jaekkang e127ec0
Feat: Create request & response dto for program service
jaekkang eb9ba88
Init: Create OpenDay entity
jaekkang c523167
Init: Create FAQ entity
jaekkang dae213c
Feat: Edit method name (create / get -> save / find)
jaekkang 581d9d9
Feat: Add Service for faq controller
jaekkang 2370a8f
Feat: Create entity for fixed date info in Program
jaekkang be6b1d9
Feat: rm OneDay and edit reservation entity
jaekkang e69c8dd
Feat: Edit some column name
jaekkang e59b02a
Feat: Add update method for FAQ
jaekkang 3846853
Style: Edit directory root,
jaekkang f36da77
Comment: Edit comment
jaekkang 5a754e5
Feat: Create banner service , controller
jaekkang 2211a2a
Feat: Edit faq
jaekkang 7219a7a
Feat: Edit faq
jaekkang 727fc04
gitignore
jaekkang 6edb29d
Feat: add base entity in banner
jaekkang 6d7af50
Style: Change method name ( findAll -> findBanners)
jaekkang 50d15d3
Feat: Add exception for find logic in banner
jaekkang 93e5d63
Feat: Add exception for find logic in FAQ & edit method name
jaekkang a863640
Feat: Add delete method in Faq
jaekkang ae12308
Style: Variable name integrated
jaekkang 366d75c
Feat: Add Notification entity
jaekkang ae25628
Style: Change variable name
jaekkang ef5d86a
Feat: merge to main
jaekkang 4523be4
Feat: merge
jaekkang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/main/java/TripAmi/backend/app/banner/exception/BannerNotFound.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package TripAmi.backend.app.banner.exception; | ||
|
|
||
| public class BannerNotFound extends RuntimeException{ | ||
| } |
64 changes: 64 additions & 0 deletions
64
src/main/java/TripAmi/backend/app/banner/infra/BannerServiceImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package TripAmi.backend.app.banner.infra; | ||
|
|
||
| import TripAmi.backend.app.banner.domain.Banner; | ||
| import TripAmi.backend.app.banner.domain.BannerRepository; | ||
| import TripAmi.backend.app.banner.exception.BannerNotFound; | ||
| import TripAmi.backend.app.banner.service.BannerService; | ||
| import TripAmi.backend.web.api.banner.response.BannerDto; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| @Transactional(readOnly = true) | ||
| public class BannerServiceImpl implements BannerService { | ||
| private final BannerRepository bannerRepository; | ||
|
|
||
| @Override | ||
| @Transactional | ||
| public void join(String title, String imgUrl) { | ||
| Banner banner = Banner.builder() | ||
| .title(title) | ||
| .imgUrl(imgUrl) | ||
| .build(); | ||
| bannerRepository.save(banner); | ||
| } | ||
|
|
||
| @Override | ||
| public BannerDto findById(Long id) { | ||
| Banner findOne = bannerRepository.findById(id).orElseThrow(BannerNotFound::new); | ||
| return new BannerDto(id, findOne.getTitle(), findOne.getImgUrl()); | ||
| } | ||
|
|
||
| @Override | ||
| public List<BannerDto> findBanners() { | ||
| List<Banner> items = bannerRepository.findAll(); | ||
| return items.stream() | ||
| .map(item -> new BannerDto( | ||
| item.getId(), | ||
| item.getTitle(), | ||
| item.getImgUrl() | ||
| )).collect(Collectors.toList()); | ||
| } | ||
|
|
||
| @Override | ||
| public BannerDto update(Long id, String title, String imgUrl) { | ||
| Banner banner = bannerRepository.findById(id).orElseThrow(BannerNotFound::new); | ||
| banner.update(title, imgUrl); | ||
| return BannerDto.builder() | ||
| .title(title) | ||
| .imgUrl(imgUrl) | ||
| .build(); | ||
| } | ||
|
|
||
| @Override | ||
| public void delete(Long id) { | ||
| Banner banner = bannerRepository.findById(id).orElseThrow(BannerNotFound::new); | ||
| banner.delete(); | ||
| } | ||
|
|
||
| } |
17 changes: 17 additions & 0 deletions
17
src/main/java/TripAmi/backend/app/banner/service/BannerService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package TripAmi.backend.app.banner.service; | ||
|
|
||
| import TripAmi.backend.web.api.banner.response.BannerDto; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface BannerService { | ||
| void join(String title, String imgUrl); | ||
|
|
||
| BannerDto findById(Long id); | ||
|
|
||
| List<BannerDto> findBanners(); | ||
|
|
||
| BannerDto update(Long id, String title, String imgUrl); | ||
|
|
||
| void delete(Long id); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package TripAmi.backend.app.faq.domain; | ||
|
|
||
| import TripAmi.backend.app.util.BaseEntity; | ||
| import javax.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Table(name = "faq") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Faq { | ||
|
jaekkang marked this conversation as resolved.
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "faq_id") | ||
| private Long id; | ||
|
|
||
| private String question; | ||
|
|
||
| private String answer; | ||
|
|
||
| @Embedded | ||
| private BaseEntity baseEntity = new BaseEntity(); | ||
|
|
||
| @Builder | ||
| public Faq(String question, String answer) { | ||
| this.question = question; | ||
| this.answer = answer; | ||
| } | ||
|
|
||
| public void update(String question, String answer) { | ||
| this.question = question; | ||
| this.answer = answer; | ||
| } | ||
|
|
||
| public void delete() { | ||
| this.baseEntity.delete(); | ||
| } | ||
| } | ||
6 changes: 6 additions & 0 deletions
6
src/main/java/TripAmi/backend/app/faq/domain/FaqRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package TripAmi.backend.app.faq.domain; | ||
|
|
||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| public interface FaqRepository extends JpaRepository<Faq, Long> { | ||
| } |
4 changes: 4 additions & 0 deletions
4
src/main/java/TripAmi/backend/app/faq/exception/FaqNotFound.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package TripAmi.backend.app.faq.exception; | ||
|
|
||
| public class FaqNotFound extends RuntimeException{ | ||
| } |
67 changes: 67 additions & 0 deletions
67
src/main/java/TripAmi/backend/app/faq/infra/FaqServiceImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| package TripAmi.backend.app.faq.infra; | ||
|
|
||
| import TripAmi.backend.app.faq.domain.Faq; | ||
| import TripAmi.backend.app.faq.domain.FaqRepository; | ||
| import TripAmi.backend.app.faq.exception.FaqNotFound; | ||
| import TripAmi.backend.app.faq.service.FaqService; | ||
| import TripAmi.backend.web.api.faq.response.FaqDto; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| @Transactional(readOnly = true) | ||
| public class FaqServiceImpl implements FaqService { | ||
| private final FaqRepository faqRepository; | ||
|
|
||
| @Override | ||
| @Transactional | ||
| public void save(String question, String answer) { | ||
| Faq faq = Faq.builder() | ||
| .question(question) | ||
| .answer(answer) | ||
| .build(); | ||
| faqRepository.save(faq); | ||
| } | ||
|
|
||
| @Override | ||
| public FaqDto findById(Long id) { | ||
| Faq item = faqRepository.findById(id).orElseThrow(FaqNotFound::new); | ||
| return FaqDto.builder() | ||
| .question(item.getQuestion()) | ||
| .answer(item.getAnswer()) | ||
| .build(); | ||
| } | ||
|
|
||
| @Override | ||
| public List<FaqDto> findFaqs() { | ||
| List<Faq> allFaq = faqRepository.findAll(); | ||
| return allFaq.stream() | ||
| .map(item -> new FaqDto( | ||
| item.getQuestion(), | ||
| item.getAnswer() | ||
| )) | ||
| .collect(Collectors.toList()); | ||
| } | ||
|
|
||
| @Override | ||
| @Transactional | ||
| public FaqDto update(Long faqId, String question, String answer) { | ||
| Faq faq = faqRepository.findById(faqId).orElseThrow(FaqNotFound::new); | ||
| faq.update(question, answer); | ||
| return FaqDto.builder() | ||
| .question(question) | ||
| .answer(answer) | ||
| .build(); | ||
| } | ||
|
|
||
| @Override | ||
| public void delete(Long id) { | ||
| Faq faq = faqRepository.findById(id).orElseThrow(FaqNotFound::new); | ||
| faq.delete(); | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
src/main/java/TripAmi/backend/app/faq/service/FaqService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package TripAmi.backend.app.faq.service; | ||
|
|
||
| import TripAmi.backend.web.api.faq.request.FaqCreateRequest; | ||
| import TripAmi.backend.web.api.faq.request.FaqUpdateRequest; | ||
| import TripAmi.backend.web.api.faq.response.FaqDto; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface FaqService { | ||
| void save(String question, String answer); | ||
|
|
||
| FaqDto findById(Long id); | ||
|
|
||
| List<FaqDto> findFaqs(); | ||
|
|
||
| FaqDto update(Long faqId, String question, String answer); | ||
|
|
||
| void delete(Long id); | ||
| } |
21 changes: 21 additions & 0 deletions
21
src/main/java/TripAmi/backend/app/notification/domain/EmitterRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package TripAmi.backend.app.notification.domain; | ||
|
|
||
| import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| public interface EmitterRepository { | ||
| SseEmitter save(String emitterId, SseEmitter sseEmitter); | ||
|
|
||
| void saveEventCache(String emitterId, Object event); | ||
|
|
||
| Map<String, SseEmitter> findAllEmitterStartWithMemberId(String memberId); | ||
|
|
||
| Map<String, Object> findAllEventCacheStartWithByMemberId(String memberId); | ||
|
|
||
| void deleteById(String id); | ||
|
|
||
| void deleteAllEmitterStartWithId(String memberId); | ||
|
|
||
| void deleteAllEventCacheStartWithId(String memberId); | ||
| } |
38 changes: 38 additions & 0 deletions
38
src/main/java/TripAmi/backend/app/notification/domain/Notification.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package TripAmi.backend.app.notification.domain; | ||
|
|
||
| import TripAmi.backend.app.util.BaseEntity; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import javax.persistence.*; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Table(name = "notification") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Notification { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(nullable = false, name = "noti_id") | ||
| private Long id; | ||
|
|
||
| private String title; | ||
|
|
||
| private String content; | ||
|
|
||
| @Column(name = "is_read") | ||
| private Boolean isRead; | ||
|
|
||
| @Embedded | ||
| private BaseEntity baseEntity = new BaseEntity(); | ||
|
|
||
| @Builder | ||
| public Notification(String title, String content) { | ||
| this.title = title; | ||
| this.content = content; | ||
| this.isRead = false; | ||
| } | ||
| } |
6 changes: 6 additions & 0 deletions
6
src/main/java/TripAmi/backend/app/notification/domain/NotificationRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package TripAmi.backend.app.notification.domain; | ||
|
|
||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| public interface NotificationRepository extends JpaRepository<Notification, Long> { | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
faq처럼 updateBanner 이런 식으로 메서드명 통일하면 좋겠습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
faq.update() 처럼 되서 banner 도 updateBanner 가 아닌 그냥 update로 바꾸고 싶은데 어떠세요?