Skip to content

Commit

Permalink
feat: 대학 연계 행사 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
nyeroni committed Oct 14, 2024
1 parent 5d7f019 commit 8ccae1a
Show file tree
Hide file tree
Showing 20 changed files with 309 additions and 236 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package yerong.wedle.category.expo.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import yerong.wedle.category.expo.domain.ExpoStatus;
import yerong.wedle.category.expo.domain.ExpoType;
import yerong.wedle.category.expo.dto.ExpoResponse;
import yerong.wedle.category.expo.service.ExpoService;

import java.util.List;

@Tag(name = "Expo API", description = "대학교 입시설명회 및 연계 활동 공지 관련 API")
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/expo")
public class ExpoApiController {

private final ExpoService expoService;


@Operation(summary = "대학별 연계활동 조회", description = "특정 대학의 ID를 사용하여 해당 대학과 관련된 모든 공지사항을 조회합니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "대학과 관련된 공지사항 조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 대학을 찾을 수 없음")
})
@GetMapping("/search")
public ResponseEntity<List<ExpoResponse>> getExposByUniversity(@RequestParam String keyword) {
return ResponseEntity.ok().body(expoService.getExposByKeyword(keyword));
}

@Operation(summary = "카테고리별 연계활동 조회", description = "특정 카테고리를 사용하여 해당 카테고리에 속한 모든 연계활동을 조회합니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "카테고리별 연계활동 조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 카테고리에 연계활동이 없음")
})
@GetMapping("/type")
public ResponseEntity<List<ExpoResponse>> getExposByType(@RequestParam ExpoType type) {
return ResponseEntity.ok().body(expoService.getExposByType(type));
}

@Operation(summary = "상태별 연계활동 조회", description = "특정 카테고리를 사용하여 해당 카테고리에 속한 모든 연계활동을 조회합니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "카테고리별 연계활동 조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 카테고리에 연계활동이 없음")
})
@GetMapping("/status")
public ResponseEntity<List<ExpoResponse>> getExposByStatus(@RequestParam ExpoStatus status) {
return ResponseEntity.ok().body(expoService.getExposByStatus(status));
}

@Operation(summary = "모든 연계활동 조회", description = "모든 연계활동을 조회합니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "모든 연계활동 조회 성공")
})
@GetMapping
public ResponseEntity<List<ExpoResponse>> getAllExpos() {
return ResponseEntity.ok().body(expoService.getAllExpos());
}
}
56 changes: 56 additions & 0 deletions src/main/java/yerong/wedle/category/expo/domain/Expo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package yerong.wedle.category.expo.domain;

import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.cglib.core.Local;
import yerong.wedle.category.activity.domain.ActivityUniversity;
import yerong.wedle.university.domain.University;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public
class Expo {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "expo_id")
private Long id;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private ExpoType expoType;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private ExpoStatus expoStatus;

private String expoYear;

@Column(nullable = false)
private String title;

@Column(nullable = false)
private String link;

private String location;

@Column(columnDefinition = "TEXT")
private String content;

private LocalDate startDate;
private LocalDate endDate;

public void setExpoStatus(ExpoStatus expoStatus) {
this.expoStatus = expoStatus;
}
}
15 changes: 15 additions & 0 deletions src/main/java/yerong/wedle/category/expo/domain/ExpoStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package yerong.wedle.category.expo.domain;

import lombok.Getter;

@Getter
public enum ExpoStatus {
OPEN("접수 중"),
CLOSED("접수 종료");

private final String displayName;

ExpoStatus(String displayName) {
this.displayName = displayName;
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package yerong.wedle.category.announcement.domain;
package yerong.wedle.category.expo.domain;

public enum AnnouncementCategory {
public enum ExpoType {
ADMISSION_SESSION("입시설명회"),
COOPERATIVE_ACTIVITIES("연계활동");
COOPERATIVE_ACTIVITIES("연계활동"),
MAJOR_EXPERIENCE("전공체험");


private final String displayName;

AnnouncementCategory(String displayName) {
ExpoType(String displayName) {
this.displayName = displayName;
}

Expand Down
24 changes: 24 additions & 0 deletions src/main/java/yerong/wedle/category/expo/dto/ExpoResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package yerong.wedle.category.expo.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import yerong.wedle.category.expo.domain.Expo;

import java.time.LocalDate;
import java.util.List;

@Getter
@AllArgsConstructor
@NoArgsConstructor
public class ExpoResponse {
private Long expoId;
private String title;
private String category;
private String expoYear;
private String status;
private String link;
private String location;
private String content;
private String date;
}
Loading

0 comments on commit 8ccae1a

Please sign in to comment.