Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export abstract class Content {
- @PrimaryGeneratedColumn()
- id: number;
- @Column()
- title: string;
- @Column()
- description: string;
- }
- @Entity()
- export class Photo extends Content {
- @Column()
- size: string;
- }
- @Entity()
- export class Question extends Content {
- @Column()
- answersCount: number;
- }
- @Entity()
- export class Post extends Content {
- @Column()
- viewCount: number;
- }
- export abstract class Content {
- @PrimaryGeneratedColumn()
- id: number;
- @Column()
- title: string;
- @Column()
- description: string;
- // WOULD LIKE TO ADD SOMETHING LIKE THIS ...
- @ManyToOne(() => User, user => user.createdContent)
- createdBy: User
- }
- @Entity()
- export default class User {
- // AND THIS ...
- @OneToMany(() => Content, content => content.authoredBy)
- authoredContent: Content[]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement