Skip to content

Commit a4b7a13

Browse files
Merge pull request #135 from prgrms-web-devcourse-final-project/develop
chore: develop → main 브랜치 머지
2 parents 892b6c9 + 7a783ca commit a4b7a13

File tree

48 files changed

+949
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+949
-145
lines changed

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ dependencies {
8484

8585

8686
// 배포 관련 의존성
87-
// runtimeOnly 'org.postgresql:postgresql'
88-
// implementation 'org.springframework.boot:spring-boot-devtools'
87+
// runtimeOnly 'org.postgresql:postgresql'
88+
implementation 'org.springframework.boot:spring-boot-devtools'
8989

90-
// implementation 'com.google.cloud:spring-cloud-gcp-starter-secretmanager:4.9.1'
91-
// implementation 'com.google.cloud:google-cloud-storage:2.38.0'
90+
implementation 'com.google.cloud:spring-cloud-gcp-starter-secretmanager:4.9.1'
91+
implementation 'com.google.cloud:google-cloud-storage:2.38.0'
9292
}
9393

9494
tasks.named('test') {
@@ -101,7 +101,7 @@ dependencyManagement {
101101
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
102102

103103
// GCP 관련 스타터(BOM) 관리 - Secret Manager, GCS 등
104-
// mavenBom "com.google.cloud:spring-cloud-gcp-dependencies:${springCloudGcpVersion}"
104+
mavenBom "com.google.cloud:spring-cloud-gcp-dependencies:${springCloudGcpVersion}"
105105
}
106106
}
107107

src/main/java/grep/neogul_coder/domain/calender/controller/PersonalCalendarController.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,22 @@ public ApiResponse<List<PersonalCalendarResponse>> findByDate(
4444
return ApiResponse.success(personalCalendarService.findByDate(userId, parsedDate));
4545
}
4646

47-
@PutMapping("/{calendarId}")
47+
@PutMapping("/{personalCalendarId}")
4848
public ApiResponse<Void> update(
4949
@PathVariable("userId") Long userId,
50-
@PathVariable("calendarId") Long calendarId,
50+
@PathVariable("personalCalendarId") Long personalCalendarId,
5151
@Valid @RequestBody PersonalCalendarRequest request
5252
) {
53-
personalCalendarService.update(userId, calendarId, request);
53+
personalCalendarService.update(userId, personalCalendarId, request);
5454
return ApiResponse.noContent();
5555
}
5656

57-
@DeleteMapping("/{calendarId}")
57+
@DeleteMapping("/{personalCalendarId}")
5858
public ApiResponse<Void> delete(
5959
@PathVariable("userId") Long userId,
60-
@PathVariable("calendarId") Long calendarId
60+
@PathVariable("personalCalendarId") Long personalCalendarId
6161
) {
62-
personalCalendarService.delete(userId, calendarId);
62+
personalCalendarService.delete(userId, personalCalendarId);
6363
return ApiResponse.noContent();
6464
}
6565
}

