-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Model rsc assessment and category tables; add OneToMany relation betw…
…een user and assessment; update question and resource column names.
- Loading branch information
1 parent
b3d4aff
commit 8e654b5
Showing
7 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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,29 @@ | ||
import { | ||
BaseEntity, | ||
CreateDateColumn, | ||
Entity, | ||
ManyToOne, | ||
OneToMany, | ||
PrimaryGeneratedColumn, | ||
UpdateDateColumn | ||
} from 'typeorm'; | ||
import { User } from './user'; | ||
import { RscQuestion } from './rsc_question'; | ||
|
||
@Entity() | ||
export class RscAssessment extends BaseEntity { | ||
@PrimaryGeneratedColumn('uuid') | ||
id: string; | ||
|
||
@CreateDateColumn() | ||
createdAt: Date; | ||
|
||
@UpdateDateColumn() | ||
updatedAt: Date; | ||
|
||
@ManyToOne(() => User, (user) => user.assessments) | ||
user: User; | ||
|
||
@OneToMany(() => RscQuestion, (question) => question.assessment) | ||
questions: RscQuestion[]; | ||
} |
This file contains 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,20 @@ | ||
import { | ||
BaseEntity, | ||
Column, | ||
Entity, | ||
OneToMany, | ||
PrimaryGeneratedColumn | ||
} from 'typeorm'; | ||
import { RscQuestion } from './rsc_question'; | ||
|
||
@Entity() | ||
export class RscCategory extends BaseEntity { | ||
@PrimaryGeneratedColumn('uuid') | ||
id: string; | ||
|
||
@Column() | ||
name: string; | ||
|
||
@OneToMany(() => RscQuestion, (question) => question.category) | ||
questions: RscQuestion[]; | ||
} |
This file contains 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 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 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