Ai 엔티티 추가#16
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
WalkthroughAI 기능용 Question, Answer, DiaryQuestion TypeORM 엔티티를 추가하고, 이를 ChangesAI 모듈 및 엔티티
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/ai/entities/ai.question.entity.ts (1)
1-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value파일명 컨벤션 불일치
전역 가이드라인은 "schedule.entity.ts"처럼 kebab-case + role suffix를 권장하지만, 현재 파일명은
ai.question.entity.ts처럼 점(.) 구분자로 도메인/서브타입을 이어붙이는 방식입니다.src/ai/entities/폴더 안에 있으므로ai.접두사는 중복일 수 있습니다 (question.entity.ts등으로 단순화 가능).As per coding guidelines, "File names use kebab-case plus a role suffix (for example,
schedule.controller.ts, ...)".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/ai/entities/ai.question.entity.ts` around lines 1 - 27, The file name for QuestionEntity does not follow the kebab-case + role-suffix convention and uses a dotted domain prefix unnecessarily. Rename the entity file to a simpler kebab-case name such as question.entity.ts, and update any imports/references that currently point to ai.question.entity.ts so the QuestionEntity class remains discoverable under the standard naming convention.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/ai/entities/ai.question.entity.ts`:
- Around line 1-27: QuestionEntity is still defined as an isolated table, so add
the missing foreign-key relationships that connect Question/Answer/DiaryQuestion
with TypeORM relations. Update the relevant entity classes (QuestionEntity,
AnswerEntity, DiaryQuestionEntity) to include FK columns and matching `@ManyToOne`
or `@OneToOne` mappings, using the existing entity/property names to wire the
references so the schema enforces referential integrity.
---
Nitpick comments:
In `@src/ai/entities/ai.question.entity.ts`:
- Around line 1-27: The file name for QuestionEntity does not follow the
kebab-case + role-suffix convention and uses a dotted domain prefix
unnecessarily. Rename the entity file to a simpler kebab-case name such as
question.entity.ts, and update any imports/references that currently point to
ai.question.entity.ts so the QuestionEntity class remains discoverable under the
standard naming convention.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 698e9191-8f82-47bb-9c6f-0212897fd4b2
📒 Files selected for processing (5)
src/ai/ai.module.tssrc/ai/entities/ai.answer.entity.tssrc/ai/entities/ai.diary.question.entity.tssrc/ai/entities/ai.question.entity.tssrc/app.module.ts
| import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; | ||
|
|
||
| @Entity('Question') | ||
| export class QuestionEntity { | ||
| @PrimaryGeneratedColumn({ | ||
| name: 'question_id', | ||
| type: 'int', | ||
| comment: '질문ID', | ||
| }) | ||
| questionId: number; | ||
|
|
||
| @Column({ | ||
| name: 'content', | ||
| type: 'text', | ||
| nullable: false, | ||
| comment: '질문내용', | ||
| }) | ||
| content: string; | ||
|
|
||
| @Column({ | ||
| name: 'target_date', | ||
| type: 'date', | ||
| nullable: false, | ||
| comment: '질문 날짜', | ||
| }) | ||
| targetDate: string; | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "## files"
git ls-files 'src/**' | rg '(^src/ai/entities/|answer|diary.*question|question.*entity)' || true
echo "## search relations"
rg -n "`@ManyToOne`|`@OneToOne`|`@JoinColumn`|question_id|answer_id|diary_question|QuestionEntity|AnswerEntity|DiaryQuestionEntity" src/ai src 2>/dev/null || trueRepository: TEAM-DAILOG/BE
Length of output: 2331
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map entity files under src/ai/entities first.
fd -a -t f '.*\.entity\.ts$' src/ai/entities src 2>/dev/null || true
# Show outlines for the most relevant files if they exist.
for f in \
src/ai/entities/ai.question.entity.ts \
src/ai/entities/ai.answer.entity.ts \
src/ai/entities/ai.diary-question.entity.ts \
src/ai/entities/ai.diary.question.entity.ts \
src/ai/entities/answer.entity.ts \
src/ai/entities/diary-question.entity.ts
do
if [ -f "$f" ]; then
echo "## outline: $f"
ast-grep outline "$f" --view expanded || true
fi
doneRepository: TEAM-DAILOG/BE
Length of output: 1419
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "## entity files"
find src -type f -name '*.entity.ts' | sort | sed -n '1,200p'
echo "## ai entity definitions"
for f in $(find src/ai -type f -name '*.entity.ts' | sort); do
echo "### $f"
sed -n '1,220p' "$f" | rg -n "^(import |`@Entity`|export class| @| [a-zA-Z0-9_]+:)"
done
echo "## relation decorators involving question/answer/diary"
rg -n "`@ManyToOne`|`@OneToOne`|`@ManyToMany`|`@JoinColumn`|questionId|answerId|diaryQuestion|targetDate" src/ai src 2>/dev/null || trueRepository: TEAM-DAILOG/BE
Length of output: 2256
Question/Answer/DiaryQuestion에 FK 관계를 추가하세요
현재 QuestionEntity, AnswerEntity, DiaryQuestionEntity가 모두 독립 테이블로만 정의돼 있어 질문-답변-일기질문 간 참조 무결성이 보장되지 않습니다. 최종 스키마가 맞다면 이를 연결하는 FK 컬럼과 @ManyToOne/@OneToOne 매핑이 필요합니다.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/ai/entities/ai.question.entity.ts` around lines 1 - 27, QuestionEntity is
still defined as an isolated table, so add the missing foreign-key relationships
that connect Question/Answer/DiaryQuestion with TypeORM relations. Update the
relevant entity classes (QuestionEntity, AnswerEntity, DiaryQuestionEntity) to
include FK columns and matching `@ManyToOne` or `@OneToOne` mappings, using the
existing entity/property names to wire the references so the schema enforces
referential integrity.
Source: Path instructions
📌 PR 제목 (제목 작성 후 해당 부분은 내용에서 지워주세요!)
📌 관련 이슈번호
📌 PR 유형
어떤 변경 사항이 있나요?
📌 PR 요약
해당 PR을 간단하게 요약해 주세요
📌 작업 세부 내용
📸 스크린샷 (선택)
🔗 참고 자료