-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat/#13]Ai 엔티티 추가 #16
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Module } from '@nestjs/common'; | ||
| import { TypeOrmModule } from '@nestjs/typeorm'; | ||
| import { QuestionEntity } from './entities/ai.question.entity'; | ||
| import { AnswerEntity } from './entities/ai.answer.entity'; | ||
| import { DiaryQuestionEntity } from './entities/ai.diary.question.entity'; | ||
|
|
||
| @Module({ | ||
| imports: [ | ||
| TypeOrmModule.forFeature([ | ||
| QuestionEntity, | ||
| AnswerEntity, | ||
| DiaryQuestionEntity, | ||
| ]), | ||
| ], | ||
| controllers: [], | ||
| providers: [], | ||
| exports: [TypeOrmModule], | ||
| }) | ||
| export class AiModule {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| Entity, | ||
| PrimaryGeneratedColumn, | ||
| } from 'typeorm'; | ||
|
|
||
| @Entity('Answer') | ||
| export class AnswerEntity { | ||
| @PrimaryGeneratedColumn({ name: 'answer_id', type: 'int' }) | ||
| answerId: number; | ||
|
|
||
| @Column({ name: 'answer', type: 'text' }) | ||
| answer: string; | ||
|
|
||
| @CreateDateColumn({ | ||
| name: 'created_at', | ||
| type: 'timestamp', | ||
| nullable: false, | ||
| comment: '생성일', | ||
| }) | ||
| createdAt: Date; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| Entity, | ||
| PrimaryGeneratedColumn, | ||
| } from 'typeorm'; | ||
|
|
||
| @Entity('DiaryQuestion') | ||
| export class DiaryQuestionEntity { | ||
| @PrimaryGeneratedColumn({ | ||
| name: 'diary_question_id', | ||
| type: 'int', | ||
| comment: '일기-질문 아이디', | ||
| }) | ||
| diaryQuestionId: number; | ||
|
|
||
| @Column({ | ||
| name: 'is_written', | ||
| type: 'boolean', | ||
| nullable: false, | ||
| default: false, | ||
| }) | ||
| isWritten: boolean; | ||
|
|
||
| @CreateDateColumn({ | ||
| name: 'created_at', | ||
| type: 'timestamp', | ||
| comment: '생성일자', | ||
| }) | ||
| createdAt: Date; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,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; | ||
| } | ||
|
Comment on lines
+1
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 || 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 관계를 추가하세요 🤖 Prompt for AI AgentsSource: Path instructions |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| Entity, | ||
| PrimaryGeneratedColumn, | ||
| } from 'typeorm'; | ||
|
|
||
| @Entity('Recommend') | ||
| export class RecommendEntity { | ||
|
Comment on lines
+8
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
printf '\n## File list\n'
git ls-files | rg '(^src/(ai|diaries)/entities/.*recommend.*\.ts$|typeorm|migration|migrations|data-source|ormconfig|naming-strategy)'
printf '\n## Entity files\n'
for f in src/ai/entities/ai-recommend.entitiy.ts src/diaries/entities/recommend.entity.ts; do
if [ -f "$f" ]; then
echo "---- $f"
cat -n "$f"
fi
done
printf '\n## Search for table/entity decorators and naming strategy\n'
rg -n "`@Entity`\\(|namingStrategy|snake_case|camelCase|tableName|Recommend|recommend" src . --glob '!node_modules' --glob '!dist' --glob '!build' --glob '!coverage' | sed -n '1,240p'Repository: TEAM-DAILOG/BE Length of output: 5731 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n## package.json\n'
cat -n package.json
printf '\n## app.module.ts\n'
cat -n src/app.module.ts
printf '\n## AI module files\n'
git ls-files 'src/ai/**' | sed -n '1,200p'
printf '\n## AI module and related imports\n'
rg -n "AiModule|TypeOrmModule.forFeature|entities:" src/ai src/app.module.ts src/**/*.module.ts --glob '!node_modules' --glob '!dist' --glob '!build' | sed -n '1,240p'Repository: TEAM-DAILOG/BE Length of output: 5428 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n## ai.module.ts\n'
cat -n src/ai/ai.module.ts
printf '\n## diaries.module.ts\n'
cat -n src/diaries/diary.module.ts
printf '\n## search for repository usage of AI recommend entity\n'
rg -n "ai-recommend|RecommendEntity|recommendId|isAdded|categoryId|diaryId" src/ai src/diaries src --glob '!node_modules' --glob '!dist' --glob '!build' | sed -n '1,240p'Repository: TEAM-DAILOG/BE Length of output: 3209 🌐 Web query:
💡 Result: In TypeORM, the Naming Strategy and explicit Citations:
테이블명을 하나로 통일하세요. 🤖 Prompt for AI Agents |
||
| @PrimaryGeneratedColumn({ | ||
| name: 'recommend_id', | ||
| type: 'int', | ||
| comment: '추천ID', | ||
| }) | ||
| recommendId: number; | ||
|
|
||
| @Column({ | ||
| name: 'title', | ||
| type: 'varchar', | ||
| length: 500, | ||
| nullable: false, | ||
| comment: '추천 일정 제목', | ||
| }) | ||
| title: string; | ||
|
|
||
| @Column({ | ||
| name: 'is_added', | ||
| type: 'boolean', | ||
| nullable: false, | ||
| default: false, | ||
| comment: '일정 추가 여부', | ||
| }) | ||
| isAdded: boolean; | ||
|
|
||
| @CreateDateColumn({ | ||
| name: 'created_at', | ||
| type: 'timestamp', | ||
| nullable: false, | ||
| comment: '생성일자', | ||
| }) | ||
| createdAt: Date; | ||
| } | ||
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.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
AiModule의 엔티티 import 경로와 실제 파일명이 일치하지 않습니다.제공된
src/ai/ai.module.ts는./entities/ai.question.entity,./entities/ai.answer.entity,./entities/ai.diary.question.entity를 import하지만 실제 파일명은 하이픈 기반입니다. 이 상태에서는 모듈 해석이 실패합니다. 세 import 경로를 실제 파일명에 맞추고, 이 파일은ai-diary-question.entity.ts로 변경해 kebab-case 규칙도 충족하세요.권장 수정
🤖 Prompt for AI Agents
Sources: Coding guidelines, Path instructions