src/main/java/grep/neogul_coder/domain/calender/controller/PersonalCalendarSpecification.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,27 @@ ApiResponse<List<PersonalCalendarResponse>> findByDate(
5151

5252
@Operation(
5353
summary = "개인 일정 수정",
54-
description = "사용자의 특정 일정을 수정합니다.\n\n예: `/api/users/{userId}/calendar/{calendarId}`"
54+
description = "사용자의 특정 일정을 수정합니다.\n\n예: `/api/users/{userId}/calendar/{personalCalendarId}`"
5555
)
5656
ApiResponse<Void> update(
5757
@Parameter(name = "userId", description = "사용자 ID", required = true, in = ParameterIn.PATH)
5858
@PathVariable("userId") Long userId,
5959

60-
@Parameter(name = "calendarId", description = "일정 ID", required = true, in = ParameterIn.PATH)
61-
@PathVariable("calendarId") Long calendarId,
60+
@Parameter(name = "personalCalendarId", description = "개인 캘린더 ID", required = true, in = ParameterIn.PATH)
61+
@PathVariable("personalCalendarId") Long personalCalendarId,
6262

6363
@RequestBody PersonalCalendarRequest request
6464
);
6565

6666
@Operation(
6767
summary = "개인 일정 삭제",
68-
description = "사용자의 특정 일정을 삭제합니다.\n\n예: `/api/users/{userId}/calendar/{calendarId}`"
68+
description = "사용자의 특정 일정을 삭제합니다.\n\n예: `/api/users/{userId}/calendar/{personalCalendarId}`"
6969
)
7070
ApiResponse<Void> delete(
7171
@Parameter(name = "userId", description = "사용자 ID", required = true, in = ParameterIn.PATH)
7272
@PathVariable("userId") Long userId,
7373

74-
@Parameter(name = "calendarId", description = "일정 ID", required = true, in = ParameterIn.PATH)
75-
@PathVariable("calendarId") Long calendarId
74+
@Parameter(name = "personalCalendarId", description = "개인 캘린더 ID", required = true, in = ParameterIn.PATH)
75+
@PathVariable("personalCalendarId") Long personalCalendarId
7676
);
7777
}

