test: remove unused type parameter from decorators (#11412)

Remove unused `type` parameter from functions supplied to decorators in tests and sample code. This resolves 477 eslint unused var warnings.

All changes are modifying functions in test or sample code of the following style:

1. `@OneToMany((type) => Entity, ...)` to `@OneToMany(() => Entity)`
2. `@ManyToOne((type) => Entity, ...)`
3. `@ManyToMany((type) => Entity, ...)`
4. `@OneToOne((type) => Entity, ...) `

Note that we don't actually ever call this function with an argument.
This commit is contained in:
Mike Guida 2025-04-14 09:25:31 -06:00 committed by GitHub
parent c15cb077a7
commit 45577df8b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
316 changed files with 479 additions and 483 deletions

View File

@ -16,9 +16,9 @@ export class Category {
@Column()
description: string
@ManyToMany((type) => Post, (post) => post.categories)
@ManyToMany(() => Post, (post) => post.categories)
posts: Post[]
@ManyToOne((type) => PostDetails, (postDetails) => postDetails.categories)
@ManyToOne(() => PostDetails, (postDetails) => postDetails.categories)
details: PostDetails
}

View File

@ -14,6 +14,6 @@ export class Chapter {
@Column()
about: string
@OneToMany((type) => PostDetails, (postDetails) => postDetails.chapter)
@OneToMany(() => PostDetails, (postDetails) => postDetails.chapter)
postDetails: PostDetails[]
}

View File

@ -14,6 +14,6 @@ export class Cover {
@Column()
url: string
@OneToMany((type) => Post, (post) => post.cover)
@OneToMany(() => Post, (post) => post.cover)
posts: Post[]
}

View File

@ -17,15 +17,15 @@ export class Image {
@Column()
name: string
@ManyToOne((type) => Post, (post) => post.images)
@ManyToOne(() => Post, (post) => post.images)
post: Post
@ManyToOne((type) => Post, (post) => post.secondaryImages, {
@ManyToOne(() => Post, (post) => post.secondaryImages, {
cascade: ["insert"],
})
secondaryPost: Post
@OneToOne((type) => ImageDetails, (details) => details.image, {
@OneToOne(() => ImageDetails, (details) => details.image, {
cascade: true,
})
@JoinColumn()

View File

@ -17,6 +17,6 @@ export class ImageDetails {
@Column()
comment: string
@OneToOne((type) => Image, (image) => image.details)
@OneToOne(() => Image, (image) => image.details)
image: Image
}

View File

@ -29,21 +29,21 @@ export class Post {
})
text: string
@OneToOne((type) => PostDetails, (details) => details.post, {
@OneToOne(() => PostDetails, (details) => details.post, {
cascade: true,
})
@JoinColumn()
details: PostDetails
@OneToMany((type) => Image, (image) => image.post, {
@OneToMany(() => Image, (image) => image.post, {
cascade: true,
})
images: Image[] = []
@OneToMany((type) => Image, (image) => image.secondaryPost)
@OneToMany(() => Image, (image) => image.secondaryPost)
secondaryImages: Image[]
@ManyToOne((type) => Cover, (cover) => cover.posts, {
@ManyToOne(() => Cover, (cover) => cover.posts, {
cascade: ["insert"],
})
@JoinColumn({ name: "coverId" })
@ -54,7 +54,7 @@ export class Post {
})
coverId: number
@ManyToMany((type) => Category, (category) => category.posts, {
@ManyToMany(() => Category, (category) => category.posts, {
cascade: true,
})
@JoinTable()

View File

@ -21,15 +21,15 @@ export class PostDetails {
@Column()
comment: string
@OneToOne((type) => Post, (post) => post.details)
@OneToOne(() => Post, (post) => post.details)
post: Post
@OneToMany((type) => Category, (category) => category.details, {
@OneToMany(() => Category, (category) => category.details, {
cascade: ["insert"],
})
categories: Category[]
@ManyToOne((type) => Chapter, (chapter) => chapter.postDetails, {
@ManyToOne(() => Chapter, (chapter) => chapter.postDetails, {
cascade: ["insert"],
})
chapter: Chapter

View File

@ -13,7 +13,7 @@ export class BaseObject extends BasePost {
@Column()
title: string
@ManyToOne((type) => PostAuthor, (post) => post.posts, {
@ManyToOne(() => PostAuthor, (post) => post.posts, {
cascade: true,
})
author: PostAuthor

View File

@ -11,6 +11,6 @@ export class PostAuthor extends PostUser {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.author)
@OneToMany(() => Post, (post) => post.author)
posts: Post[]
}

View File

@ -21,14 +21,14 @@ export class Post {
@Column()
text: string
@OneToOne((type) => PostAuthor, (author) => author.post, {
@OneToOne(() => PostAuthor, (author) => author.post, {
cascade: true,
})
@JoinColumn() // comment this and you'll get an error because JoinColumn must be at least on one side of the one-to-one relationship
// @JoinTable() // uncomment this and you'll get an error because JoinTable is not allowed here (only many-to-many)
author: PostAuthor
@OneToMany((type) => PostAuthor, (author) => author.editedPost, {
@OneToMany(() => PostAuthor, (author) => author.editedPost, {
cascade: true,
})
// @JoinColumn() // uncomment this and you'll get an error, because JoinColumn is not allowed here (only many-to-one/one-to-one)

View File

@ -16,15 +16,15 @@ export class PostAuthor {
@Column()
name: string
@OneToOne((type) => Post, (post) => post.author)
@OneToOne(() => Post, (post) => post.author)
// @JoinColumn() // uncomment this and it will case an error, because JoinColumn is allowed only on one side
post: Post
@ManyToOne((type) => Post, (post) => post.editors)
@ManyToOne(() => Post, (post) => post.editors)
// @JoinColumn() // JoinColumn is optional here, so if it present or not you should not get an error
editedPost: Post
@ManyToMany((type) => Post, (post) => post.manyAuthors)
@ManyToMany(() => Post, (post) => post.manyAuthors)
// @JoinTable() // uncomment this and it will case an error, because only one side of the ManyToMany relation can have a JoinTable decorator.
manyPosts: Post[]
}

View File

@ -10,7 +10,7 @@ export class Author {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.author, {
@OneToMany(() => Post, (post) => post.author, {
cascade: true,
})
posts: Promise<Post[]>

View File

@ -16,13 +16,13 @@ export class Post {
@Column()
text: string
@ManyToOne((type) => Author, (author) => author.posts, {
@ManyToOne(() => Author, (author) => author.posts, {
cascade: ["insert"],
onDelete: "SET NULL",
})
author: Promise<Author | null>
@ManyToMany((type) => Category, (category) => category.posts, {
@ManyToMany(() => Category, (category) => category.posts, {
cascade: true,
})
@JoinTable()

View File

@ -19,14 +19,14 @@ export class Post {
@Column()
text: string
@ManyToOne((type) => Author, { cascade: true })
@ManyToOne(() => Author, { cascade: true })
author: Author
@ManyToMany((type) => Category, { cascade: true })
@ManyToMany(() => Category, { cascade: true })
@JoinTable()
categories: Category[]
@OneToOne((type) => PostMetadata, { cascade: true })
@OneToOne(() => PostMetadata, { cascade: true })
@JoinColumn()
metadata: PostMetadata
}

View File

@ -24,7 +24,7 @@ export class Post {
text: string
// post has relation with category, however inverse relation is not set (category does not have relation with post set)
@OneToOne((type) => PostCategory, {
@OneToOne(() => PostCategory, {
cascade: true,
})
@JoinColumn()
@ -32,7 +32,7 @@ export class Post {
// post has relation with details. cascade inserts here means if new PostDetails instance will be set to this
// relation it will be inserted automatically to the db when you save this Post entity
@OneToOne((type) => PostDetails, (details) => details.post, {
@OneToOne(() => PostDetails, (details) => details.post, {
cascade: ["insert"],
})
@JoinColumn()
@ -40,7 +40,7 @@ export class Post {
// post has relation with details. cascade update here means if new PostDetail instance will be set to this relation
// it will be inserted automatically to the db when you save this Post entity
@OneToOne((type) => PostImage, (image) => image.post, {
@OneToOne(() => PostImage, (image) => image.post, {
cascade: ["update"],
})
@JoinColumn()
@ -48,19 +48,19 @@ export class Post {
// post has relation with details. cascade update here means if new PostDetail instance will be set to this relation
// it will be inserted automatically to the db when you save this Post entity
@OneToOne((type) => PostMetadata, (metadata) => metadata.post)
@OneToOne(() => PostMetadata, (metadata) => metadata.post)
@JoinColumn()
metadata: PostMetadata | null
// post has relation with details. full cascades here
@OneToOne((type) => PostInformation, (information) => information.post, {
@OneToOne(() => PostInformation, (information) => information.post, {
cascade: true,
})
@JoinColumn()
information: PostInformation
// post has relation with details. not cascades here. means cannot be persisted, updated or removed
@OneToOne((type) => PostAuthor, (author) => author.post)
@OneToOne(() => PostAuthor, (author) => author.post)
@JoinColumn()
author: PostAuthor
}

View File

@ -14,6 +14,6 @@ export class PostAuthor {
@Column()
name: string
@OneToOne((type) => Post, (post) => post.author)
@OneToOne(() => Post, (post) => post.author)
post: Post
}

View File

@ -20,7 +20,7 @@ export class PostDetails {
@Column()
metadata: string
@OneToOne((type) => Post, (post) => post.details, {
@OneToOne(() => Post, (post) => post.details, {
cascade: true,
})
post: Post

View File

@ -14,6 +14,6 @@ export class PostImage {
@Column()
url: string
@OneToOne((type) => Post, (post) => post.image)
@OneToOne(() => Post, (post) => post.image)
post: Post
}

View File

@ -14,7 +14,7 @@ export class PostInformation {
@Column()
text: string
@OneToOne((type) => Post, (post) => post.information, {
@OneToOne(() => Post, (post) => post.information, {
cascade: ["update"],
})
post: Post

View File

@ -14,6 +14,6 @@ export class PostMetadata {
@Column()
description: string
@OneToOne((type) => Post, (post) => post.metadata)
@OneToOne(() => Post, (post) => post.metadata)
post: Post
}

View File

@ -10,7 +10,7 @@ export class Author {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.author, {
@OneToMany(() => Post, (post) => post.author, {
cascade: true,
})
posts: Post[]

View File

@ -17,7 +17,7 @@ export class Post {
@Column()
text: string
@ManyToOne((type) => Author, (author) => author.posts, {
@ManyToOne(() => Author, (author) => author.posts, {
cascade: true,
})
@JoinColumn({
@ -26,7 +26,7 @@ export class Post {
})
author: Author
@ManyToMany((type) => Category, (category) => category.posts, {
@ManyToMany(() => Category, (category) => category.posts, {
cascade: true,
})
@JoinTable({

View File

@ -16,12 +16,12 @@ export class Post {
@Column()
text: string
@ManyToMany((type) => Category, {
@ManyToMany(() => Category, {
cascade: true,
})
@JoinTable()
categories: Category[]
@ManyToOne((type) => Author, { cascade: ["insert"] })
@ManyToOne(() => Author, { cascade: ["insert"] })
author: Author | null
}

View File

@ -10,6 +10,6 @@ export class Author {
@Column()
name: string
@OneToMany((type) => Post, (author) => author.author)
@OneToMany(() => Post, (author) => author.author)
posts: Post[]
}

View File

@ -13,6 +13,6 @@ export class Post {
@Column()
text: string
@ManyToOne((type) => Author, (author) => author.posts)
@ManyToOne(() => Author, (author) => author.posts)
author: Author
}

View File

@ -23,37 +23,37 @@ export class Post {
text: string
// post has relation with category, however inverse relation is not set (category does not have relation with post set)
@ManyToOne((type) => PostCategory, {
@ManyToOne(() => PostCategory, {
cascade: true,
})
category: PostCategory
// post has relation with details. cascade inserts here means if new PostDetails instance will be set to this
// relation it will be inserted automatically to the db when you save this Post entity
@ManyToOne((type) => PostDetails, (details) => details.posts, {
@ManyToOne(() => PostDetails, (details) => details.posts, {
cascade: ["insert"],
})
details?: PostDetails
// post has relation with details. cascade update here means if new PostDetail instance will be set to this relation
// it will be inserted automatically to the db when you save this Post entity
@ManyToOne((type) => PostImage, (image) => image.posts, {
@ManyToOne(() => PostImage, (image) => image.posts, {
cascade: ["update"],
})
image: PostImage
// post has relation with details. cascade update here means if new PostDetail instance will be set to this relation
// it will be inserted automatically to the db when you save this Post entity
@ManyToOne((type) => PostMetadata, (metadata) => metadata.posts)
@ManyToOne(() => PostMetadata, (metadata) => metadata.posts)
metadata: PostMetadata | null
// post has relation with details. full cascades here
@ManyToOne((type) => PostInformation, (information) => information.posts, {
@ManyToOne(() => PostInformation, (information) => information.posts, {
cascade: true,
})
information: PostInformation
// post has relation with details. not cascades here. means cannot be persisted, updated or removed
@ManyToOne((type) => PostAuthor, (author) => author.posts)
@ManyToOne(() => PostAuthor, (author) => author.posts)
author: PostAuthor
}

View File

@ -14,6 +14,6 @@ export class PostAuthor {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.author)
@OneToMany(() => Post, (post) => post.author)
posts: Post[]
}

View File

@ -29,7 +29,7 @@ export class PostDetails {
})
metadata: string | null
@OneToMany((type) => Post, (post) => post.details, {
@OneToMany(() => Post, (post) => post.details, {
cascade: true,
})
posts: Post[]

View File

@ -14,6 +14,6 @@ export class PostImage {
@Column()
url: string
@OneToMany((type) => Post, (post) => post.image)
@OneToMany(() => Post, (post) => post.image)
posts: Post[]
}

View File

@ -14,7 +14,7 @@ export class PostInformation {
@Column()
text: string
@OneToMany((type) => Post, (post) => post.information, {
@OneToMany(() => Post, (post) => post.information, {
cascade: ["update"],
})
posts: Post[]

View File

@ -14,6 +14,6 @@ export class PostMetadata {
@Column()
description: string
@OneToMany((type) => Post, (post) => post.metadata)
@OneToMany(() => Post, (post) => post.metadata)
posts: Post[]
}

View File

@ -20,12 +20,12 @@ export class Post {
@Column()
text: string
@ManyToOne((type) => Author, {
@ManyToOne(() => Author, {
cascade: ["insert"],
})
author: Author
@ManyToMany((type) => Category, {
@ManyToMany(() => Category, {
cascade: ["insert"],
})
@JoinTable()

View File

@ -14,7 +14,7 @@ export class Post {
@Column()
title: string
@ManyToOne((type) => Author, {
@ManyToOne(() => Author, {
cascade: ["insert"],
})
author: Author

View File

@ -14,7 +14,7 @@ export class Post {
@Column()
title: string
@ManyToOne((type) => Author, {
@ManyToOne(() => Author, {
cascade: ["insert"],
})
author: Author

View File

@ -20,12 +20,12 @@ export class Post {
@Column()
text: string
@ManyToOne((type) => PostAuthor, (post) => post.posts, {
@ManyToOne(() => PostAuthor, (post) => post.posts, {
cascade: true,
})
author: PostAuthor
@ManyToMany((type) => PostCategory, (category) => category.posts, {
@ManyToMany(() => PostCategory, (category) => category.posts, {
cascade: true,
})
@JoinTable()

View File

@ -10,6 +10,6 @@ export class PostAuthor {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.author)
@OneToMany(() => Post, (post) => post.author)
posts: Post[]
}

View File

@ -11,12 +11,12 @@ export class Blog extends BasePost {
@Column()
text: string
@ManyToOne((type) => PostAuthor, (post) => post.posts, {
@ManyToOne(() => PostAuthor, (post) => post.posts, {
cascade: true,
})
author: PostAuthor
@ManyToMany((type) => PostCategory, (category) => category.posts, {
@ManyToMany(() => PostCategory, (category) => category.posts, {
cascade: true,
})
@JoinTable()

View File

@ -11,12 +11,12 @@ export class Post extends BasePost {
@Column()
text: string
@ManyToOne((type) => PostAuthor, (post) => post.posts, {
@ManyToOne(() => PostAuthor, (post) => post.posts, {
cascade: true,
})
author: PostAuthor
@ManyToMany((type) => PostCategory, (category) => category.posts, {
@ManyToMany(() => PostCategory, (category) => category.posts, {
cascade: true,
})
@JoinTable()

View File

@ -10,6 +10,6 @@ export class PostAuthor {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.author)
@OneToMany(() => Post, (post) => post.author)
posts: Post[]
}

View File

@ -20,12 +20,12 @@ export class Post {
@Column()
text: string
@ManyToOne((type) => PostAuthor, (post) => post.posts, {
@ManyToOne(() => PostAuthor, (post) => post.posts, {
cascade: true,
})
author: PostAuthor
@ManyToMany((type) => PostCategory, (category) => category.posts, {
@ManyToMany(() => PostCategory, (category) => category.posts, {
cascade: true,
})
@JoinTable()

View File

@ -10,6 +10,6 @@ export class PostAuthor {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.author)
@OneToMany(() => Post, (post) => post.author)
posts: Post[]
}

View File

@ -18,38 +18,34 @@ export class Category {
@Column()
name: string
@OneToOne((type) => Category, (category) => category.oneInverseCategory, {
@OneToOne(() => Category, (category) => category.oneInverseCategory, {
cascade: true,
})
@JoinColumn()
oneCategory: Category
@OneToOne((type) => Category, (category) => category.oneCategory, {
@OneToOne(() => Category, (category) => category.oneCategory, {
cascade: true,
})
oneInverseCategory: Category
@ManyToOne((type) => Category, (category) => category.oneManyCategories, {
@ManyToOne(() => Category, (category) => category.oneManyCategories, {
cascade: true,
})
oneManyCategory: Category
@OneToMany((type) => Category, (category) => category.oneManyCategory, {
@OneToMany(() => Category, (category) => category.oneManyCategory, {
cascade: true,
})
oneManyCategories: Category[]
@ManyToMany(
(type) => Category,
(category) => category.manyInverseCategories,
{
cascade: true,
},
)
@ManyToMany(() => Category, (category) => category.manyInverseCategories, {
cascade: true,
})
@JoinTable()
manyCategories: Category[]
@ManyToMany((type) => Category, (category) => category.manyCategories, {
@ManyToMany(() => Category, (category) => category.manyCategories, {
cascade: true,
})
manyInverseCategories: Category[]

View File

@ -20,7 +20,7 @@ export class PostAuthor {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.author)
@OneToMany(() => Post, (post) => post.author)
posts: Post[]
@BeforeInsert()

View File

@ -9,7 +9,7 @@ export class Eight {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => One)
@ManyToOne(() => One)
one: One
@Column({ type: "text" })

View File

@ -9,7 +9,7 @@ export class Five {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => One)
@ManyToOne(() => One)
one: One
@Column({ type: "text" })

View File

@ -9,7 +9,7 @@ export class Four {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => One)
@ManyToOne(() => One)
one: One
@Column({ type: "text" })

View File

@ -9,7 +9,7 @@ export class Nine {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => One)
@ManyToOne(() => One)
one: One
@Column({ type: "text" })

View File

@ -17,31 +17,31 @@ export class One {
@PrimaryGeneratedColumn()
id: number
@OneToOne((type) => Two, (two) => two.one)
@OneToOne(() => Two, (two) => two.one)
two: Two
@OneToOne((type) => Three, (three) => three.one)
@OneToOne(() => Three, (three) => three.one)
three: Three
@OneToOne((type) => Four, (four) => four.one)
@OneToOne(() => Four, (four) => four.one)
four: Four
@OneToOne((type) => Five, (five) => five.one)
@OneToOne(() => Five, (five) => five.one)
five: Five
@OneToOne((type) => Six, (six) => six.one)
@OneToOne(() => Six, (six) => six.one)
six: Six
@OneToOne((type) => Seven, (seven) => seven.one)
@OneToOne(() => Seven, (seven) => seven.one)
seven: Seven
@OneToOne((type) => Eight, (eight) => eight.one)
@OneToOne(() => Eight, (eight) => eight.one)
eight: Eight
@OneToOne((type) => Nine, (nine) => nine.one)
@OneToOne(() => Nine, (nine) => nine.one)
nine: Nine
@OneToOne((type) => Ten, (ten) => ten.one)
@OneToOne(() => Ten, (ten) => ten.one)
ten: Ten
@Column({ type: "text" })

View File

@ -9,7 +9,7 @@ export class Seven {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => One)
@ManyToOne(() => One)
one: One
@Column({ type: "text" })

View File

@ -9,7 +9,7 @@ export class Six {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => One)
@ManyToOne(() => One)
one: One
@Column({ type: "text" })

View File

@ -9,7 +9,7 @@ export class Ten {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => One)
@ManyToOne(() => One)
one: One
@Column({ type: "text" })

View File

@ -9,7 +9,7 @@ export class Three {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => One)
@ManyToOne(() => One)
one: One
@Column({ type: "text" })

View File

@ -9,7 +9,7 @@ export class Two {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => One)
@ManyToOne(() => One)
one: One
@Column({ type: "text" })

View File

@ -10,7 +10,7 @@ export class Post {
@PrimaryGeneratedColumn()
key: number
@OneToOne((type) => PostDetails, (details) => details.post, {
@OneToOne(() => PostDetails, (details) => details.post, {
cascade: ["insert"],
})
@JoinColumn()

View File

@ -8,7 +8,7 @@ export class PostDetails {
@PrimaryColumn()
keyword: string
@OneToOne((type) => Post, (post) => post.details, {
@OneToOne(() => Post, (post) => post.details, {
cascade: ["insert"],
})
post: Post

View File

@ -19,12 +19,12 @@ export class Comment {
@Column()
context: string
@OneToMany((type) => Comment, (comment) => comment.relay)
@OneToMany(() => Comment, (comment) => comment.relay)
reference?: Comment
@ManyToOne((type) => Comment, (comment) => comment.reference)
@ManyToOne(() => Comment, (comment) => comment.reference)
relay?: Comment
@ManyToOne((type) => Guest, (guest) => guest.comments)
@ManyToOne(() => Guest, (guest) => guest.comments)
author: Guest
}

View File

@ -12,6 +12,6 @@ export class Guest {
@Column()
username: string
@OneToMany((type) => Comment, (comment) => comment.author)
@OneToMany(() => Comment, (comment) => comment.author)
comments: Comment[]
}

View File

@ -20,6 +20,6 @@ export class Comment {
@Column()
context: string
@ManyToOne((type) => Guest, (guest) => guest.comments)
@ManyToOne(() => Guest, (guest) => guest.comments)
author: Guest
}

View File

@ -12,6 +12,6 @@ export class Guest {
@Column()
username: string
@OneToMany((type) => Comment, (comment) => comment.author)
@OneToMany(() => Comment, (comment) => comment.author)
comments: Comment[]
}

View File

@ -18,10 +18,10 @@ export class Category {
@Column()
isRemoved: boolean = false
@ManyToOne((type) => Post, (post) => post.categories)
@ManyToOne(() => Post, (post) => post.categories)
post: Post
@OneToMany((type) => Image, (image) => image.category)
@OneToMany(() => Image, (image) => image.category)
images: Image[]
@RelationCount((category: Category) => category.images)

View File

@ -15,6 +15,6 @@ export class Image {
@Column()
isRemoved: boolean = false
@ManyToOne((type) => Category, (category) => category.images)
@ManyToOne(() => Category, (category) => category.images)
category: Category
}

View File

@ -13,7 +13,7 @@ export class Post {
@Column()
title: string
@OneToMany((type) => Category, (category) => category.post)
@OneToMany(() => Category, (category) => category.post)
categories: Category[]
@RelationCount((post: Post) => post.categories)

View File

@ -14,11 +14,11 @@ export class Post {
@Column()
title: string
@ManyToOne((type) => Category)
@ManyToOne(() => Category)
@JoinColumn()
category: Category
@ManyToOne((type) => Category)
@ManyToOne(() => Category)
@JoinColumn({ referencedColumnName: "name" })
categoryByName: Category

View File

@ -13,7 +13,7 @@ export class Category {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.category)
@OneToMany(() => Post, (post) => post.category)
posts: Post[]
@RelationId((category: Category) => category.posts)

View File

@ -15,7 +15,7 @@ export class Post {
@Column()
isRemoved: boolean = false
@ManyToOne((type) => Category)
@ManyToOne(() => Category)
category: Category
categoryId: number

View File

@ -13,7 +13,7 @@ export class Category {
@Column({ unique: true })
name: string
@OneToOne((type) => Post, (post) => post.category2)
@OneToOne(() => Post, (post) => post.category2)
post: Post
@RelationId((category: Category) => category.post)

View File

@ -14,15 +14,15 @@ export class Post {
@Column()
title: string
@OneToOne((type) => Category)
@OneToOne(() => Category)
@JoinColumn()
category: Category
@OneToOne((type) => Category)
@OneToOne(() => Category)
@JoinColumn({ referencedColumnName: "name" })
categoryByName: Category
@OneToOne((type) => Category, (category) => category.post)
@OneToOne(() => Category, (category) => category.post)
@JoinColumn()
category2: Category

View File

@ -20,7 +20,7 @@ export class Counters {
@Column(() => Subcounters, { prefix: "subcnt" })
subcounters: Subcounters
@ManyToOne((type) => User)
@ManyToOne(() => User)
@JoinColumn()
likedUser: User
}

View File

@ -12,6 +12,6 @@ export class User {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.counters.likedUser)
@OneToMany(() => Post, (post) => post.counters.likedUser)
likedPosts: Post[]
}

View File

@ -19,6 +19,6 @@ export class Counters {
@Column(() => Subcounters, { prefix: "subcnt" })
subcounters: Subcounters
@OneToMany((type) => User, (user) => user.likedPost)
@OneToMany(() => User, (user) => user.likedPost)
likedUsers: User[]
}

View File

@ -13,7 +13,7 @@ export class User {
@Column()
name: string
@ManyToOne((type) => Post)
@ManyToOne(() => Post)
@JoinColumn()
likedPost: Post
}

View File

@ -21,7 +21,7 @@ export class Counters {
@Column(() => Subcounters, { prefix: "subcnt" })
subcounters: Subcounters
@ManyToOne((type) => User)
@ManyToOne(() => User)
@JoinColumn()
likedUser: User
}

View File

@ -12,6 +12,6 @@ export class User {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.counters.likedUser)
@OneToMany(() => Post, (post) => post.counters.likedUser)
likedPosts: Post[]
}

View File

@ -20,7 +20,7 @@ export class Counters {
@Column(() => Subcounters, { prefix: "subcnt" })
subcounters: Subcounters
@ManyToOne((type) => User)
@ManyToOne(() => User)
@JoinColumn()
likedUser: User
}

View File

@ -15,6 +15,6 @@ export class User {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.counters.likedUser)
@OneToMany(() => Post, (post) => post.counters.likedUser)
likedPosts: Post[]
}

View File

@ -21,7 +21,7 @@ export class Counters {
@Column(() => Subcounters, { prefix: "subcnt" })
subcounters: Subcounters
@ManyToOne((type) => User)
@ManyToOne(() => User)
@JoinColumn()
likedUser: User
}

View File

@ -15,6 +15,6 @@ export class User {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.counters.likedUser)
@OneToMany(() => Post, (post) => post.counters.likedUser)
likedPosts: Post[]
}

View File

@ -14,7 +14,7 @@ export class Post {
@Column()
title: string
@OneToOne((type) => Category)
@OneToOne(() => Category)
category: Category
@ManyToMany((type) => Category)

View File

@ -12,6 +12,6 @@ export class Image {
@Column()
title: string
@OneToMany((type) => ImageInfo, (imageInfo) => imageInfo.image)
@OneToMany(() => ImageInfo, (imageInfo) => imageInfo.image)
informations: ImageInfo[] = []
}

View File

@ -12,6 +12,6 @@ export class ImageInfo {
@Column()
name: string
@ManyToOne((type) => Image, (image) => image.informations)
@ManyToOne(() => Image, (image) => image.informations)
image: Image
}

View File

@ -15,7 +15,7 @@ export class Post {
@Column()
title: string
@OneToOne((type) => Category)
@OneToOne(() => Category)
@JoinColumn()
category: Category

View File

@ -21,7 +21,7 @@ export class Post {
@Column()
description: string
@ManyToOne((type) => Category)
@ManyToOne(() => Category)
category: Category
@Column("simple-json", { nullable: true })

View File

@ -12,6 +12,6 @@ export class Category {
@Column()
name: string
@ManyToOne((type) => Post)
@ManyToOne(() => Post)
post: Post
}

View File

@ -12,6 +12,6 @@ export class Category {
@Column()
name: string
@ManyToOne((type) => Post)
@ManyToOne(() => Post)
post: Post
}

View File

@ -10,13 +10,13 @@ export class Profile {
@PrimaryColumn()
id: number
@OneToOne((type) => User, (user) => user.profile, {
@OneToOne(() => User, (user) => user.profile, {
nullable: false,
})
@JoinColumn()
user: User
@OneToOne((type) => Photo, {
@OneToOne(() => Photo, {
nullable: false,
cascade: ["insert"],
})

View File

@ -12,7 +12,7 @@ export class User {
@Column()
name: string
@OneToOne((type) => Profile, (profile) => profile.user, {
@OneToOne(() => Profile, (profile) => profile.user, {
cascade: ["insert"],
})
profile: Profile

View File

@ -10,19 +10,19 @@ export class Answer {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => Question, (question) => question.answers, {
@ManyToOne(() => Question, (question) => question.answers, {
cascade: ["insert"],
nullable: false,
})
question: Question
@ManyToOne((type) => Photo, {
@ManyToOne(() => Photo, {
cascade: ["insert"],
nullable: false,
})
photo: Photo
@ManyToOne((type) => User, {
@ManyToOne(() => User, {
cascade: ["insert"],
nullable: false,
})

View File

@ -12,7 +12,7 @@ export class Question {
@Column({ default: "My question" })
name: string
@OneToMany((type) => Answer, (answer) => answer.question, {
@OneToMany(() => Answer, (answer) => answer.question, {
cascade: ["insert"],
})
answers: Answer[]

View File

@ -8,7 +8,7 @@ export class User {
@PrimaryGeneratedColumn()
id: number
@ManyToOne((type) => Question, {
@ManyToOne(() => Question, {
cascade: ["insert"],
nullable: true,
})

View File

@ -12,7 +12,7 @@ export class Photo {
@Column()
name: string
@ManyToOne((type) => User, (user) => user.manyPhotos)
@ManyToOne(() => User, (user) => user.manyPhotos)
user: User
constructor(name: string) {

View File

@ -16,7 +16,7 @@ export class User {
@Column()
name: string
@OneToMany((type) => Photo, (photo) => photo.user, { cascade: true })
@OneToMany(() => Photo, (photo) => photo.user, { cascade: true })
manyPhotos: Photo[]
@ManyToMany((type) => Photo, { cascade: true })

View File

@ -16,7 +16,7 @@ export class Photo {
@DeleteDateColumn()
deletedAt: Date
@ManyToOne((type) => User, (user) => user.manyPhotos)
@ManyToOne(() => User, (user) => user.manyPhotos)
user: User
constructor(name: string) {

View File

@ -20,7 +20,7 @@ export class User {
@DeleteDateColumn()
deletedAt: Date
@OneToMany((type) => Photo, (photo) => photo.user, { cascade: true })
@OneToMany(() => Photo, (photo) => photo.user, { cascade: true })
manyPhotos: Photo[]
@ManyToMany((type) => Photo, { cascade: true })

View File

@ -14,7 +14,7 @@ export class Category {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.category, {
@OneToMany(() => Post, (post) => post.category, {
cascade: ["insert"],
})
posts: Post[]

View File

@ -14,7 +14,7 @@ export class Post {
@Column()
title: string
@ManyToOne((type) => Category, (category) => category.posts, {
@ManyToOne(() => Category, (category) => category.posts, {
cascade: ["insert"],
})
category: Category

View File

@ -12,13 +12,13 @@ export class Category {
@PrimaryGeneratedColumn()
id: number
@OneToMany((type) => Post, (post) => post.category)
@OneToMany(() => Post, (post) => post.category)
posts: Post[]
@Column({ type: "int", nullable: true })
metadataId: number
@OneToOne((type) => CategoryMetadata, (metadata) => metadata.category, {
@OneToOne(() => CategoryMetadata, (metadata) => metadata.category, {
cascade: ["insert"],
})
@JoinColumn({ name: "metadataId" })

View File

@ -12,6 +12,6 @@ export class CategoryMetadata {
@Column()
keyword: string
@OneToOne((type) => Category, (category) => category.metadata)
@OneToOne(() => Category, (category) => category.metadata)
category: Category
}

View File

@ -16,7 +16,7 @@ export class Post {
@Column("int", { nullable: true })
categoryId: number
@ManyToOne((type) => Category, (category) => category.posts, {
@ManyToOne(() => Category, (category) => category.posts, {
cascade: true,
})
@JoinColumn({ name: "categoryId" })

View File

@ -12,6 +12,6 @@ export class Category {
@Column()
name: string
@OneToMany((type) => Post, (post) => post.category)
@OneToMany(() => Post, (post) => post.category)
posts: Post[]
}

View File

@ -12,6 +12,6 @@ export class Post {
@Column()
title: string
@ManyToOne((type) => Category, (category) => category.posts)
@ManyToOne(() => Category, (category) => category.posts)
category: Category
}

Some files were not shown because too many files have changed in this diff Show More