Repository navigation
[Feat/#311] AI 서버용 읽기 전용 내부 API 추가 #312
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
Open
overhyeon
wants to merge
5
commits into
main
Choose a base branch
from
feat/#311-ai-internal-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e50541f
chore: AI 서버용 ai-api 모듈 추가
overhyeon fd17964
feat: /v1/ai/** 내부 토큰 전용 보안 체인 추가
overhyeon 4643493
feat: AI 서버용 공지·행사·아카이빙·열린피드백 전체 조회 API 추가
overhyeon 57bb9b6
feat: AI 서버용 열린피드백 응답에 연도·회차 추가
overhyeon 7fc76f0
refactor: 커서 목록 전체 조회를 CursorSliceResult.fetchAll로 합치기
overhyeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| plugins { | ||
| java | ||
| } | ||
|
|
||
| description = "AI 서버(stream-ai) — 내부 토큰, /v1/ai/**, 조회 전용" | ||
|
|
||
| // 학생에게 보이는 글만 내보내도록 학생 화면이 쓰는 조회 서비스를 그대로 쓴다. 쓰기용 서비스는 부르지 않는다 | ||
| dependencies { | ||
| implementation(project(":api:common-api")) | ||
| implementation(project(":core:common")) | ||
| implementation(project(":core:domain:event")) | ||
| implementation(project(":core:domain:welfare")) | ||
|
|
||
| implementation(platform(libs.springBootDependenciesBom)) | ||
| implementation(libs.springBootStarterWebmvc) | ||
| implementation(libs.springdocStarterWebmvcUi) | ||
| } |
22 changes: 22 additions & 0 deletions
22
api/ai-api/src/main/java/kr/ac/kookmin/stream/api/ai/event/archive/AiArchiveApi.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package kr.ac.kookmin.stream.api.ai.event.archive; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import java.util.List; | ||
| import kr.ac.kookmin.stream.api.ai.event.archive.response.AiArchiveResponse; | ||
| import kr.ac.kookmin.stream.api.common.dto.ApiResponse; | ||
| import kr.ac.kookmin.stream.api.common.openapi.ApiErrorCode; | ||
| import kr.ac.kookmin.stream.common.CommonErrorCode; | ||
|
|
||
| /** | ||
| * AI 서버용 아카이빙 API의 문서 명세. 구현은 {@link AiArchiveController}가 맡는다. | ||
| */ | ||
| @Tag(name = "AI 서버 — 아카이빙", description = "챗봇 인덱싱용 조회 (X-Internal-Token)") | ||
| public interface AiArchiveApi { | ||
|
|
||
| @Operation(summary = "아카이빙 전체 조회", | ||
| description = "학생 앱 아카이빙 목록에 보이는 기록 전체를 본문까지 한 번에 내려준다. 챗봇이 검색 인덱스를 만들 때 쓴다. " | ||
| + "이미지는 내려주지 않는다.") | ||
| @ApiErrorCode(type = CommonErrorCode.class, codes = {"UNAUTHORIZED"}) | ||
| ApiResponse<List<AiArchiveResponse>> getArchives(); | ||
| } |
35 changes: 35 additions & 0 deletions
35
api/ai-api/src/main/java/kr/ac/kookmin/stream/api/ai/event/archive/AiArchiveController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package kr.ac.kookmin.stream.api.ai.event.archive; | ||
|
|
||
| import java.util.List; | ||
| import kr.ac.kookmin.stream.api.ai.event.archive.response.AiArchiveResponse; | ||
| import kr.ac.kookmin.stream.api.common.dto.ApiResponse; | ||
| import kr.ac.kookmin.stream.event.domain.archive.domain.ArchiveSummary; | ||
| import kr.ac.kookmin.stream.event.domain.archive.service.ArchiveService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/v1/ai/archives") | ||
| @RequiredArgsConstructor | ||
| public class AiArchiveController implements AiArchiveApi { | ||
|
|
||
| private final ArchiveService archiveService; | ||
|
|
||
| /** | ||
| * 학생 목록(연도·검색어 없이 = 전체)으로 대상을 정하고, 본문은 한 건씩 상세로 가져온다. | ||
| * 목록 요약에는 본문이 없다. 아카이빙은 학기에 수십 건 수준이라 한 건씩 읽어도 부담이 없다. | ||
| */ | ||
| @Override | ||
| @GetMapping | ||
| public ApiResponse<List<AiArchiveResponse>> getArchives() { | ||
| List<AiArchiveResponse> archives = archiveService.getArchives(null, null).stream() | ||
| .map(ArchiveSummary::archiveId) | ||
| .map(archiveService::getArchive) | ||
| .map(AiArchiveResponse::from) | ||
| .toList(); | ||
|
|
||
| return ApiResponse.success(archives); | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
...i/src/main/java/kr/ac/kookmin/stream/api/ai/event/archive/response/AiArchiveResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package kr.ac.kookmin.stream.api.ai.event.archive.response; | ||
|
|
||
| import java.time.LocalDate; | ||
| import kr.ac.kookmin.stream.event.domain.archive.domain.ArchiveDetail; | ||
|
|
||
| /** | ||
| * 챗봇 인덱싱용 아카이빙. 지난 활동이 "언제·어디서·무엇을" 했는지 답할 글만 담는다 — 이미지는 넣지 않는다. | ||
| */ | ||
| public record AiArchiveResponse( | ||
| Long archiveId, | ||
| String title, | ||
| String content, | ||
| String location, | ||
| String departmentName, | ||
| LocalDate startDate, | ||
| LocalDate endDate | ||
| ) { | ||
|
|
||
| public static AiArchiveResponse from(ArchiveDetail archive) { | ||
| return new AiArchiveResponse( | ||
| archive.archiveId(), | ||
| archive.title(), | ||
| archive.content(), | ||
| archive.location(), | ||
| archive.departmentName(), | ||
| archive.startDate(), | ||
| archive.endDate() | ||
| ); | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
api/ai-api/src/main/java/kr/ac/kookmin/stream/api/ai/event/event/AiEventApi.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package kr.ac.kookmin.stream.api.ai.event.event; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import java.util.List; | ||
| import kr.ac.kookmin.stream.api.ai.event.event.response.AiEventResponse; | ||
| import kr.ac.kookmin.stream.api.common.dto.ApiResponse; | ||
| import kr.ac.kookmin.stream.api.common.openapi.ApiErrorCode; | ||
| import kr.ac.kookmin.stream.common.CommonErrorCode; | ||
|
|
||
| /** | ||
| * AI 서버용 행사 API의 문서 명세. 구현은 {@link AiEventController}가 맡는다. | ||
| */ | ||
| @Tag(name = "AI 서버 — 행사", description = "챗봇 인덱싱용 조회 (X-Internal-Token)") | ||
| public interface AiEventApi { | ||
|
|
||
| @Operation(summary = "행사 전체 조회", | ||
| description = "학생 앱에 보이는(게시된) 행사 전체를 소개글까지 한 번에 내려준다. 챗봇이 검색 인덱스를 만들 때 쓴다. " | ||
| + "모집 인원·신청 현황처럼 계속 바뀌는 값은 넣지 않는다 — 챗봇이 질문할 때 학생 API로 따로 조회한다.") | ||
| @ApiErrorCode(type = CommonErrorCode.class, codes = {"UNAUTHORIZED"}) | ||
| ApiResponse<List<AiEventResponse>> getEvents(); | ||
| } |
40 changes: 40 additions & 0 deletions
40
api/ai-api/src/main/java/kr/ac/kookmin/stream/api/ai/event/event/AiEventController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package kr.ac.kookmin.stream.api.ai.event.event; | ||
|
|
||
| import java.util.List; | ||
| import kr.ac.kookmin.stream.api.ai.event.event.response.AiEventResponse; | ||
| import kr.ac.kookmin.stream.api.common.dto.ApiResponse; | ||
| import kr.ac.kookmin.stream.common.CursorSliceResult; | ||
| import kr.ac.kookmin.stream.event.domain.event.domain.EventCursor; | ||
| import kr.ac.kookmin.stream.event.domain.event.domain.EventSummary; | ||
| import kr.ac.kookmin.stream.event.domain.event.service.EventService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/v1/ai/events") | ||
| @RequiredArgsConstructor | ||
| public class AiEventController implements AiEventApi { | ||
|
|
||
| private static final int PAGE_SIZE = 100; | ||
|
|
||
| private final EventService eventService; | ||
|
|
||
| /** | ||
| * 학생 목록과 같은 서비스로 게시된 행사 ID를 모은 뒤, 소개글·장소가 있는 행사 본체를 한 번에 가져온다. | ||
| * 목록 요약에는 소개글이 없어서 두 단계로 나눴다. 둘 다 게시된 행사만 돌려준다. | ||
| */ | ||
| @Override | ||
| @GetMapping | ||
| public ApiResponse<List<AiEventResponse>> getEvents() { | ||
| List<Long> eventIds = CursorSliceResult.fetchAll( | ||
| EventCursor::from, cursor -> eventService.getPublishedEvents(null, null, cursor, PAGE_SIZE)) | ||
| .stream() | ||
| .map(EventSummary::eventId) | ||
| .toList(); | ||
|
|
||
| return ApiResponse.success( | ||
| eventService.getPublishedByIds(eventIds).stream().map(AiEventResponse::from).toList()); | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
...i-api/src/main/java/kr/ac/kookmin/stream/api/ai/event/event/response/AiEventResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package kr.ac.kookmin.stream.api.ai.event.event.response; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import kr.ac.kookmin.stream.event.domain.event.domain.Event; | ||
|
|
||
| /** | ||
| * 챗봇 인덱싱용 행사. "언제·어디서·무엇을"에 답할 글만 담는다. | ||
| * 모집 인원·신청자 수처럼 계속 바뀌는 값은 인덱싱하면 틀린 답이 나가므로 넣지 않는다. | ||
| * {@code applyEndAt}은 챗봇이 마감된 행사를 걸러내는 유효기간으로 쓴다. | ||
| */ | ||
| public record AiEventResponse( | ||
| Long eventId, | ||
| String title, | ||
| String description, | ||
| String place, | ||
| LocalDateTime applyStartAt, | ||
| LocalDateTime applyEndAt, | ||
| LocalDateTime eventStartAt, | ||
| LocalDateTime eventEndAt, | ||
| LocalDateTime updatedAt | ||
| ) { | ||
|
|
||
| public static AiEventResponse from(Event event) { | ||
| return new AiEventResponse( | ||
| event.getId(), | ||
| event.getTitle(), | ||
| event.getDescription(), | ||
| event.getPlace(), | ||
| event.getApplyStartAt(), | ||
| event.getApplyEndAt(), | ||
| event.getEventStartAt(), | ||
| event.getEventEndAt(), | ||
| event.getUpdatedAt() | ||
| ); | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
api/ai-api/src/main/java/kr/ac/kookmin/stream/api/ai/welfare/feedback/AiFeedbackApi.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package kr.ac.kookmin.stream.api.ai.welfare.feedback; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import java.util.List; | ||
| import kr.ac.kookmin.stream.api.ai.welfare.feedback.response.AiFeedbackResponse; | ||
| import kr.ac.kookmin.stream.api.common.dto.ApiResponse; | ||
| import kr.ac.kookmin.stream.api.common.openapi.ApiErrorCode; | ||
| import kr.ac.kookmin.stream.common.CommonErrorCode; | ||
|
|
||
| /** | ||
| * AI 서버용 열린피드백 API의 문서 명세. 구현은 {@link AiFeedbackController}가 맡는다. | ||
| */ | ||
| @Tag(name = "AI 서버 — 열린피드백", description = "챗봇 인덱싱용 조회 (X-Internal-Token)") | ||
| public interface AiFeedbackApi { | ||
|
|
||
| @Operation(summary = "공개된 열린피드백 답변 전체 조회", | ||
| description = "답변이 공개된 회차의 질문·답변 전체를 한 번에 내려준다. 챗봇이 검색 인덱스를 만들 때 쓴다. " | ||
| + "질문한 학생·답변한 운영진은 내려주지 않는다.") | ||
| @ApiErrorCode(type = CommonErrorCode.class, codes = {"UNAUTHORIZED"}) | ||
| ApiResponse<List<AiFeedbackResponse>> getFeedbacks(); | ||
| } |
38 changes: 38 additions & 0 deletions
38
...-api/src/main/java/kr/ac/kookmin/stream/api/ai/welfare/feedback/AiFeedbackController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package kr.ac.kookmin.stream.api.ai.welfare.feedback; | ||
|
|
||
| import java.util.List; | ||
| import kr.ac.kookmin.stream.api.ai.welfare.feedback.response.AiFeedbackResponse; | ||
| import kr.ac.kookmin.stream.api.common.dto.ApiResponse; | ||
| import kr.ac.kookmin.stream.common.PageResult; | ||
| import kr.ac.kookmin.stream.welfare.domain.feedback.domain.Feedback; | ||
| import kr.ac.kookmin.stream.welfare.domain.feedback.domain.FeedbackPeriod; | ||
| import kr.ac.kookmin.stream.welfare.domain.feedback.service.FeedbackService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/v1/ai/feedbacks") | ||
| @RequiredArgsConstructor | ||
| public class AiFeedbackController implements AiFeedbackApi { | ||
|
|
||
| private static final int PAGE_SIZE = 100; | ||
|
|
||
| // 연도·회차를 정하지 않으면 공개된 모든 회차다 | ||
| private static final FeedbackPeriod ALL_PERIODS = FeedbackPeriod.of(null, null); | ||
|
|
||
| private final FeedbackService feedbackService; | ||
|
|
||
| /** | ||
| * 학생 열린피드백 목록과 같은 서비스다. 답변이 공개된 회차의, 답변된 질문만 나온다. | ||
| */ | ||
| @Override | ||
| @GetMapping | ||
| public ApiResponse<List<AiFeedbackResponse>> getFeedbacks() { | ||
| List<Feedback> feedbacks = PageResult.fetchAll( | ||
| PAGE_SIZE, offset -> feedbackService.search(ALL_PERIODS, null, offset)); | ||
|
|
||
| return ApiResponse.success(feedbacks.stream().map(AiFeedbackResponse::from).toList()); | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
...c/main/java/kr/ac/kookmin/stream/api/ai/welfare/feedback/response/AiFeedbackResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package kr.ac.kookmin.stream.api.ai.welfare.feedback.response; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import kr.ac.kookmin.stream.welfare.domain.feedback.domain.Feedback; | ||
|
|
||
| /** | ||
| * 챗봇 인덱싱용 열린피드백. 질문과 답변 글, 그리고 어느 회차의 답변인지만 담는다. | ||
| * <p> | ||
| * 학생 앱이 열린피드백을 회차 단위로 보여주므로({@code FeedbackPeriod}), 챗봇도 "2026년 2회차 답변"처럼 | ||
| * 같은 단위로 출처를 말할 수 있게 연도·회차를 함께 내려준다. 답변일만으로는 회차를 짐작해야 한다. | ||
| * <p> | ||
| * <b>질문한 학생({@code createdBy})과 답변한 운영진({@code answeredBy})은 절대 넣지 않는다.</b> | ||
| * 열린피드백은 익명으로 받는다. 인덱스에 들어가면 챗봇 답변으로 새어 나갈 수 있다. | ||
| */ | ||
| public record AiFeedbackResponse( | ||
| Long feedbackId, | ||
| int year, | ||
| int round, | ||
| String question, | ||
| String answer, | ||
| LocalDateTime answeredAt | ||
| ) { | ||
|
|
||
| public static AiFeedbackResponse from(Feedback feedback) { | ||
| return new AiFeedbackResponse( | ||
| feedback.getId(), | ||
| feedback.getYear(), | ||
| feedback.getRound(), | ||
| feedback.getQuestion(), | ||
| feedback.getAnswer(), | ||
| feedback.getAnsweredAt() | ||
| ); | ||
| } | ||
| } | ||
22 changes: 22 additions & 0 deletions
22
api/ai-api/src/main/java/kr/ac/kookmin/stream/api/ai/welfare/notice/AiNoticeApi.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package kr.ac.kookmin.stream.api.ai.welfare.notice; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import java.util.List; | ||
| import kr.ac.kookmin.stream.api.ai.welfare.notice.response.AiNoticeResponse; | ||
| import kr.ac.kookmin.stream.api.common.dto.ApiResponse; | ||
| import kr.ac.kookmin.stream.api.common.openapi.ApiErrorCode; | ||
| import kr.ac.kookmin.stream.common.CommonErrorCode; | ||
|
|
||
| /** | ||
| * AI 서버용 공지 API의 문서 명세. 구현은 {@link AiNoticeController}가 맡는다. | ||
| */ | ||
| @Tag(name = "AI 서버 — 공지", description = "챗봇 인덱싱용 조회 (X-Internal-Token)") | ||
| public interface AiNoticeApi { | ||
|
|
||
| @Operation(summary = "공지 전체 조회", | ||
| description = "학생 앱에 보이는 공지 전체를 본문까지 한 번에 내려준다. 챗봇이 검색 인덱스를 만들 때 쓴다. " | ||
| + "작성자·이미지·첨부 파일은 내려주지 않는다.") | ||
| @ApiErrorCode(type = CommonErrorCode.class, codes = {"UNAUTHORIZED"}) | ||
| ApiResponse<List<AiNoticeResponse>> getNotices(); | ||
| } |
37 changes: 37 additions & 0 deletions
37
api/ai-api/src/main/java/kr/ac/kookmin/stream/api/ai/welfare/notice/AiNoticeController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package kr.ac.kookmin.stream.api.ai.welfare.notice; | ||
|
|
||
| import java.util.List; | ||
| import kr.ac.kookmin.stream.api.ai.welfare.notice.response.AiNoticeResponse; | ||
| import kr.ac.kookmin.stream.api.common.dto.ApiResponse; | ||
| import kr.ac.kookmin.stream.common.CursorSliceResult; | ||
| import kr.ac.kookmin.stream.welfare.domain.notice.domain.Notice; | ||
| import kr.ac.kookmin.stream.welfare.domain.notice.domain.NoticeCursor; | ||
| import kr.ac.kookmin.stream.welfare.domain.notice.service.NoticeService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/v1/ai/notices") | ||
| @RequiredArgsConstructor | ||
| public class AiNoticeController implements AiNoticeApi { | ||
|
|
||
| // 학생 목록 API의 최대 크기와 같다. 공지가 수백 건 수준이라 몇 번이면 끝난다 | ||
| private static final int PAGE_SIZE = 100; | ||
|
|
||
| private final NoticeService noticeService; | ||
|
|
||
| /** | ||
| * 학생 목록과 같은 서비스로 끝까지 넘겨 모은다. 삭제된 공지가 빠지는 규칙이 학생 화면과 자동으로 같다. | ||
| * 챗봇은 매번 전체를 받아 인덱스를 다시 만들므로, 응답에 없는 공지는 인덱스에서도 빠진다. | ||
| */ | ||
| @Override | ||
| @GetMapping | ||
| public ApiResponse<List<AiNoticeResponse>> getNotices() { | ||
| List<Notice> notices = CursorSliceResult.fetchAll( | ||
| NoticeCursor::from, cursor -> noticeService.getNotices(null, null, cursor, PAGE_SIZE)); | ||
|
|
||
| return ApiResponse.success(notices.stream().map(AiNoticeResponse::from).toList()); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[a]리뷰 포인트 주신 응답 필드에 대한 의견이에요. 공지·행사·아카이빙은 검색과 출처 표시에 쓸 값이 다 들어 있어 보여요.열린피드백은
year·round를 같이 내려주면 좋겠어요. 학생 앱은 열린피드백을 회차 단위로 보여줘서(FeedbackPeriod필터,FeedbackResponse.java:8의year·round) 챗봇도 같은 단위로 말할 수 있어야 할 것 같아요. 예를 들어answeredAt으로 회차를 짐작해야 해서, 챗봇이 "2회차 답변에 따르면"처럼 학생 화면과 같은 출처를 대기 어려워요.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했어요! 57bb9b61에서
year·round를feedbackId다음에 추가했어요. AI 서버 동기화 쪽에서도 회차를 메타데이터로 받아 쓰도록 맞출게요.