|
| 1 | +import { |
| 2 | + Column, |
| 3 | + Entity, |
| 4 | + Index, |
| 5 | + JoinColumn, |
| 6 | + ManyToOne, |
| 7 | + OneToOne, |
| 8 | +} from "typeorm"; |
| 9 | +import { PrivacyTbl } from "./PrivacyTbl"; |
| 10 | +import { Questions } from "./Questions"; |
| 11 | +import { UserTodayResponse } from "./UserTodayResponse"; |
| 12 | +import { UserAnswerAnalysis } from "./UserAnswerAnalysis"; |
| 13 | + |
| 14 | +@Index("fk_privacy_state_id_idx", ["fkPrivacyStateId"], {}) |
| 15 | +@Index("fk_question_id_fora_idx", ["fkQuestionId"], {}) |
| 16 | +@Index("fk_response_id_for_answer_idx", ["fkResponseId"], {}) |
| 17 | +@Entity("answer_tbl", { schema: "delimo" }) |
| 18 | +export class AnswerTbl { |
| 19 | + @Column("int", { primary: true, name: "id" }) |
| 20 | + id: number; |
| 21 | + |
| 22 | + @Column("int", { name: "fk_question_id" }) |
| 23 | + fkQuestionId: number; |
| 24 | + |
| 25 | + @Column("date", { name: "created_at" }) |
| 26 | + createdAt: string; |
| 27 | + |
| 28 | + @Column("int", { name: "fk_privacy_state_id" }) |
| 29 | + fkPrivacyStateId: number; |
| 30 | + |
| 31 | + @Column("text", { name: "content" }) |
| 32 | + content: string; |
| 33 | + |
| 34 | + @Column("int", { primary: true, name: "fk_response_id" }) |
| 35 | + fkResponseId: number; |
| 36 | + |
| 37 | + @ManyToOne(() => PrivacyTbl, (privacyTbl) => privacyTbl.answerTbls, { |
| 38 | + onDelete: "NO ACTION", |
| 39 | + onUpdate: "NO ACTION", |
| 40 | + }) |
| 41 | + @JoinColumn([{ name: "fk_privacy_state_id", referencedColumnName: "id" }]) |
| 42 | + fkPrivacyState: PrivacyTbl; |
| 43 | + |
| 44 | + @ManyToOne(() => Questions, (questions) => questions.answerTbls, { |
| 45 | + onDelete: "NO ACTION", |
| 46 | + onUpdate: "NO ACTION", |
| 47 | + }) |
| 48 | + @JoinColumn([{ name: "fk_question_id", referencedColumnName: "id" }]) |
| 49 | + fkQuestion: Questions; |
| 50 | + |
| 51 | + @ManyToOne( |
| 52 | + () => UserTodayResponse, |
| 53 | + (userTodayResponse) => userTodayResponse.answerTbls, |
| 54 | + { onDelete: "NO ACTION", onUpdate: "NO ACTION" } |
| 55 | + ) |
| 56 | + @JoinColumn([{ name: "fk_response_id", referencedColumnName: "id" }]) |
| 57 | + fkResponse: UserTodayResponse; |
| 58 | + |
| 59 | + @OneToOne( |
| 60 | + () => UserAnswerAnalysis, |
| 61 | + (userAnswerAnalysis) => userAnswerAnalysis.fkAnswer |
| 62 | + ) |
| 63 | + userAnswerAnalysis: UserAnswerAnalysis; |
| 64 | +} |
0 commit comments