Skip to content

Commit

Permalink
Merge branch 'develop' of https://i10d111.p.ssafy.io:8989/S10P12D111 โ€ฆ
Browse files Browse the repository at this point in the history
โ€ฆinto fix/#217-search-engine-be

Change-Id: Ifa46ba0091dc399f82d80ba8f65fb15d479846b6
  • Loading branch information
404-not-foundl committed Feb 15, 2024
2 parents 377a15f + 98f09ea commit b0812c3
Show file tree
Hide file tree
Showing 84 changed files with 1,287 additions and 299 deletions.
Binary file added README.assets/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/erd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/ggumtle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/ggumtle1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/ggumtle2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/ggumtle3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/ggumtle4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/ggumtle5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/ggumtle6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/ggumtle7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README.assets/title.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 81 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,81 @@
# ggumtle
์•„์ž์•„์ž! ์ž˜ํ•˜์ž!
# <img src="README.assets/ggumtle.png" height = 25px> ๊ฟˆ : ํ‹€ ์†Œ๊ฐœ
![Alt text](/README.assets/title.gif)

๊ฟˆ, ์ด์ œ๋Š” ์ •๋ง ์ด๋ค„๋‚˜๊ฐˆ ์‹œ๊ฐ„.
๋งˆ์Œ์—๋งŒ ๋‹ด์•„๋‘์ง€ ๋ง๊ณ  ๊ฟˆํ‹€์— ๋‹ด์•„๋ณด์„ธ์š”.

๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์€ ๊ฐ€์Šด ํ•œ์ผ ์— ์–ด๋–ค ๊ฟˆ์„ ํ’ˆ์€ ์ฑ„ ์‚ด์•„๊ฐˆ๊นŒ์š”?
๋‚˜์™€ ๊ฐ™์€ ๊ฟˆ์„ ๋จผ์ € ์ด๋ฃฉํ•œ ์„ ๋ฐฐ ๊ฟˆ๊พผ์ด๋Š” ์–ด๋–ค ์—ฌ์ •์„ ๊ฒช์—ˆ์„๊นŒ์š”?

๊ฟˆํ‹€์—์„œ ๋‹ค์ฑ„๋กญ๊ณ  ๊ฐ๋™์ ์ธ ๊ฟˆ๋“ค์„ ๋งŒ๋‚˜๋ณด์„ธ์š”.
๊ฟˆ๋‚˜๋ผ๋กœ ์ดˆ๋Œ€ํ•ฉ๋‹ˆ๋‹ค. ๊ฟˆํ‹€์—์„œ ๋งŒ๋‚˜์š”.
<br>

# <img src="README.assets/ggumtle1.png" height = 25px> ์„œ๋น„์Šค ์ฃผ์š” ๊ธฐ๋Šฅ

#### 1. ์นœ๋ฐ€๋„์— ๋”ฐ๋ฅธ ๋ ˆ์ด๋‹ค ์กฐํšŒ ๋ฐ ๊ฟˆ ์นดํ…Œ๊ณ ๋ฆฌ ๋ณ„ ๋ ˆ์ด๋‹ค ์กฐํšŒ
#### 2. ์„ค์ •์ฃผ๊ธฐ์— ๋”ฐ๋ฅธ ๊ฟˆ ๋ฆฌ๋งˆ์ธ๋“œ
#### 3. ์œ ์ €๊ฐ„ ์ƒํ˜ธ์ž‘์šฉ(ํŒ”๋กœ์šฐ, ๋Œ“๊ธ€, ๋ฆฌ์•ก์…˜)
#### 4. ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ์œผ๋กœ ์‚ฌ์šฉ์ž, ๊ฟˆํ‹€, ํ›„๊ธฐ ๋ชฉ๋ก ์กฐํšŒ
#### 5. ํ•„ํ„ฐ ๊ธฐ๋Šฅ์„ ์ ์šฉํ•œ ์œ ์ € ํƒ€์ž„๋ผ์ธ ์กฐํšŒ
#### 6. SSE๋ฅผ ํ™œ์šฉํ•œ ์ƒํ˜ธ์ž‘์šฉ ์•Œ๋žŒ
#### 7. ๊ฟˆ ๋‹ฌ์„ฑ์‹œ ํƒ€์ž„ ์บก์Š ํ™•์ธ ๋ฐ ์†Œ์…œ ๊ณต์œ  ๊ธฐ๋Šฅ

