Skip to content

Commit

Permalink
[BE] feat: 아티스트 북마크 구현(#787) (#816)
Browse files Browse the repository at this point in the history
* [BE] feat: 어드민 축제 상세 조회 기능 추가 (#780) (#782)

* feat: 어드민 축제 상세 조회 Repository 추가

* chore: 테스트 코드 sout 제거

* feat: 어드민 축제 상세 조회 API 추가

* [BE] refactor: 어드민 패키지 구조 정리 (#783) (#785)

* refactor: 어드민 패키지 정리

* refactor: Artist 도메인에 Admin 의존 제거

- Application 레이어에 Presentation 레이어 의존 제거

* test: ArtistCommandService 단위 테스트 추가

- 기존 ArtistCommandServiceIntegrationTest 대체

* refactor: ArtistV1Response -> AdminArtistV1Response 이름 변경

- 사용처에 따른 명확한 이름 사용 (추후 Artist 도메인에서 이름이 겹치는 것을 방지)

* [AN/USER] API 변경 사항 반영 (#792) (#795)

* fix: FestivalResponse 수정

* fix: ArtistResponse 수정

* [BE] feat: 컨트롤러의 핸들러 메서드에 어노테이션을 붙여 인증을 수행하는 기능 추가 (#789) (#790)

* [BE] feat: 사용자의 FCM을 등록하는 API 분리 (#579) (#582)

* refactor: AuthController FCM 의존 제거

* feat: 사용자의 FcmToken을 저장하는 API 추가

* refactor: MemberFCMService 로직 리팩터링

- 조회 메서드 `List<String>` 리턴 타입 변경
- 삭제 메서드 `@Async` 제거

* refactor: 메서드 명 명확하게 변경

* test: FCMNotificationEventListenerTest 테스트 수정

- 이벤트 수신 시 메서드 실행되는지 확인하도록 변경

* fix: 머지 충돌 해결

* feat: 회원 삭제 시 FCM 삭제 로직 구현

* fix: 로그인 요청에 FCM 토큰 제거

* refactor: Member 생성, 삭제 이벤트 명 변경, 필드 수정

* [BE] fix: AnnotationDelegateInterceptor에 경로 추가하여 ClassCastException 방지 (#804) (#805)

* fix: AnnotationDelegateInterceptor 경로 추가하여 ClassCastException 방지

* fix: 테스트 컨트롤러에 /api 경로 추가

* [BE] refactor: 레거시 코드 제거 (#796) (#801)

* refactor: AdminController 일부 디버깅 기능 제외하고 제거

* refactor: Festival, School, Stage 레거시 코드 제거

* test: 큐컴버 테스트 새로운 API 사용하도록 변경

* refactor: 일부 개선 대상에 대해 TODO 주석 추가

* refactor: StageQueryInfo, FestivalQueryInfo 사용하지 않는 메서드 삭제

* refactor: 사용하지 않는 에러코드 삭제

* [BE] refactor: 테스트 픽스쳐 개선 (#806) (#807)

refactor: 테스트 픽스쳐 개선

- 형식 통일
- 패키지 분리

* feat: 아티스트 북마크 목록 조회 구현

* feat: 아티스트 북마크 저장 및 삭제 구현

* feat: 아티스트 북마크 컨트롤러 구현

* refactor: artist 존재 여부를 existsById 를 통해서 처리한다

* test: 메모리 repository 에 existsById 추가

* feat: 아티스트가 없을 때 예외를 발생시키도록 변경

* refactor: MemberRepository 가 Repository 를 상속받도록 변경

* test: MemoryMemberRepository 구현 및 테스트 적용

---------

Co-authored-by: Seokjin Jeon <[email protected]>
Co-authored-by: 해시 <[email protected]>
  • Loading branch information
3 people authored Mar 29, 2024
1 parent 95833c4 commit fa60898
Show file tree
Hide file tree
Showing 204 changed files with 2,334 additions and 5,585 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import kotlinx.serialization.Serializable
data class ArtistResponse(
val id: Long,
val name: String,
val imageUrl: String,
val profileImage: String,
) {
fun toDomain() = Artist(
id = id,
name = name,
imageUrl = imageUrl,
imageUrl = profileImage,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class FestivalResponse(
val name: String,
val startDate: String,
val endDate: String,
val imageUrl: String,
val posterImageUrl: String,
val school: SchoolResponse,
val artists: List<ArtistResponse>,
) {
Expand All @@ -21,7 +21,7 @@ data class FestivalResponse(
name = name,
startDate = LocalDate.parse(startDate),
endDate = LocalDate.parse(endDate),
imageUrl = imageUrl,
imageUrl = posterImageUrl,
school = school.toDomain(),
artists = artists.map { it.toDomain() },
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
package com.festago.artist.application;
package com.festago.admin.application;

import com.festago.admin.dto.ArtistV1Response;
import com.festago.admin.dto.artist.AdminArtistV1Response;
import com.festago.artist.domain.Artist;
import com.festago.artist.repository.ArtistRepository;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

// TODO 페이징 적용
@Service
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class ArtistV1QueryService {
public class AdminArtistV1QueryService {

private final ArtistRepository artistRepository;

public ArtistV1Response findById(Long artistId) {
public AdminArtistV1Response findById(Long artistId) {
Artist artist = artistRepository.getOrThrow(artistId);
return ArtistV1Response.from(artist);
return AdminArtistV1Response.from(artist);
}

public List<ArtistV1Response> findAll() {
public List<AdminArtistV1Response> findAll() {
return artistRepository.findAll().stream()
.map(ArtistV1Response::from)
.map(AdminArtistV1Response::from)
.toList();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.festago.admin.application;

import com.festago.admin.dto.AdminFestivalV1Response;
import com.festago.admin.dto.festival.AdminFestivalDetailV1Response;
import com.festago.admin.dto.festival.AdminFestivalV1Response;
import com.festago.admin.repository.AdminFestivalDetailV1QueryDslRepository;
import com.festago.admin.repository.AdminFestivalV1QueryDslRepository;
import com.festago.common.exception.ErrorCode;
import com.festago.common.exception.NotFoundException;
import com.festago.common.querydsl.SearchCondition;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
Expand All @@ -14,8 +18,14 @@
public class AdminFestivalV1QueryService {

private final AdminFestivalV1QueryDslRepository adminFestivalV1QueryDslRepository;
private final AdminFestivalDetailV1QueryDslRepository adminFestivalDetailV1QueryDslRepository;

public Page<AdminFestivalV1Response> findAll(SearchCondition searchCondition) {
return adminFestivalV1QueryDslRepository.findAll(searchCondition);
}

public AdminFestivalDetailV1Response findDetail(Long festivalId) {
return adminFestivalDetailV1QueryDslRepository.findDetail(festivalId)
.orElseThrow(() -> new NotFoundException(ErrorCode.FESTIVAL_NOT_FOUND));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.festago.admin.application;

import com.festago.admin.dto.AdminSchoolV1Response;
import com.festago.admin.dto.school.AdminSchoolV1Response;
import com.festago.admin.repository.AdminSchoolV1QueryDslRepository;
import com.festago.common.exception.ErrorCode;
import com.festago.common.exception.NotFoundException;
Expand Down

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions backend/src/main/java/com/festago/admin/dto/ArtistV1Response.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.festago.admin.dto.artist;

import com.festago.artist.domain.Artist;

public record AdminArtistV1Response(
Long id,
String name,
String profileImage
) {

public static AdminArtistV1Response from(Artist artist) {
return new AdminArtistV1Response(artist.getId(), artist.getName(), artist.getProfileImage());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.festago.admin.dto.artist;

import com.festago.artist.dto.command.ArtistCreateCommand;
import jakarta.validation.constraints.NotBlank;

public record ArtistV1CreateRequest(
@NotBlank
String name,
@NotBlank
String profileImageUrl,
@NotBlank
String backgroundImageUrl
) {

public ArtistCreateCommand toCommand() {
return new ArtistCreateCommand(
name,
profileImageUrl,
backgroundImageUrl
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.festago.admin.dto.artist;

import com.festago.artist.dto.command.ArtistUpdateCommand;
import jakarta.validation.constraints.NotBlank;

public record ArtistV1UpdateRequest(
@NotBlank
String name,
@NotBlank
String profileImageUrl,
@NotBlank
String backgroundImageUrl
) {

public ArtistUpdateCommand toCommand() {
return new ArtistUpdateCommand(
name,
profileImageUrl,
backgroundImageUrl
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.festago.admin.dto.festival;

import com.querydsl.core.annotations.QueryProjection;
import java.time.LocalDate;
import java.time.LocalDateTime;

public record AdminFestivalDetailV1Response(
Long id,
String name,
Long schoolId,
String schoolName,
LocalDate startDate,
LocalDate endDate,
String posterImageUrl,
LocalDateTime createdAt,
LocalDateTime updatedAt
) {

@QueryProjection
public AdminFestivalDetailV1Response {
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.festago.admin.dto;
package com.festago.admin.dto.festival;

import com.querydsl.core.annotations.QueryProjection;
import java.time.LocalDate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.festago.admin.dto;
package com.festago.admin.dto.festival;

import com.festago.festival.dto.command.FestivalCreateCommand;
import jakarta.annotation.Nullable;
Expand All @@ -8,21 +8,21 @@
import org.springframework.format.annotation.DateTimeFormat;

public record FestivalV1CreateRequest(
@NotBlank(message = "name은 공백일 수 없습니다.")
@NotBlank
String name,

@NotNull(message = "startDate는 null 일 수 없습니다.")
@NotNull
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
LocalDate startDate,

@NotNull(message = "endDate는 null 일 수 없습니다.")
@NotNull
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
LocalDate endDate,

@Nullable
String posterImageUrl,

@NotNull(message = "schoolId는 null 일 수 없습니다.")
@NotNull
Long schoolId
) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.festago.admin.dto;
package com.festago.admin.dto.festival;

import com.festago.festival.dto.command.FestivalUpdateCommand;
import jakarta.annotation.Nullable;
Expand All @@ -8,14 +8,14 @@
import org.springframework.format.annotation.DateTimeFormat;

public record FestivalV1UpdateRequest(
@NotBlank(message = "name은 공백일 수 없습니다.")
@NotBlank
String name,

@NotNull(message = "startDate는 null 일 수 없습니다.")
@NotNull
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
LocalDate startDate,

@NotNull(message = "endDate는 null 일 수 없습니다.")
@NotNull
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
LocalDate endDate,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.festago.admin.dto;
package com.festago.admin.dto.school;

import com.festago.school.domain.SchoolRegion;
import com.querydsl.core.annotations.QueryProjection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.festago.admin.presentation.v1.dto;
package com.festago.admin.dto.school;

import com.festago.school.domain.SchoolRegion;
import com.festago.school.dto.SchoolCreateCommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.festago.admin.presentation.v1.dto;
package com.festago.admin.dto.school;

import com.festago.school.domain.SchoolRegion;
import com.festago.school.dto.SchoolUpdateCommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.festago.admin.presentation.v1.dto;
package com.festago.admin.dto.stage;

import com.festago.stage.dto.command.StageCreateCommand;
import jakarta.validation.constraints.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.festago.admin.presentation.v1.dto;
package com.festago.admin.dto.stage;

import com.festago.stage.dto.command.StageUpdateCommand;
import jakarta.validation.constraints.NotNull;
Expand Down
Loading

0 comments on commit fa60898

Please sign in to comment.