Skip to content

Ai 엔티티 추가#16

Open
kimkimgungunwoo wants to merge 1 commit into
developfrom
feat/#13
Open

Ai 엔티티 추가#16
kimkimgungunwoo wants to merge 1 commit into
developfrom
feat/#13

Conversation

@kimkimgungunwoo

Copy link
Copy Markdown
Contributor

📌 PR 제목 (제목 작성 후 해당 부분은 내용에서 지워주세요!)

📌 관련 이슈번호

📌 PR 유형

어떤 변경 사항이 있나요?

  • 새 기능 추가
  • 버그 수정
  • 리팩토링

📌 PR 요약

해당 PR을 간단하게 요약해 주세요

📌 작업 세부 내용

📸 스크린샷 (선택)

🔗 참고 자료

@kimkimgungunwoo kimkimgungunwoo linked an issue Jul 8, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d0061774-f6d9-4b70-bce0-4474d3fa6ad3

📥 Commits

Reviewing files that changed from the base of the PR and between f8ad372 and 89ccd40.

📒 Files selected for processing (5)
  • src/ai/ai.module.ts
  • src/ai/entities/ai.answer.entity.ts
  • src/ai/entities/ai.diary.question.entity.ts
  • src/ai/entities/ai.question.entity.ts
  • src/app.module.ts
✅ Files skipped from review due to trivial changes (1)
  • src/app.module.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/ai/entities/ai.diary.question.entity.ts
  • src/ai/ai.module.ts
  • src/ai/entities/ai.answer.entity.ts
  • src/ai/entities/ai.question.entity.ts

Walkthrough

AI 기능용 Question, Answer, DiaryQuestion TypeORM 엔티티를 추가하고, 이를 AiModule에 등록한 뒤 AppModule에 연결했다.

Changes

AI 모듈 및 엔티티

Layer / File(s) Summary
AI 엔티티 정의
src/ai/entities/ai.question.entity.ts, src/ai/entities/ai.answer.entity.ts, src/ai/entities/ai.diary.question.entity.ts
Question, Answer, DiaryQuestion 테이블에 매핑되는 TypeORM 엔티티와 기본키, 텍스트, 날짜, 불리언 컬럼을 정의한다.
AiModule 등록 및 AppModule 연결
src/ai/ai.module.ts, src/app.module.ts
TypeOrmModule.forFeature에 세 엔티티를 등록하고 export한 뒤, AppModuleimportsAiModule을 추가한다.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 AI 엔티티 추가라는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Description check ✅ Passed 설명은 새 기능 추가와 #13 종료를 언급해 변경 내용과 관련되어 있습니다.
Linked Issues check ✅ Passed #13의 AI 관련 테이블 생성 목표에 맞춰 관련 엔티티와 모듈이 추가되었습니다.
Out of Scope Changes check ✅ Passed AppModule 연결은 AI 기능을 사용하기 위한 범위 내 변경으로 보이며 불필요한 변경은 보이지 않습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#13

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between becaba6 and f8ad372.

📒 Files selected for processing (5)
  • src/ai/ai.module.ts
  • src/ai/entities/ai.answer.entity.ts
  • src/ai/entities/ai.diary.question.entity.ts
  • src/ai/entities/ai.question.entity.ts
  • src/app.module.ts

Comment on lines +1 to +27
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;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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 || true

Repository: 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
done

Repository: 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 || true

Repository: 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

@kimkimgungunwoo kimkimgungunwoo self-assigned this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] AI 테이블생성

1 participant