<br>

# <img src="README.assets/ggumtle2.png" height = 25px> ์„œ๋น„์Šค ์‹œ์—ฐ ๋™์˜์ƒ

<br>

# <img src="README.assets/ggumtle4.png" height = 25px> ๊ฐœ๋ฐœํ™˜๊ฒฝ

### Backend
<img src="https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white"><img src="https://img.shields.io/badge/20.04 LTS-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge&logo=openjdk&logoColor=white"><img src="https://img.shields.io/badge/17-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/spring boot-%236DB33F.svg?style=for-the-badge&logo=spring&logoColor=white"><img src="https://img.shields.io/badge/3.2.1-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/spring secutiry-%236DB33F.svg?style=for-the-badge&logo=spring&logoColor=white">
<img src="https://img.shields.io/badge/Spring Data JPA-%236DB33F.svg?style=for-the-badge&logo=spring&logoColor=white">
<img src="https://img.shields.io/badge/Gradle-02303A.svg?style=for-the-badge&logo=Gradle&logoColor=white"><img src="https://img.shields.io/badge/8.5-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/mysql-%2300f.svg?style=for-the-badge&logo=mysql&logoColor=white"><img src="https://img.shields.io/badge/8.0.36-515151?style=for-the-badge"> <img src="https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white"><img src="https://img.shields.io/badge/5.0.7-515151?style=for-the-badge">

### Frontend
<img src="https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB"><img src="https://img.shields.io/badge/18.2.0-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white"><img src="https://img.shields.io/badge/20.11.0-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/NPM-%23CB3837.svg?style=for-the-badge&logo=npm&logoColor=white"><img src="https://img.shields.io/badge/10.2.4-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/vite-%23646CFF.svg?style=for-the-badge&logo=vite&logoColor=white"><img src="https://img.shields.io/badge/5.0.8-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white"><img src="https://img.shields.io/badge/5.2.2-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/-React%20Query-FF4154?style=for-the-badge&logo=react%20query&logoColor=white"><img src="https://img.shields.io/badge/5.17.15-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/react%20zustand-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB"><img src="https://img.shields.io/badge/4.5.0-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/React_Router_dom-CA4245?style=for-the-badge&logo=react-router&logoColor=white"><img src="https://img.shields.io/badge/6.21.3-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/axios-5a29e4?style=for-the-badge&logoColor=white"><img src="https://img.shields.io/badge/1.6.7-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/tailwindcss-%2338B2AC.svg?style=for-the-badge&logo=tailwind-css&logoColor=white"><img src="https://img.shields.io/badge/3.4.1-515151?style=for-the-badge">

### CI/CD
<img src="https://img.shields.io/badge/AWS ec2 ubuntu-%23FF9900.svg?style=for-the-badge&logo=amazon-aws&logoColor=white"><img src="https://img.shields.io/badge/20.11.0-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/nginx-%23009639.svg?style=for-the-badge&logo=nginx&logoColor=white"><img src="https://img.shields.io/badge/1.18.0-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/jenkins-%232C5263.svg?style=for-the-badge&logo=jenkins&logoColor=white"><img src="https://img.shields.io/badge/2.426.2-515151?style=for-the-badge">

### ํ˜‘์—… ํˆด
<img src="https://img.shields.io/badge/gitlab-%23181717.svg?style=for-the-badge&logo=gitlab&logoColor=white">
<img src="https://img.shields.io/badge/jira-%230A0FFF.svg?style=for-the-badge&logo=jira&logoColor=white">
<img src="https://img.shields.io/badge/gerrit-347dbe?style=for-the-badge&logoColor=white"><img src="https://img.shields.io/badge/3.8.1-515151?style=for-the-badge">
<img src="https://img.shields.io/badge/mattermost-1e325c?style=for-the-badge&logoColor=white">

<br>

# <img src="README.assets/ggumtle5.png" height = 25px> ์„œ๋น„์Šค ์•„ํ‚คํ…์ณ
![Alt text](/README.assets/architecture.png)
<br>