src/main/java/grep/neogul_coder/domain/calender/controller/TeamCalendarController.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class TeamCalendarController implements TeamCalendarSpecification {
2424
// 팀 일정 생성
2525
@PostMapping
2626
public ApiResponse<Void> create(
27-
@AuthenticationPrincipal Long userId, // 인증된 사용자의 ID를 자동 주입받음
27+
@AuthenticationPrincipal(expression = "userId") Long userId, // 인증된 사용자의 ID를 자동 주입받음
2828
@PathVariable("studyId") Long studyId,
2929
@Valid @RequestBody TeamCalendarRequest request
3030
) {
@@ -35,15 +35,15 @@ public ApiResponse<Void> create(
3535
// 전체 일정 조회 API
3636
@GetMapping
3737
public ApiResponse<List<TeamCalendarResponse>> findAll(
38-
@AuthenticationPrincipal Long userId,
38+
@AuthenticationPrincipal(expression = "userId") Long userId,
3939
@PathVariable("studyId") Long studyId) {
4040
return ApiResponse.success(teamCalendarService.findAll(studyId));
4141
}
4242

4343
// 특정 날짜에 해당하는 팀 일정 조회 API
4444
@GetMapping("/day")
4545
public ApiResponse<List<TeamCalendarResponse>> findByDate(
46-
@AuthenticationPrincipal Long userId,
46+
@AuthenticationPrincipal(expression = "userId") Long userId,
4747
@PathVariable("studyId") Long studyId,
4848
@RequestParam String date
4949
) {
@@ -52,25 +52,25 @@ public ApiResponse<List<TeamCalendarResponse>> findByDate(
5252
}
5353

5454
// 팀 일정 수정 API - 본인이 작성한 일정만 수정 가능
55-
@PutMapping("/{calendarId}")
55+
@PutMapping("/{teamCalendarId}")
5656
public ApiResponse<Void> update(
57-
@AuthenticationPrincipal Long userId,
57+
@AuthenticationPrincipal(expression = "userId") Long userId,
5858
@PathVariable("studyId") Long studyId,
59-
@PathVariable("calendarId") Long calendarId,
59+
@PathVariable("teamCalendarId") Long teamCalendarId,
6060
@Valid @RequestBody TeamCalendarRequest request
6161
) {
62-
teamCalendarService.update(studyId, calendarId, userId, request);
62+
teamCalendarService.update(studyId, userId, teamCalendarId, request);
6363
return ApiResponse.noContent();
6464
}
6565

6666
// 팀 일정 삭제 API - 본인이 작성한 일정만 삭제 가능
67-
@DeleteMapping("/{calendarId}")
67+
@DeleteMapping("/{teamCalendarId}")
6868
public ApiResponse<Void> delete(
69-
@AuthenticationPrincipal Long userId,
69+
@AuthenticationPrincipal(expression = "userId") Long userId,
7070
@PathVariable("studyId") Long studyId,
71-
@PathVariable("calendarId") Long calendarId
71+
@PathVariable("teamCalendarId") Long teamCalendarId
7272
) {
73-
teamCalendarService.delete(studyId, userId, calendarId);
73+
teamCalendarService.delete(studyId, userId, teamCalendarId);
7474
return ApiResponse.noContent();
7575
}
7676
}

src/main/java/grep/neogul_coder/domain/calender/controller/TeamCalendarSpecification.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,27 @@ ApiResponse<Void> create(
5858
@Operation(
5959
summary = "팀 일정 수정",
6060
description = "기존 팀 일정을 수정합니다.\n\n" +
61-
"예: `/api/teams/{studyId}/calendar/{calendarId}`"
61+
"예: `/api/teams/{studyId}/calendar/{teamCalendarId}`"
6262
)
6363
ApiResponse<Void> update(
6464
@Parameter(hidden = true) @AuthenticationPrincipal Long userId,
6565
@Parameter(name = "studyId", description = "팀 ID", required = true, in = ParameterIn.PATH)
6666
@PathVariable("studyId") Long studyId,
67-
@Parameter(name = "calendarId", description = "일정 ID", required = true, in = ParameterIn.PATH)
68-
@PathVariable("calendarId") Long calendarId,
67+
@Parameter(name = "teamCalendarId", description = "팀 캘린더 ID", required = true, in = ParameterIn.PATH)
68+
@PathVariable("teamCalendarId") Long teamCalendarId,
6969
@RequestBody TeamCalendarRequest request
7070
);
7171

7272
@Operation(
7373
summary = "팀 일정 삭제",
7474
description = "기존 팀 일정을 삭제합니다.\n\n" +
75-
"예: `/api/teams/{studyId}/calendar/{calendarId}`"
75+
"예: `/api/teams/{studyId}/calendar/{teamCalendarId}`"
7676
)
7777
ApiResponse<Void> delete(
7878
@Parameter(hidden = true) @AuthenticationPrincipal Long userId,
7979
@Parameter(name = "studyId", description = "팀 ID", required = true, in = ParameterIn.PATH)
8080
@PathVariable("studyId") Long studyId,
81-
@Parameter(name = "calendarId", description = "일정 ID", required = true, in = ParameterIn.PATH)
82-
@PathVariable("calendarId") Long calendarId
81+
@Parameter(name = "teamCalendarId", description = "팀 캘린더 ID", required = true, in = ParameterIn.PATH)
82+
@PathVariable("teamCalendarId") Long teamCalendarId
8383
);
8484
}

src/main/java/grep/neogul_coder/domain/calender/controller/dto/response/PersonalCalendarResponse.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
@Schema(description = "개인 캘린더 응답 DTO")
1414
public class PersonalCalendarResponse {
1515

16-
@Schema(description = "일정 ID", example = "1001")
17-
private Long calendarId;
16+
@Schema(description = "개인 일정 ID (PersonalCalendar의 ID)", example = "1001")
17+
private Long personalCalendarId;
1818

1919
@Schema(description = "사용자 ID", example = "1")
2020
private Long userId;
@@ -38,10 +38,10 @@ public class PersonalCalendarResponse {
3838
private LocalDateTime endTime;
3939

4040
@Builder
41-
public PersonalCalendarResponse(Long calendarId, Long userId, String writerNickname,
41+
protected PersonalCalendarResponse(Long personalCalendarId, Long userId, String writerNickname,
4242
String writerProfileImageUrl, String title, String description,
4343
LocalDateTime startTime, LocalDateTime endTime) {
44-
this.calendarId = calendarId;
44+
this.personalCalendarId = personalCalendarId;
4545
this.userId = userId;
4646
this.writerNickname = writerNickname;
4747
this.writerProfileImageUrl = writerProfileImageUrl;
@@ -54,7 +54,7 @@ public PersonalCalendarResponse(Long calendarId, Long userId, String writerNickn
5454
public static PersonalCalendarResponse from(PersonalCalendar pc, User user) {
5555
Calendar calendar = pc.getCalendar();
5656
return PersonalCalendarResponse.builder()
57-
.calendarId(calendar.getId())
57+
.personalCalendarId(pc.getId())
5858
.userId(user.getId())
5959
.writerNickname(user.getNickname())
6060
.writerProfileImageUrl(user.getProfileImageUrl())

src/main/java/grep/neogul_coder/domain/calender/controller/dto/response/TeamCalendarResponse.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
@Schema(description = "팀 캘린더 응답 DTO")
1313
public class TeamCalendarResponse {
1414

15-
@Schema(description = "일정 ID", example = "2001")
16-
private Long calendarId;
15+
@Schema(description = "일정 ID", example = "2001")
16+
private Long teamCalendarId;
1717

1818
@Schema(description = "스터디 ID", example = "101")
1919
private Long studyId;
@@ -40,10 +40,10 @@ public class TeamCalendarResponse {
4040
private LocalDateTime endTime;
4141

4242
@Builder
43-
public TeamCalendarResponse(Long calendarId, Long studyId, Long writerId, String writerNickname,
43+
protected TeamCalendarResponse(Long teamCalendarId, Long studyId, Long writerId, String writerNickname,
4444
String writerProfileImageUrl, String title, String description, LocalDateTime startTime,
4545
LocalDateTime endTime) {
46-
this.calendarId = calendarId;
46+
this.teamCalendarId = teamCalendarId;
4747
this.studyId = studyId;
4848
this.writerId = writerId;
4949
this.writerNickname = writerNickname;
@@ -58,7 +58,7 @@ public static TeamCalendarResponse from(TeamCalendar teamCalendar, User user) {
5858
Calendar calendar = teamCalendar.getCalendar();
5959

6060
return TeamCalendarResponse.builder()
61-
.calendarId(calendar.getId())
61+
.teamCalendarId(teamCalendar.getId())
6262
.title(calendar.getTitle())
6363
.description(calendar.getContent())
6464
.startTime(calendar.getScheduledStart())

src/main/java/grep/neogul_coder/domain/calender/entity/PersonalCalendar.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class PersonalCalendar extends BaseEntity {
1313
@GeneratedValue(strategy = GenerationType.IDENTITY)
1414
private Long id;
1515

16-
@ManyToOne(fetch = FetchType.LAZY)
16+
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
1717
private Calendar calendar;
1818

1919
@Column(name = "user_id")
@@ -27,5 +27,9 @@ public PersonalCalendar(Long userId, Calendar calendar) {
2727
public PersonalCalendar() {
2828

2929
}
30+
31+
public void delete() {
32+
this.activated = false;
33+
}
3034
}
3135

src/main/java/grep/neogul_coder/domain/calender/entity/TeamCalendar.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class TeamCalendar extends BaseEntity {
1414
@GeneratedValue(strategy = GenerationType.IDENTITY)
1515
private Long id;
1616

17-
@ManyToOne(fetch = FetchType.LAZY)
17+
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
1818
private Calendar calendar;
1919

2020
@Column(name = "user_id")
@@ -33,5 +33,9 @@ public TeamCalendar(Long studyId, Long userId, Calendar calendar) {
3333
public TeamCalendar() {
3434

3535
}
36+
37+
public void delete() {
38+
this.activated = false;
39+
}
3640
}
3741

src/main/java/grep/neogul_coder/domain/calender/exception/code/CalendarErrorCode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public enum CalendarErrorCode implements ErrorCode {
1111
NOT_CALENDAR_OWNER("CALENDAR_003", HttpStatus.BAD_REQUEST,"작성자만 수정 또는 삭제할 수 있습니다."),
1212
CALENDAR_NOT_FOUND("C404", HttpStatus.NOT_FOUND, "해당 캘린더를 찾을 수 없습니다.");
1313

14-
1514
private final String code;
1615
private final HttpStatus status;
1716
private final String message;

0 commit comments

Comments
 (0)