Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/#31 fix main #35

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
12 commits
Select commit Hold shift + click to select a range
ae7e7f0
[FIX] λŒ€μƒ, μΌμ‹œ, 이미지 null ν—ˆμš©ν•˜λ„λ‘ λ³€κ²½ 및 μ’‹μ•„μš”μˆ˜, 쑰회수, μ €μž₯ 수 0으둜 μ΄ˆκΈ°ν™” #25
eeddiinn Jul 13, 2024
f18d266
[FIX] 곡지사항 λ“±λ‘μ‹œ 제λͺ© 100자 μ œν•œ 및 이미지 μ΅œλŒ€ 5개 μ œν•œ #27
eeddiinn Jul 13, 2024
8052be9
[FIX] notice κ΄€λ ¨ μˆ˜μ • (μ‘°νšŒμ‹œ 곡지 λ“±λ‘ν•œ λ‚ μ§œ, 이미지 μΆ”κ°€, μΌμ‹œλŠ” μ‚­μ œ & 졜근 μ €μž₯ 순 μ •λ ¬ & μ €μž₯ μˆ˜β€¦
eeddiinn Jul 13, 2024
63c7a22
[FIX] μ’‹μ•„μš” 이미 λˆŒλ €λŠ”μ§€ ν™•μΈν•˜λŠ” 둜직 μΆ”κ°€ #27
eeddiinn Jul 13, 2024
8badb98
Merge branch 'main' into fix/#27-fix_notice
eeddiinn Jul 13, 2024
c330013
[FIX] 곡지사항 세뢀사항 μ‘°νšŒμ—μ„œ category, contentSummary, memberId, noticeLike 삭…
eeddiinn Jul 13, 2024
329c3a3
Merge branch 'fix/#27-fix_notice' of https://github.com/Team-UniVoice…
eeddiinn Jul 13, 2024
da2e377
[FIX] ν‘Έμ‹œ 였λ₯˜ ν•΄κ²° #27
eeddiinn Jul 13, 2024
14eecb5
[FIX] responseμ—μ„œ μΌμ‹œ μ‚­μ œ 및 등둝 λ‚ μ§œ, 쑰회수, 이미지 μΆ”κ°€ #31
eeddiinn Jul 14, 2024
52cfbdb
[FIX] responseμˆ˜μ • 및 총 ν•™μƒνšŒ, 단과 λŒ€ν•™, ν•™κ³Ό ν•™μƒνšŒ 별 쑰회될 수 μžˆλ„λ‘ μˆ˜μ • #31
eeddiinn Jul 14, 2024
fa82cd7
[FIX] 퀡 μŠ€μΊ” μŠ€ν† λ¦¬ μ•ˆμ½μ€ 곡지 수 둜직 μˆ˜μ • #31
eeddiinn Jul 14, 2024
65987e9
[FIX] 퀡 μŠ€μΊ” 세뢀사항 response 및 둜직 μˆ˜μ • #31
eeddiinn Jul 14, 2024
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
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

implementation 'org.springframework.boot:spring-boot-starter-validation' // μœ νš¨μ„± 검사 μœ„ν•΄
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sopt.univoice.domain.notice.controller;


import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -20,7 +21,7 @@ public class NoticeController {
private final NoticeService noticeService;

@PostMapping("/create")
public ResponseEntity<SuccessStatusResponse<Void>> createPost(@ModelAttribute NoticeCreateRequest noticeCreateRequest) {
public ResponseEntity<SuccessStatusResponse<Void>> createPost(@Valid @ModelAttribute NoticeCreateRequest noticeCreateRequest) {
System.out.println("createPost method called with request: " + noticeCreateRequest);
noticeService.createPost(noticeCreateRequest);
return ResponseEntity.status(HttpStatus.CREATED)
Expand Down Expand Up @@ -79,7 +80,7 @@ public ResponseEntity<SuccessStatusResponse<Object>> viewCount(@PathVariable Lon
public ResponseEntity<SuccessStatusResponse<Object>> quickhead() {
QuickScanDTO response = noticeService.quickhead();
return ResponseEntity.status(HttpStatus.OK)
.body(SuccessStatusResponse.of(SuccessMessage.GET_ALL_NOTICE_SUCCESS, response));
.body(SuccessStatusResponse.of(SuccessMessage.GET_ALL_QUICK_SUCCESS, response));
}

@GetMapping("/all")
Expand Down Expand Up @@ -118,10 +119,10 @@ public ResponseEntity<SuccessStatusResponse<Object>> getDepartmentNoticeByUserUn
.body(SuccessStatusResponse.of(SuccessMessage.GET_ALL_DEPARTMENT_NOTICE_SUCCESS, response));
}

@PostMapping("/quick")
public ResponseEntity<SuccessStatusResponse<List<QuickQueryNoticeDTO>>> getQuickNoticeByUserUniversity(@RequestBody AffiliationRequestDTO request) {
@GetMapping ("/quick")
public ResponseEntity<SuccessStatusResponse<List<QuickQueryNoticeDTO>>> getQuickNoticeDetail(@RequestBody AffiliationRequestDTO request) {
System.out.println("Received Affiliation Request: " + request.getAffiliation());
List<QuickQueryNoticeDTO> response = noticeService.getQuickNoticeByUserUniversity(request.getAffiliation());
List<QuickQueryNoticeDTO> response = noticeService.getQuickNoticeDetail(request.getAffiliation());
return ResponseEntity.status(HttpStatus.OK)
.body(SuccessStatusResponse.of(SuccessMessage.GET_QUICK_NOTICE_SUCCESS, response));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package sopt.univoice.domain.notice.dto;

import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
Expand All @@ -15,7 +16,7 @@
//@AllArgsConstructor
public class NoticeCreateRequest {


@Size(max = 100)
private String title;

private String content;
Expand All @@ -27,6 +28,6 @@ public class NoticeCreateRequest {
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private LocalDateTime endTime;

private List<MultipartFile> studentCardImages;

@Size(max = 5)
private List<MultipartFile> imageList;
}
6 changes: 3 additions & 3 deletions src/main/java/sopt/univoice/domain/notice/dto/NoticeDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
@AllArgsConstructor
public class NoticeDTO {
private Long id;
private LocalDateTime startTime;
private LocalDateTime endTime;
private LocalDateTime createdAt;
private String title;
private Long likeCount;
private Long saveCount;
private Long viewCount;
private String category;
private String image;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@
@AllArgsConstructor
public class NoticeDetailResponseDTO {
private Long id;
private String writeAffiliation;
private String title;
private String content;
private Long noticeLike;
private Long viewCount;
private String target;
private LocalDateTime startTime;
private LocalDateTime endTime;
private String category;
private String contentSummary;
private Long memberId;
private String writeAffiliation;
private String content;
private LocalDateTime createdAt;
private Long viewCount;
private List<String> noticeImages;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
@AllArgsConstructor
public class NoticeResponseDTO {
private Long id;
private LocalDateTime startTime;
private LocalDateTime endTime;
private LocalDateTime createdAt;
private String title;
private Long likeCount;
private Long saveCount;
private Long viewCount;
private String category;
private String image;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public class NoticeSaveDTO {
private Long viewCount;
private Long noticeLike;
private String category;
private LocalDateTime startTime;
private LocalDateTime endTime;
private LocalDateTime createdAt;
private String image;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package sopt.univoice.domain.notice.dto;

import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Getter;

Expand All @@ -9,11 +10,14 @@
@AllArgsConstructor
public class QuickQueryNoticeDTO {
private Long id;
private String writeAffiliation;
private LocalDateTime createdAt;
private Long viewCount;
private String title;
private String target;
private LocalDateTime startTime;
private LocalDateTime endTime;
private String title;
private Long likeCount;
private Long saveCount;
private String category;
@Size(max = 150)
private String contentSummary;
}

8 changes: 8 additions & 0 deletions src/main/java/sopt/univoice/domain/notice/entity/Notice.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ public class Notice extends BaseTimeEntity {
private Long noticeLike = 0L;

private Long viewCount = 0L;

private Long noticeSave = 0L;

private String target;


private LocalDateTime startTime;
private LocalDateTime endTime;

Expand Down Expand Up @@ -71,6 +75,7 @@ public Notice(String title, String content, String target, LocalDateTime startTi
this.member = member;
this.noticeLike = 0L;
this.viewCount = 0L;
this.noticeSave = 0L;
this.contentSummary = contentSummary;
this.category = category;
}
Expand All @@ -89,6 +94,9 @@ public Long getViewCount() {
return viewCount;
}

public void setNoticeSave(Long noticeSave) {
this.noticeSave = noticeSave;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import sopt.univoice.domain.user.entity.Member;
import sopt.univoice.infra.persistence.BaseTimeEntity;


@Entity
@Getter
@NoArgsConstructor
public class SaveNotice {
public class SaveNotice extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@

public interface NoticeLikeRepository extends JpaRepository<NoticeLike, Long> {
Optional<NoticeLike> findByNoticeAndMember(Notice notice, Member member);

boolean existsByNoticeAndMember(Notice notice, Member member);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public interface NoticeRepository extends JpaRepository<Notice, Long> {

@Query("SELECT n FROM Notice n WHERE n.member.universityName = :universityName AND n.member.affiliation.affiliation = :affiliation")
List<Notice> findByMemberUniversityNameAndAffiliationAffiliation(String universityName, String affiliation);

List<Notice> findByMemberUniversityNameAndMemberCollegeDepartmentNameAndMemberAffiliationAffiliation(String universityName, String collegeDepartmentName, String affiliation);

List<Notice> findByMemberUniversityNameAndMemberCollegeDepartmentNameAndMemberDepartmentNameAndMemberAffiliationAffiliation(String universityName, String collegeDepartmentName, String departmentName, String affiliation);
}


Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
public interface SaveNoticeRepository extends JpaRepository<SaveNotice, Long>{
Optional<SaveNotice> findByNoticeAndMember(Notice notice, Member member);
List<SaveNotice> findByMember(Member member);

boolean existsByNoticeAndMember(Notice notice, Member member);
}


Expand Down
Loading
Loading