# <img src="README.assets/ggumtle6.png" height = 25px> ER Diagram
![Alt text](/README.assets/erd.png)

<br>

# <img src="README.assets/ggumtle7.png" height = 25px> ํŒ€ ์†Œ๊ฐœ
|์ด์šฐ์„ฑ|์ด์›์ฃผ|์ „์ง€ํ™˜|์„œ์ค€ํ˜ธ|์‹ ์ฐฝ์—ฝ|์กฐ์ธํ™”|
|:---:|:---:|:---:|:---:|:---:|:---:|
|<img src="https://avatars.githubusercontent.com/u/42796944?v=4" height = 100px>|<img src="https://avatars.githubusercontent.com/u/101818687?v=4" height = 100px>|<img src="https://avatars.githubusercontent.com/u/81613019?v=4" height = 100px>|<img src="https://avatars.githubusercontent.com/u/140311409?v=4" height = 100px>|<img src="https://avatars.githubusercontent.com/u/69495305?v=4" height = 100px>|<img src="https://avatars.githubusercontent.com/u/75416721?v=4" height = 100px>|
|`FE` `QA`<br>[@leewooseong](https://github.com/leewooseong)|`FE ๋ฆฌ๋”`<br>[@3o14](https://github.com/3o14)|`BE` `PM`<br>[@DarkBlackRice](https://github.com/DarkBlackRice)|`BE` `INFRA`<br>[@ho97s](https://github.com/ho97s)|`BE ๋ฆฌ๋”`<br>[@404](https://github.com/404-not-foundl)|`BE` `QA`<br>[@jjjoina](https://github.com/jjjoina)|
<hr>

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import com.ggums.ggumtle.common.exception.CustomException;
import com.ggums.ggumtle.common.exception.ExceptionType;
import com.ggums.ggumtle.dto.response.model.AlarmDto;
import com.ggums.ggumtle.entity.*;
import com.ggums.ggumtle.repository.AlarmRepository;
import com.ggums.ggumtle.repository.BucketRepository;
import com.ggums.ggumtle.repository.UserRepository;
import com.ggums.ggumtle.service.AlarmService;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
Expand All @@ -32,7 +34,7 @@ public class AlarmHandler {
public final Map<Long, SseEmitter> userEmitters = new ConcurrentHashMap<>();
private final AlarmRepository alarmRepository;
private final BucketRepository bucketRepository;
private final UserRepository userRepository;
private final AlarmService alarmService;

// Giving connection signals to client
@Async
Expand Down Expand Up @@ -61,14 +63,14 @@ public void createUserAlarm(User receiver, User sender, AlarmType type){
if (!receiver.getAlarm()) {
return;
}
Alarm alarm = Alarm.builder()
Alarm alarm = Alarm.builder()
.receiver(receiver)
.sender(sender)
.type(type)
.dataId(sender != null ? sender.getId() : null)
.build();
alarmRepository.save(alarm);
sendEventToUser(receiver.getId());
sendEventToUser(receiver.getId(), alarm);
}

/**
Expand All @@ -91,7 +93,7 @@ public void createBucketAlarm(User receiver, User sender, AlarmType type, Bucket
.dataId(bucket.getId())
.build();
alarmRepository.save(alarm);
sendEventToUser(receiver.getId());
sendEventToUser(receiver.getId(), alarm);
}

/**
Expand All @@ -114,7 +116,7 @@ public void createReviewAlarm(User receiver, User sender, AlarmType type, Review
.dataId(review.getId())
.build();
alarmRepository.save(alarm);
sendEventToUser(receiver.getId());
sendEventToUser(receiver.getId(), alarm);
}

/**
Expand Down Expand Up @@ -147,7 +149,7 @@ public void createCommentAlarm(User receiver, User sender, AlarmType type, Strin
}

alarmRepository.save(alarm);
sendEventToUser(receiver.getId());
sendEventToUser(receiver.getId(), alarm);
}

/**
Expand All @@ -164,7 +166,7 @@ public void createReminderAlarm(User receiver, Bucket bucket){
.dataId(bucket.getId())
.build();
alarmRepository.save(alarm);
sendEventToUser(receiver.getId());
sendEventToUser(receiver.getId(), alarm);
}

@Scheduled(cron = "0 0 12 * * ?")
Expand Down Expand Up @@ -198,11 +200,11 @@ private boolean shouldSendReminder(Bucket bucket, LocalDate today) {
}

@Async
protected void sendEventToUser(Long userId) {
protected void sendEventToUser(Long userId, Alarm alarm) {
SseEmitter emitter = userEmitters.get(userId);
if (emitter != null) {
try {
emitter.send(SseEmitter.event().name("serverEvent").data("readAlarm"));
emitter.send(SseEmitter.event().name("serverEvent").data(alarmService.convertToAlarmResponseDto(alarm)));
} catch (IOException e) {
emitter.completeWithError(e);
userEmitters.remove(userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,14 @@ public Response readAllAlarm(@AuthenticationPrincipal User user){
return new Response("message", alarmService.readAllAlarm(user));
}

@PostMapping("/send-reminder")
@Operation(summary = "๋ฆฌ๋งˆ์ธ๋” ์•Œ๋žŒ ๋ฐœ์†ก", description = "๋ฆฌ๋งˆ์ธ๋” ์•Œ๋žŒ ์ „์†ก")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "sent")
})
public Response sendReminder(){
alarmHandler.remindBucketAlarm();
return new Response("message", "sent");
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.ggums.ggumtle.dto.response;

import com.ggums.ggumtle.dto.response.model.AlarmListDto;
import com.ggums.ggumtle.entity.AlarmType;
import com.ggums.ggumtle.dto.response.model.AlarmDto;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -10,5 +9,5 @@
@Getter @Setter @Builder
public class AlarmResponseDto {

private Page<AlarmListDto> alarmList;
private Page<AlarmDto> alarmList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Getter
@Setter
@Builder
public class AlarmListDto {
public class AlarmDto {

@Schema(description = "์•Œ๋žŒ id", example = "1")
private Long alarmId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import com.ggums.ggumtle.common.exception.CustomException;
import com.ggums.ggumtle.common.exception.ExceptionType;
import com.ggums.ggumtle.dto.response.AlarmResponseDto;
import com.ggums.ggumtle.dto.response.BucketSearchResponseDto;
import com.ggums.ggumtle.dto.response.model.AlarmListDto;
import com.ggums.ggumtle.dto.response.model.BucketSearchListDto;
import com.ggums.ggumtle.dto.response.model.AlarmDto;
import com.ggums.ggumtle.entity.Alarm;
import com.ggums.ggumtle.entity.User;
import com.ggums.ggumtle.repository.AlarmRepository;
import com.ggums.ggumtle.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand Down Expand Up @@ -50,12 +50,14 @@ public String alarmRead(User user, Long alarmId){

// getting list of alarm
public AlarmResponseDto alarmList(User user, Pageable pageable){
Page<Alarm> alarms = alarmRepository.findByReceiver(user, pageable);
Page<AlarmListDto> alarmList = alarms.map(this::convertToAlarmResponseDto);
Pageable sortedPageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("createdDate").descending());

Page<Alarm> alarms = alarmRepository.findByReceiver(user, sortedPageable);
Page<AlarmDto> alarmList = alarms.map(this::convertToAlarmResponseDto);
return AlarmResponseDto.builder().alarmList(alarmList).build();
}

private AlarmListDto convertToAlarmResponseDto(Alarm alarm){
public AlarmDto convertToAlarmResponseDto(Alarm alarm){

String timeUnit;
long time;
Expand All @@ -79,7 +81,7 @@ private AlarmListDto convertToAlarmResponseDto(Alarm alarm){
time = ChronoUnit.MINUTES.between(alarm.getCreatedDate(), LocalDateTime.now());
}

return AlarmListDto.builder()
return AlarmDto.builder()
.alarmId(alarm.getId())
.sender(alarm.getSender() != null ? alarm.getSender().getUserNickname() : null)
.senderProfileImage(alarm.getSender() != null ? alarm.getSender().getUserProfileImage() : null)
Expand Down
Binary file added exec/3. DB ๋คํ”„ ํŒŒ์ผ.zip
Binary file not shown.
Loading

0 comments on commit b0812c3

Please sign in to comment.