Skip to content

Commit

Permalink
v2.0.5 (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
char-yb authored Dec 5, 2024
2 parents 6fda9ae + 5747f90 commit dd73b4b
Show file tree
Hide file tree
Showing 48 changed files with 600 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @kdomo @uwoobeat @uiurihappy
* @kdomo @uwoobeat @char-yb
2 changes: 1 addition & 1 deletion .github/workflows/develop_build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

# test 돌릴때 레디스 필요
- name: Start containers
run: docker-compose -f ./docker-compose-test.yaml up -d
run: docker compose -f ./docker-compose-test.yaml up -d

# Gradlew 실행 허용
- name: Run chmod to make gradlew executable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/develop_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
distribution: 'adopt'

- name: Start containers # test 돌릴때 레디스 필요
run: docker-compose -f ./docker-compose-test.yaml up -d
run: docker compose -f ./docker-compose-test.yaml up -d

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production_build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

# test 돌릴때 레디스 필요
- name: Start containers
run: docker-compose -f ./docker-compose-test.yaml up -d
run: docker compose -f ./docker-compose-test.yaml up -d

# Gradlew 실행 허용
- name: Run chmod to make gradlew executable
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
## 📝 직접 사용해보기
- [iOS](https://apps.apple.com/kr/app/10%EB%B6%84%EB%A7%8C-10mm-10%EB%B6%84%EC%9C%BC%EB%A1%9C-%EC%8B%9C%EC%9E%91%ED%95%98%EB%8A%94-%EC%8A%B5%EA%B4%80-%ED%98%95%EC%84%B1/id6475635740)
- [AOS](https://play.google.com/store/apps/details?id=com.tenminuteapp)
- [WEB](https://10mm.today/)
- [WEB](https://10mm.site/)
</br></br>

# 🖥️ Tech
Expand Down Expand Up @@ -77,4 +77,4 @@
## 🧑🏻‍💻 Developers
| ![](https://avatars.githubusercontent.com/u/64088250?v=4) | ![](https://avatars.githubusercontent.com/u/91878695?v=4) |![](https://avatars.githubusercontent.com/u/68099546?v=4) |
| :--: | :--: | :--: |
| [김동호](https://github.com/kdomo) | [안재현](https://github.com/uwoobeat) | [차윤범](https://github.com/uiurihappy) |
| [김동호](https://github.com/kdomo) | [안재현](https://github.com/uwoobeat) | [차윤범](https://github.com/char-yb) |
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ spotless {

// pre-commit spotless check script
tasks.register('updateGitHooks', Copy) {
from './scripts/pre-commit'
into './.git/hooks'
from 'scripts/pre-commit'
into '.git/hooks'
}
compileJava.dependsOn updateGitHooks
2 changes: 1 addition & 1 deletion nginx/default.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server {
listen 80;
server_name 10mm.today;
server_name 10mm.site;

location / {
proxy_pass http://localhost:8080/;
Expand Down
23 changes: 13 additions & 10 deletions scripts/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash
echo "Running spotless check"
./gradlew spotlessCheck
if [ \$? -eq 0 ]
then
echo "Spotless check succeed"
else
echo "Spotless check failed" >&2
exit 1
fi
#!/bin/sh

targetFiles=$(git diff --staged --name-only)

echo "Apply Spotless.."
./gradlew spotlessApply

# Add files to stage spotless applied
for file in $targetFiles; do
if test -f "$file"; then
git add $file
fi
done
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@Tag(name = "8. [댓글]", description = "댓글 관련 API")
@Tag(name = "9. [댓글]", description = "댓글 관련 API")
@RestController
@RequestMapping("/comments")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public record FeedOneByProfileResponse(
@Schema(description = "미션 이름", defaultValue = "default name") String name,
@Schema(
description = "미션 기록 인증 사진 Url",
defaultValue = "https://image.10mm.today/default.png")
defaultValue = "https://image.10mm.site/default.png")
String recordImageUrl,
@Schema(description = "미션 수행한 시간", defaultValue = "21") long duration,
@Schema(description = "미션 시작한 지 N일차", defaultValue = "3") long sinceDay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
public record FeedOneResponse(
@Schema(description = "작성자 ID", defaultValue = "1") Long memberId,
@Schema(description = "작성자 닉네임", defaultValue = "default name") String nickname,
@Schema(description = "작성자 프로필 이미지", defaultValue = "https://image.10mm.today/default.png")
@Schema(description = "작성자 프로필 이미지", defaultValue = "https://image.10mm.site/default.png")
String profileImage,
@Schema(description = "미션 ID", defaultValue = "1") Long missionId,
@Schema(description = "미션 이름", defaultValue = "default name") String name,
@Schema(description = "미션 기록 ID", defaultValue = "1") Long recordId,
@Schema(description = "미션 일지 내용", defaultValue = "default remark") String remark,
@Schema(
description = "미션 기록 인증 사진 Url",
defaultValue = "https://image.10mm.today/default.png")
defaultValue = "https://image.10mm.site/default.png")
String recordImageUrl,
@Schema(description = "미션 수행 시간 (분 단위)", defaultValue = "21") long duration,
@Schema(description = "미션 시작한 지 N일차", defaultValue = "3") long sinceDay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public void createFollow(FollowCreateRequest request) {
String.format(PUSH_SERVICE_CONTENT, currentMember.getProfile().getNickname()));
Notification notification =
Notification.createNotification(
NotificationType.FOLLOW, currentMember, targetMember);
NotificationType.FOLLOW,
currentMember,
targetMember,
currentMember.getId());
notificationRepository.save(notification);
memberRelationRepository.save(memberRelation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.depromeet.domain.image.domain.ImageFileExtension;
import com.depromeet.domain.member.dao.MemberRepository;
import com.depromeet.domain.member.domain.Member;
import com.depromeet.domain.member.domain.MemberStatus;
import com.depromeet.domain.member.domain.Profile;
import com.depromeet.domain.member.dto.request.NicknameCheckRequest;
import com.depromeet.domain.member.dto.request.NicknameUpdateRequest;
Expand Down Expand Up @@ -208,4 +209,9 @@ private String escapeSpecialCharacters(String nickname) {
// 여기서 특수문자를 '_'로 대체할 수 있도록 정규표현식을 활용하여 구현
return nickname == null ? "" : nickname.replaceAll("[^0-9a-zA-Z가-힣 ]", "_");
}

@Transactional(readOnly = true)
public List<Member> findAllNormalMember() {
return memberRepository.findAllByStatusIs(MemberStatus.NORMAL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ public interface MemberRepository extends JpaRepository<Member, Long>, MemberRep
"SELECT m FROM Member m WHERE m.profile.nickname LIKE CONCAT('%', :searchNickname, '%') escape '_' AND m.profile.nickname != :myNickname")
List<Member> nicknameSearch(
@Param("searchNickname") String searchNickname, @Param("myNickname") String myNickname);

List<Member> findAllByStatusIs(MemberStatus status);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public interface MissionRepositoryCustom {

List<Mission> findAllFinishedMission(Long memberId);

List<Mission> findAllMissionWithRecords();

List<Mission> findMissionsWithRecordsByDate(LocalDate date, Long memberId);

List<Mission> findMissionsNonCompleteAndInProgress(LocalDateTime today);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ public List<Mission> findMissionsWithRecords(Long memberId) {
return query.fetch();
}

@Override
public List<Mission> findAllMissionWithRecords() {
JPAQuery<Mission> query =
jpaQueryFactory
.selectFrom(mission)
.leftJoin(mission.missionRecords, missionRecord)
.fetchJoin();
return query.fetch();
}

@Override
public List<Mission> findInProgressMissionsWithRecords(Long memberId) {
JPAQuery<Mission> query =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.depromeet.domain.comment.domain.Comment;
import com.depromeet.domain.common.model.BaseTimeEntity;
import com.depromeet.domain.member.domain.Member;
import com.depromeet.domain.mission.domain.Mission;
import com.depromeet.domain.reaction.domain.Reaction;
import com.depromeet.global.error.exception.CustomException;
Expand Down Expand Up @@ -99,4 +100,8 @@ public void updateUploadStatusComplete(String remark, String imageUrl) {
public void updateMissionRecord(String remark) {
this.remark = remark;
}

public Member getMember() {
return mission.getMember();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public record MissionRecordFindOneResponse(
String remark,
@Schema(
description = "미션 기록 인증 사진 Url",
defaultValue = "https://image.10mm.today/default.png")
defaultValue = "https://image.10mm.site/default.png")
String imageUrl,
@Schema(description = "미션 수행한 시간", defaultValue = "21") long duration,
@Schema(description = "미션 시작한 지 N일차", defaultValue = "3") long sinceDay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public record MissionRecordFindResponse(
String remark,
@Schema(
description = "미션 기록 인증 사진 Url",
defaultValue = "https://image.10mm.today/default.png")
defaultValue = "https://image.10mm.site/default.png")
String imageUrl,
@Schema(description = "미션 시작 일자", defaultValue = "3") int missionDay,
@JsonFormat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ public void sendUrgingPush(PushUrgingSendRequest request) {
mission.getName()));
Notification notification =
Notification.createNotification(
NotificationType.MISSION_URGING, currentMember, targetMember);
NotificationType.MISSION_URGING,
currentMember,
targetMember,
mission.getId());
notificationRepository.save(notification);
}

Expand All @@ -79,7 +82,13 @@ public List<NotificationFindAllResponse> findAllNotification() {
.map(
notification ->
NotificationFindAllResponse.of(
notification.getId(),
notification.getNotificationType(),
notification.getResourceId(),
getNotificationMessage(
notification.getNotificationType(),
notification.getSourceMember(),
notification.getTargetMember()),
notification.getCreatedAt()))
.collect(Collectors.toList());
}
Expand All @@ -101,4 +110,19 @@ private void validateSelfSending(Long currentMemberId, Long targetMemberId) {
throw new CustomException(ErrorCode.SELF_SENDING_NOT_ALLOWED);
}
}

private String getNotificationMessage(
NotificationType notificationType, Member sourceMember, Member targetMember) {
switch (notificationType) {
case FOLLOW:
return String.format(PUSH_SERVICE_CONTENT, sourceMember.getProfile().getNickname());
case MISSION_URGING:
return String.format(
PUSH_URGING_CONTENT,
sourceMember.getProfile().getNickname(),
targetMember.getProfile().getNickname());
default:
throw new CustomException(ErrorCode.NOTIFICATION_TYPE_NOT_FOUND);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,30 @@ public class Notification extends BaseTimeEntity {
@JoinColumn(name = "target_id")
private Member targetMember;

private Long resourceId;

@Builder(access = AccessLevel.PRIVATE)
private Notification(
NotificationType notificationType, Member sourceMember, Member targetMember) {
NotificationType notificationType,
Member sourceMember,
Member targetMember,
Long resourceId) {
this.notificationType = notificationType;
this.sourceMember = sourceMember;
this.targetMember = targetMember;
this.resourceId = resourceId;
}

public static Notification createNotification(
NotificationType notificationType, Member currentMember, Member targetMember) {
NotificationType notificationType,
Member currentMember,
Member targetMember,
Long resourceId) {
return Notification.builder()
.notificationType(notificationType)
.sourceMember(currentMember)
.targetMember(targetMember)
.resourceId(resourceId)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@
import java.time.LocalDateTime;

public record NotificationFindAllResponse(
@Schema(description = "알림 ID") Long notificationId,
@Schema(description = "알림 타입") NotificationType notificationType,
@Schema(description = "자원 ID") Long resourceId,
@Schema(description = "알림 메시지") String message,
@Schema(description = "알림 날짜") LocalDateTime createdAt) {

public static NotificationFindAllResponse of(
NotificationType notificationType, LocalDateTime createdAt) {
return new NotificationFindAllResponse(notificationType, createdAt);
Long notificationId,
NotificationType notificationType,
Long resourceId,
String message,
LocalDateTime createdAt) {
return new NotificationFindAllResponse(
notificationId, notificationType, resourceId, message, createdAt);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.depromeet.domain.ranking.api;

import com.depromeet.domain.ranking.application.RankingService;
import com.depromeet.domain.ranking.dto.response.RankingResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "10. [랭킹]", description = "랭킹 관련 API")
@RestController
@RequestMapping("/ranking")
@RequiredArgsConstructor
public class RankingController {

private final RankingService rankingService;

@Operation(summary = "랭킹 조회", description = "랭킹을 조회합니다.")
@GetMapping
public List<RankingResponse> rankingFindAll() {
return rankingService.findAllRanking();
}
}
Loading

0 comments on commit dd73b4b

Please sign in to comment.