Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
bce7dbc
feat : 닉네임 중복 체크 (nickname unique), 인증코드 검사 예외처리 추가
yyytir777 Dec 8, 2025
3573613
fix : user_id IDENTITY strategy & dev redis host 이름변경 (localhost -> r…
yyytir777 Dec 8, 2025
08cfb63
test코드 생성 & swagger url 삭제 & 환경변수 중복 삭제
yyytir777 Dec 8, 2025
ac96fa0
fix : 엔드포인트 추가
yyytir777 Dec 9, 2025
43e75ed
Merge pull request #27 from tinybite-2025/feature/13-user
yyytir777 Dec 9, 2025
a70941b
Feature/26 notification (#29)
marshmallowing Dec 11, 2025
cbbf597
feat : google login 구현 완료
yyytir777 Dec 11, 2025
d03fd30
fix : main push 시에만 workflow trigger
yyytir777 Dec 11, 2025
00cc289
Merge branch 'main' of https://github.com/tinybite-2025/tinybite-serv…
yyytir777 Dec 11, 2025
729ae0a
Feature/#28 google apple login
yyytir777 Dec 16, 2025
b5c29db
Merge branch 'main' into develop
yyytir777 Dec 16, 2025
2e5da55
Merge branch 'develop' of https://github.com/tinybite-2025/tinybite-s…
yyytir777 Dec 18, 2025
1fbd896
merge main into develop : main의 핫픽스 변경사항 develop에 반영
yyytir777 Dec 18, 2025
dd9771a
workflow 줄바꿈 에러 수정
yyytir777 Dec 18, 2025
38de611
hotifx : 에러 핸들링 수정 및 무중단 배포 삭제 (리소스 너무 많이 먹음)
yyytir777 Dec 19, 2025
91b8cba
main의 핫픽스 develop에 반영
yyytir777 Dec 22, 2025
fbc5e90
수정사항 반영 (API 인증 관련, db schema, 예외 처리 등..)
yyytir777 Dec 23, 2025
7b9fb7b
main브랜치 핫픽스 반영
yyytir777 Dec 24, 2025
bbb080f
Feature/35 term (#38)
yyytir777 Dec 24, 2025
4c352aa
fix : docker compose 명령어 수정
yyytir777 Dec 24, 2025
27dfcbb
Feature : 파티 기능 (#42)
milowon Dec 27, 2025
0de3a43
Merge branch 'main' into develop
milowon Dec 31, 2025
2f27dee
hotfix : url parser 경로 제거
milowon Dec 31, 2025
6eb0d8d
Merge branch 'main' of https://github.com/tinybite-2025/tinybite-serv…
milowon Jan 1, 2026
3f69bc1
Merge branch 'main' of https://github.com/tinybite-2025/tinybite-serv…
milowon Jan 2, 2026
45191a9
hotfix : 파티 거리 계산 로직 임시 주석 처리
milowon Jan 2, 2026
3a9a6e6
Merge branch 'main' of https://github.com/tinybite-2025/tinybite-serv…
milowon Jan 2, 2026
b2ca1f4
hotfix : 파티 수정, 삭제 controller 추가
milowon Jan 2, 2026
38ab16c
hotfix : 선택 값들이 존재할때만 넣도록 수정
milowon Jan 2, 2026
037d2e4
hotfix : 위도, 경도 로직 삭제
milowon Jan 2, 2026
9d305f8
Feat : 마이페이지 참여중인 파티 조회 (#50)
milowon Jan 2, 2026
1cee657
hotfix : user service에 transactional 어노테이션 추가
milowon Jan 2, 2026
5213214
Merge branch 'main' of https://github.com/tinybite-2025/tinybite-serv…
milowon Jan 2, 2026
ed3a399
hotfix : 참여중 파티 조회 반환 형식 통일
milowon Jan 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package ita.tinybite.domain.party.dto.response;
import ita.tinybite.domain.party.entity.Party;
import ita.tinybite.domain.party.enums.ParticipantStatus;
import ita.tinybite.domain.party.enums.PartyCategory;
import ita.tinybite.domain.party.enums.PartyStatus;
import lombok.*;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Getter
@NoArgsConstructor
Expand All @@ -20,4 +25,88 @@ public class PartyCardResponse {
private Boolean isClosed; // 마감 여부
private PartyCategory category;
private LocalDateTime createdAt;

public static PartyCardResponse from(Party party, int currentParticipants, boolean isHost, ParticipantStatus status) {
return PartyCardResponse.builder()
.partyId(party.getId())
.thumbnailImage(party.getThumbnailImage())
.title(party.getTitle())
.pricePerPerson(calculatePricePerPerson(party, currentParticipants))
.participantStatus(formatParticipantStatus(currentParticipants, party.getMaxParticipants()))
.distance(null) // 거리 계산은 별도 처리 필요
.distanceKm(null) // 거리 계산은 별도 처리 필요
.timeAgo(calculateTimeAgo(party.getCreatedAt()))
.isClosed(checkIfClosed(party, currentParticipants))
.category(party.getCategory())
.createdAt(party.getCreatedAt())
.build();
}
private static String getThumbnailImage(Party party) {
if (party.getImage() != null && !party.getImage().isEmpty()) {
return party.getImage();
}
return "/images/default-party-thumbnail.jpg"; // 기본 이미지
}

/**
* 1/N 가격 계산
*/
private static Integer calculatePricePerPerson(Party party, int currentParticipants) {
if (party.getPrice() == null || currentParticipants == 0) {
return null;
}
return party.getPrice() / currentParticipants;
}

/**
* 참가자 상태 포맷팅 "1/4명"
*/
private static String formatParticipantStatus(int current, int max) {
return String.format("%d/%d명", current, max);
}

/**
* 시간 경과 계산 "10분 전", "3시간 전"
*/
private static String calculateTimeAgo(LocalDateTime createdAt) {
if (createdAt == null) {
return "";
}

LocalDateTime now = LocalDateTime.now();
Duration duration = Duration.between(createdAt, now);

long minutes = duration.toMinutes();
long hours = duration.toHours();
long days = duration.toDays();

if (minutes < 1) {
return "방금 전";
} else if (minutes < 60) {
return minutes + "분 전";
} else if (hours < 24) {
return hours + "시간 전";
} else if (days < 7) {
return days + "일 전";
} else {
return createdAt.format(DateTimeFormatter.ofPattern("MM.dd"));
}
}

/**
* 마감 여부 확인
*/
private static Boolean checkIfClosed(Party party, int currentParticipants) {
// 1. 파티 상태가 CLOSED인 경우
if (party.getStatus() == PartyStatus.CLOSED) {
return true;
}

// 2. 정원이 다 찬 경우
if (currentParticipants >= party.getMaxParticipants()) {
return true;
}

return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import ita.tinybite.domain.auth.dto.response.UserDto;
import ita.tinybite.domain.party.dto.response.PartyCardResponse;
import ita.tinybite.domain.user.dto.req.UpdateUserReqDto;
import ita.tinybite.domain.user.dto.res.PartyResponse;
import ita.tinybite.domain.user.dto.res.UserResDto;
import ita.tinybite.domain.user.service.UserService;
import ita.tinybite.global.response.APIResponse;
Expand Down Expand Up @@ -82,13 +81,13 @@ public APIResponse<?> deleteUser() {
@Operation(summary = "활성 파티 목록 조회", description = "사용자가 참여 중인 활성 파티 목록을 조회합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공",
content = @Content(array = @ArraySchema(schema = @Schema(implementation = PartyResponse.class)))),
content = @Content(array = @ArraySchema(schema = @Schema(implementation = PartyCardResponse.class)))),
@ApiResponse(responseCode = "401", description = "인증 실패")
})
@GetMapping("/parties/active")
public ResponseEntity<List<PartyResponse>> getActiveParties(
public ResponseEntity<List<PartyCardResponse>> getActiveParties(
@AuthenticationPrincipal Long userId) {
List<PartyResponse> response = userService.getActiveParties(userId);
List<PartyCardResponse> response = userService.getActiveParties(userId);
return ResponseEntity.ok(response);
}

Expand Down
45 changes: 0 additions & 45 deletions src/main/java/ita/tinybite/domain/user/dto/res/PartyResponse.java

This file was deleted.

12 changes: 8 additions & 4 deletions src/main/java/ita/tinybite/domain/user/service/UserService.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
package ita.tinybite.domain.user.service;

import ita.tinybite.domain.auth.service.SecurityProvider;
import ita.tinybite.domain.party.dto.response.PartyCardResponse;
import ita.tinybite.domain.party.entity.Party;
import ita.tinybite.domain.party.entity.PartyParticipant;
import ita.tinybite.domain.party.enums.ParticipantStatus;
import ita.tinybite.domain.party.enums.PartyStatus;
import ita.tinybite.domain.party.repository.PartyParticipantRepository;
import ita.tinybite.domain.user.constant.UserStatus;
import ita.tinybite.domain.user.dto.req.UpdateUserReqDto;
import ita.tinybite.domain.user.dto.res.PartyResponse;
import ita.tinybite.domain.user.dto.res.UserResDto;
import ita.tinybite.domain.user.entity.User;
import ita.tinybite.domain.user.repository.UserRepository;
import ita.tinybite.global.exception.BusinessException;
import ita.tinybite.global.exception.errorcode.AuthErrorCode;
import ita.tinybite.global.location.LocationService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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

@Service
@Transactional(readOnly = true)
public class UserService {

private final SecurityProvider securityProvider;
Expand All @@ -43,17 +44,20 @@ public UserResDto getUser() {
return UserResDto.of(user);
}

@Transactional
public void updateUser(UpdateUserReqDto req) {
User user = securityProvider.getCurrentUser();
user.update(req);
}

@Transactional
public void updateLocation(String latitude, String longitude) {
User user = securityProvider.getCurrentUser();
String location = locationService.getLocation(latitude, longitude);
user.updateLocation(location);
}

@Transactional
public void deleteUser() {
userRepository.delete(securityProvider.getCurrentUser());
}
Expand All @@ -63,7 +67,7 @@ public void validateNickname(String nickname) {
throw BusinessException.of(AuthErrorCode.DUPLICATED_NICKNAME);
}

public List<PartyResponse> getActiveParties(Long userId) {
public List<PartyCardResponse> getActiveParties(Long userId) {
List<PartyParticipant> participants = participantRepository
.findActivePartiesByUserId(
userId,
Expand All @@ -77,7 +81,7 @@ public List<PartyResponse> getActiveParties(Long userId) {
int currentParticipants = participantRepository
.countByPartyIdAndStatus(party.getId(), ParticipantStatus.APPROVED);
boolean isHost = party.getHost().getUserId().equals(userId);
return PartyResponse.from(party, currentParticipants, isHost,pp.getStatus());
return PartyCardResponse.from(party, currentParticipants, isHost,pp.getStatus());
})
.collect(Collectors.toList());
}
Expand Down