Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ configurations {

repositories {
mavenCentral()
maven {
name = 'chuseok22NexusRelease'
url = uri('https://nexus.chuseok22.com/repository/maven-releases/')
metadataSources {
mavenPom()
artifact()
}
}
}

dependencies {
Expand Down Expand Up @@ -52,6 +60,12 @@ dependencies {
// Jsoup (HTML 파싱)
implementation 'org.jsoup:jsoup:1.18.1'

developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'com.chuseok22:sejong-portal-login:1.0.0'

}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class LoginController {
public ResponseEntity<MemberDto> loginAndGetUserInfo(@RequestBody @Valid MemberCommand command) {
try {
log.info("세종대 포털 로그인 요청: {}", command.getSejongPortalId());
MemberDto memberInfo = sejongLoginService.getMemberAuthInfos(command);
MemberDto memberInfo = sejongLoginService.login(command);
log.info("사용자 정보 조회 성공: {}", memberInfo.getStudentName());
return ResponseEntity.ok(memberInfo);
} catch (Exception e) {
Expand Down
45 changes: 44 additions & 1 deletion src/main/java/com/example/enjoy/controller/UserController.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.enjoy.controller;

import com.example.enjoy.dto.AddManualCourseRequest;
import com.example.enjoy.dto.StudentCourseResponse;
import com.example.enjoy.dto.StudentCourseStatus;
import com.example.enjoy.dto.loginDto.MemberCommand;
import com.example.enjoy.dto.loginDto.MemberDto;
Expand Down Expand Up @@ -31,7 +32,7 @@ public UserController(SejongLoginService sejongLoginService, UserService userSer
}

@Operation(summary = "학생 정보 조회", description = "세종대학교 포털 인증을 통해 학생 정보를 조회합니다.")
@GetMapping("/detail")
@PostMapping("/detail")
public ResponseEntity<MemberDto> getStudentDetail(@RequestBody MemberCommand command) throws IOException {
MemberDto memberInfo = sejongLoginService.getMemberAuthInfos(command);
return ResponseEntity.ok(memberInfo);
Expand All @@ -44,6 +45,48 @@ public ResponseEntity<Void> addManualCourse(@Valid @RequestBody AddManualCourseR
return ResponseEntity.ok().build();
}

@Operation(summary = "수동 과목 조회", description = "학생이 수동으로 등록한 과목 목록을 조회합니다.")
@GetMapping("/{studentId}/courses/manual")
public ResponseEntity<List<StudentCourseResponse>> getManualCourses(@PathVariable String studentId) {
List<StudentCourse> manualCourses = userService.getManualCourses(studentId);
if (manualCourses.isEmpty()) {
return ResponseEntity.noContent().build();
}
return ResponseEntity.ok(
manualCourses.stream()
.map(course -> new StudentCourseResponse(course.getCourseName(), course.getStatus()))
.toList()
);
}

@Operation(summary = "진행 예정 과목 조회", description = "학생이 수강 예정인 과목 목록을 조회합니다.")
@GetMapping("/{studentId}/courses/planned")
public ResponseEntity<List<StudentCourseResponse>> getPlannedCourses(@PathVariable String studentId) {
List<StudentCourse> plannedCourses = userService.getPlannedCourses(studentId);
if (plannedCourses.isEmpty()) {
return ResponseEntity.noContent().build();
}
return ResponseEntity.ok(
plannedCourses.stream()
.map(course -> new StudentCourseResponse(course.getCourseName(), course.getStatus()))
.toList()
);
}

@Operation(summary = "수강 중인 과목 조회", description = "학생이 현재 수강 중인 과목 목록을 조회합니다.")
@GetMapping("/{studentId}/courses/inprogress")
public ResponseEntity<List<StudentCourseResponse>> getInProgressCourses(@PathVariable String studentId) {
List<StudentCourse> inProgressCourses = userService.getInProgressCourses(studentId);
if (inProgressCourses.isEmpty()) {
return ResponseEntity.noContent().build();
}
return ResponseEntity.ok(
inProgressCourses.stream()
.map(course -> new StudentCourseResponse(course.getCourseName(), course.getStatus()))
.toList()
);
}

@Operation(summary = "수동 과목 삭제", description = "수동으로 등록한 과목을 삭제합니다.")
@DeleteMapping("/courses")
public ResponseEntity<Void> removeManualCourse(
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/com/example/enjoy/dto/StudentCourseResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.example.enjoy.dto;

import com.example.enjoy.entity.StudentCourse;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@Schema(description = "학생 수강 과목 응답")
public class StudentCourseResponse {

@Schema(description = "과목명")
private String courseName;

@Schema(description = "이수 상태")
private StudentCourseStatus status;

public StudentCourseResponse(String courseName, StudentCourseStatus status) {
this.courseName = courseName;
this.status = status;
}

public static StudentCourseResponse from(StudentCourse entity) {
return new StudentCourseResponse(
entity.getCourseName(),
entity.getStatus()
);
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/example/enjoy/dto/loginDto/MemberDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class MemberDto {
private String major;
private String studentIdString;
private String studentName;
private String academicYear;
private String enrollmentStatus;
private String grade;
private String completedSemester;

}
1 change: 1 addition & 0 deletions src/main/java/com/example/enjoy/exception/ErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public enum ErrorCode {
SEJONG_AUTH_CREDENTIALS_INVALID(HttpStatus.UNAUTHORIZED, "세종대학교 인증 정보가 유효하지 않습니다"),
SEJONG_AUTH_DATA_FETCH_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "세종대학교 인증 데이터 가져오기 실패");


private final String message;
private final int status;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ public interface StudentCourseRepository extends JpaRepository<StudentCourse, Lo

Optional<StudentCourse> findByStudentIdAndCourseName(String studentId, String courseName);

List<StudentCourse> findAllByStudentIdAndManualIsTrue(String studentId);

}
Loading
Loading