Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
char-yb committed Nov 2, 2023
2 parents b25e754 + 683e3fe commit b14d589
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 20 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

<img src = "https://github.com/seniors-project/backend/assets/117654450/72756334-6370-46d6-9f29-f94d0a63b0f6" height = "200" width = "700" allign = "center">


<p align="center"><img src = "https://github.com/seniors-project/backend/assets/117654450/72756334-6370-46d6-9f29-f94d0a63b0f6" height = "200" width = "700"></p>

</br>

Expand All @@ -18,7 +16,8 @@

# 🕹 Skills

![image](https://github.com/seniors-project/backend/assets/117654450/b8872d42-b24a-4dbc-906c-60ab91557196)
![image](https://github.com/seniors-project/backend/assets/117654450/119cf4fa-2b71-4109-8004-c396fe4f2a49)



</br>
Expand All @@ -38,7 +37,8 @@
</br>

# 📊 ERD
![image](https://github.com/seniors-project/backend/assets/117654450/fe06df83-c2f5-450c-9550-1d148508dc19)
![image](https://github.com/seniors-project/backend/assets/117654450/590cc5c9-ec2a-429a-a85a-557fded3f41a)


</br>

Expand Down
16 changes: 16 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# After the build test, the time has been reduced by approximately 4 to 5 seconds at the current time.

# Use build cache
org.gradle.caching=true

# Set the build daemon to run
org.gradle.daemon=true

# Compile only the necessary parts (on demand) in multi-project mode
org.gradle.configureondemand=true

# Parallel thread operation (comment for now as there are not many subprojects)
# org.gradle.parallel=true

# Passing jvm parameters when compiling
org.gradle.jvmargs=-Xmx5120M
5 changes: 5 additions & 0 deletions src/main/java/com/seniors/domain/comment/entity/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SQLDelete(sql = "UPDATE Comment SET isDeleted = true WHERE id = ?")
@Where(clause = "isDeleted = false")
@Table(name = "Comment", indexes = {
@Index(name = "idx_userId", columnList = "userId"),
@Index(name = "idx_postId", columnList = "postId"),
@Index(name = "idx_postId_userId", columnList = "postId, userId")
})
public class Comment extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@Table(name = "Notification", indexes = {
@Index(name = "idx_userId", columnList = "userId"),
@Index(name = "idx_notificationId_userId", columnList = "id, userId"),
})
public class Notification extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,17 @@ public void sendToClient(SseEmitter emitter, String id, Object data) {
public CustomSlice<NotificationDto> findNotificationList(CustomUserDetails userDetails, int size, Long lastId) {
Sort.Direction direction = Sort.Direction.DESC;
Pageable pageable = PageRequest.of(0, size, Sort.by(direction, "id"));
Users users = usersRepository.findById(userDetails.getUserId()).orElseThrow(
() -> new NotAuthorizedException("유효하지 않은 회원입니다.")
);
Slice<NotificationDto> results = notificationRepository.findNotificationList(users.getId(), pageable, lastId);
Slice<NotificationDto> results = notificationRepository.findNotificationList(userDetails.getUserId(), pageable, lastId);
return CustomSlice.from(results);
}

@Transactional
public Notification readNotification(CustomUserDetails userDetails, Long id) {
Users users = usersRepository.findById(userDetails.getUserId()).orElseThrow(
() -> new NotAuthorizedException("유효하지 않은 회원입니다.")
);

Notification notification = notificationRepository.findById(id)
.orElseThrow(() -> new NotFoundException("존재하지 않는 알림입니다."));

if (!users.getId().equals(notification.getUsers().getId())) {
if (!userDetails.getUserId().equals(notification.getUsers().getId())) {
throw new NotAuthorizedException("읽기 권한이 없습니다.");
}
notification.read();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/seniors/domain/post/entity/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Where(clause = "isDeleted = false")
@SQLDelete(sql = "UPDATE Post SET isDeleted = true WHERE id = ?")
@Table(name = "Post", indexes = {
@Index(name = "idx_userId", columnList = "userId"),
@Index(name = "idx_postId_userId", columnList = "id, userId")
})
public class Post extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import com.seniors.common.repository.BasicRepoSupport;
import com.seniors.domain.comment.entity.QComment;
import com.seniors.domain.post.dto.PostDto.GetPostRes;
import com.seniors.domain.post.entity.Post;
import com.seniors.domain.post.entity.QPost;
import com.seniors.domain.post.entity.QPostMedia;
import com.seniors.domain.post.dto.PostDto.ModifyPostReq;
import com.seniors.domain.post.entity.*;
import com.seniors.domain.users.entity.QUsers;
import jakarta.persistence.EntityManager;
Expand All @@ -20,7 +16,6 @@
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.stream.Collectors;


@Slf4j
Expand Down Expand Up @@ -149,5 +144,4 @@ public void increaseLikeCount(Long postId, Boolean status) {
.where(post.id.eq(postId))
.execute();
}
}

}
3 changes: 3 additions & 0 deletions src/main/java/com/seniors/domain/users/entity/Users.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
@Getter
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "Users", indexes = {
@Index(name = "idx_userId_snsId", columnList = "id, snsId")
})
public class Users extends BaseTimeEntity {

@Id
Expand Down

0 comments on commit b14d589

Please sign in to comment.