From 69dfc42eb90170a203004be49a986880095c98ab Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Sun, 9 Nov 2025 21:54:19 +0100 Subject: [PATCH] lint: fix offenses for @typescript-eslint/no-unused-vars rule in samples folder (#11757) --- sample/sample1-simple-entity/app.ts | 2 +- sample/sample10-mixed/app.ts | 131 +----------------- sample/sample11-all-types-entity/app.ts | 4 +- sample/sample12-custom-naming-strategy/app.ts | 4 +- sample/sample13-everywhere-abstraction/app.ts | 2 +- .../entity/Blog.ts | 2 +- .../entity/Post.ts | 2 +- .../entity/PostCategory.ts | 2 +- .../sample14-errors-in-wrong-metdata/app.ts | 4 +- .../entity/Post.ts | 2 +- sample/sample16-indexes/app.ts | 2 +- sample/sample17-versioning/app.ts | 2 +- sample/sample18-lazy-relations/app.ts | 15 +- .../entity/Category.ts | 2 +- sample/sample19-one-side-relations/app.ts | 62 +-------- sample/sample2-one-to-one/app.ts | 4 +- sample/sample20-join-without-relation/app.ts | 58 +------- .../entity/Post.ts | 2 +- .../sample21-custom-join-table-column/app.ts | 4 +- .../entity/Category.ts | 2 +- sample/sample22-closure-table/app.ts | 4 +- sample/sample23-nested-joins/app.ts | 12 +- .../sample23-nested-joins/entity/Category.ts | 2 +- .../sample25-insert-from-inverse-side/app.ts | 6 +- sample/sample26-embedded-tables/app.ts | 2 +- .../sample26-embedded-tables/entity/Post.ts | 2 +- .../entity/Question.ts | 2 +- sample/sample27-composite-primary-keys/app.ts | 2 +- .../sample28-single-table-inheritance/app.ts | 2 +- sample/sample3-many-to-one/app.ts | 9 +- sample/sample30-default-order-by/app.ts | 2 +- .../sample30-default-order-by/entity/Post.ts | 2 +- sample/sample31-table-prefix/app.ts | 2 +- sample/sample32-migrations/app.ts | 2 +- sample/sample34-mongodb/app.ts | 2 +- sample/sample4-many-to-many/app.ts | 4 +- sample/sample4-many-to-many/entity/Post.ts | 12 +- .../sample4-many-to-many/entity/PostAuthor.ts | 2 +- .../entity/PostDetails.ts | 2 +- .../sample4-many-to-many/entity/PostImage.ts | 2 +- .../entity/PostInformation.ts | 2 +- .../entity/PostMetadata.ts | 2 +- sample/sample5-subscribers/app.ts | 4 +- .../entity/PostCategory.ts | 2 +- sample/sample6-abstract-table/app.ts | 2 +- .../entity/PostCategory.ts | 2 +- sample/sample7-pagination/app.ts | 4 +- .../sample7-pagination/entity/PostCategory.ts | 2 +- sample/sample8-self-referencing/app.ts | 2 +- sample/sample9-entity-listeners/app.ts | 4 +- .../entity/PostCategory.ts | 2 +- 51 files changed, 80 insertions(+), 331 deletions(-) diff --git a/sample/sample1-simple-entity/app.ts b/sample/sample1-simple-entity/app.ts index 240aa033a..40a626edc 100644 --- a/sample/sample1-simple-entity/app.ts +++ b/sample/sample1-simple-entity/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" const options: DataSourceOptions = { diff --git a/sample/sample10-mixed/app.ts b/sample/sample10-mixed/app.ts index 58304f6c4..a92f126fc 100644 --- a/sample/sample10-mixed/app.ts +++ b/sample/sample10-mixed/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostDetails } from "./entity/PostDetails" import { Image } from "./entity/Image" @@ -49,136 +49,7 @@ dataSource postRepository .save(post) - .then((result) => { - /*const qb = postRepository.createQueryBuilder("post") - .leftJoinAndSelect("post.details", "details") - .leftJoinAndSelect("post.images", "images") - // .leftJoinAndSelect("post.coverId", "coverId") - .leftJoinAndSelect("post.categories", "categories") - .where("post.id=:id") - .setParameter("id", 6); - - return qb - .getSingleResult() - .then(post => { - console.log("loaded post: ", post); - - let category1 = new Category(); - category1.id = 12; - category1.description = "about cat#12"; - - let category2 = new Category(); - category2.id = 52; - category2.description = "about cat#52"; - - let image = new Image(); - image.name = "second image of the post"; - - //post - post.title = "This! is updated post$"; - post.text = "Hello world of post#4"; - post.categories = [category2, category1]; - post.images.push(image); - return postRepository.save(post); - - }) - .then(() => qb.getSingleResult()) - .then(reloadedPost => console.log("reloadedPost: ", reloadedPost));*/ - }) .then((result) => console.log(result)) .catch((error) => console.log(error.stack ? error.stack : error)) - - return - - /*const postJson = { - id: 1, // changed - text: "This is post about hello", // changed - title: "hello", // changed - details: { // new relation added - id: 10, // new object persisted - comment: "This is post about hello", - meta: "about-hello!", - chapter: { - id: 1, // new object persisted - about: "part I" - }, - categories: [{ - id: 5, // new object persisted - description: "cat5" - }] - }, - cover: null, // relation removed - images: [{ // new relation added - id: 4, // new object persisted - name: "post!.jpg", - secondaryPost: { - id: 2, - title: "secondary post" - } - }, { // secondaryPost relation removed - id: 3, - name: "post_2!.jpg", // changed - details: { // new relation added - id: 3, // new object persisted - meta: "sec image", - comment: "image sec" - } - }], - categories: [{ // two categories removed, new category added - id: 4, // new persisted - description: "cat2" - }] - }; - - let entity = postRepository.create(postJson); - return postRepository.initialize(postJson) - .then(result => { - const mergedEntity = postRepository.merge(result, entity); - console.log("entity created from json: ", entity); - console.log("entity initialized from db: ", result); - console.log("entity merged: ", mergedEntity); - const diff = postRepository.difference(result, mergedEntity); - console.log("diff: ", diff); - //console.log("diff[0]: ", diff[0].removedRelations); - }) - .catch(error => console.log(error.stack ? error.stack : error)); - - let qb = postRepository - .createQueryBuilder("post") - .addSelect("cover") - .addSelect("image") - .addSelect("imageDetails") - .addSelect("secondaryImage") - .addSelect("category") - .innerJoin("post.coverId", "cover") - .leftJoin("post.images", "image") - .leftJoin("post.secondaryImages", "secondaryImage") - .leftJoin("image.details", "imageDetails", "on", "imageDetails.meta=:meta") - .leftJoin("post.categories", "category", "on", "category.description=:description") - //.leftJoin(Image, "image", "on", "image.post=post.id") - //.where("post.id=:id") - .setParameter("id", 1) - .setParameter("description", "cat2") - .setParameter("meta", "sec image"); - - return qb - .getSingleResult() - .then(post => console.log(post)) - // .then(result => console.log(JSON.stringify(result, null, 4))) - .catch(error => console.log(error.stack ? error.stack : error));*/ - - /*let details = new PostDetails(); - details.comment = "This is post about hello"; - details.meta = "about-hello"; - - const post = new Post(); - post.text = "Hello how are you?"; - post.title = "hello"; - //post.details = details; - - postRepository - .save(post) - .then(post => console.log("Post has been saved")) - .catch(error => console.log("Cannot save. Error: ", error));*/ }) .catch((error) => console.log(error.stack ? error.stack : error)) diff --git a/sample/sample11-all-types-entity/app.ts b/sample/sample11-all-types-entity/app.ts index fb9901d45..d647aa621 100644 --- a/sample/sample11-all-types-entity/app.ts +++ b/sample/sample11-all-types-entity/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { EverythingEntity, SampleEnum } from "./entity/EverythingEntity" const options: DataSourceOptions = { @@ -99,7 +99,7 @@ dataSource.initialize().then( console.log("Now remove it") return postRepository.remove(entity!) }) - .then((entity) => { + .then(() => { console.log("Entity has been removed") }) .catch((error) => diff --git a/sample/sample12-custom-naming-strategy/app.ts b/sample/sample12-custom-naming-strategy/app.ts index ff6d002cd..9e7b78aed 100644 --- a/sample/sample12-custom-naming-strategy/app.ts +++ b/sample/sample12-custom-naming-strategy/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { CustomNamingStrategy } from "./naming-strategy/CustomNamingStrategy" @@ -26,7 +26,7 @@ dataSource.initialize().then( postRepository .save(post) - .then((post) => console.log("Post has been saved")) + .then(() => console.log("Post has been saved")) .catch((error) => console.log("Cannot save. Error: ", error)) }, (error) => console.log("Cannot connect: ", error), diff --git a/sample/sample13-everywhere-abstraction/app.ts b/sample/sample13-everywhere-abstraction/app.ts index efbbdd925..b3797bd9a 100644 --- a/sample/sample13-everywhere-abstraction/app.ts +++ b/sample/sample13-everywhere-abstraction/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostCategory } from "./entity/PostCategory" import { PostAuthor } from "./entity/PostAuthor" diff --git a/sample/sample13-everywhere-abstraction/entity/Blog.ts b/sample/sample13-everywhere-abstraction/entity/Blog.ts index 122f17ffe..df47f924a 100644 --- a/sample/sample13-everywhere-abstraction/entity/Blog.ts +++ b/sample/sample13-everywhere-abstraction/entity/Blog.ts @@ -9,7 +9,7 @@ export class Blog extends BaseObject { @Column() text: string - @ManyToMany((type) => PostCategory, (category) => category.posts, { + @ManyToMany(() => PostCategory, (category) => category.posts, { cascade: true, }) @JoinTable() diff --git a/sample/sample13-everywhere-abstraction/entity/Post.ts b/sample/sample13-everywhere-abstraction/entity/Post.ts index 33ddad20b..19b04cfdb 100644 --- a/sample/sample13-everywhere-abstraction/entity/Post.ts +++ b/sample/sample13-everywhere-abstraction/entity/Post.ts @@ -9,7 +9,7 @@ export class Post extends BaseObject { @Column() text: string - @ManyToMany((type) => PostCategory, (category) => category.posts, { + @ManyToMany(() => PostCategory, (category) => category.posts, { cascade: true, }) @JoinTable() diff --git a/sample/sample13-everywhere-abstraction/entity/PostCategory.ts b/sample/sample13-everywhere-abstraction/entity/PostCategory.ts index e215decff..fa6d6f68b 100644 --- a/sample/sample13-everywhere-abstraction/entity/PostCategory.ts +++ b/sample/sample13-everywhere-abstraction/entity/PostCategory.ts @@ -10,7 +10,7 @@ export class PostCategory { @Column() name: string - @ManyToMany((type) => Post, (post) => post.categories, { + @ManyToMany(() => Post, (post) => post.categories, { cascade: true, }) posts: Post[] = [] diff --git a/sample/sample14-errors-in-wrong-metdata/app.ts b/sample/sample14-errors-in-wrong-metdata/app.ts index 2ba14267e..be42cded1 100644 --- a/sample/sample14-errors-in-wrong-metdata/app.ts +++ b/sample/sample14-errors-in-wrong-metdata/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostAuthor } from "./entity/PostAuthor" @@ -29,7 +29,7 @@ dataSource.initialize().then( postRepository .save(post) - .then((post) => console.log("Post has been saved")) + .then(() => console.log("Post has been saved")) .catch((error) => console.log("Cannot save. Error: ", error)) }, (error) => console.log("Cannot connect: ", error), diff --git a/sample/sample14-errors-in-wrong-metdata/entity/Post.ts b/sample/sample14-errors-in-wrong-metdata/entity/Post.ts index 3c4e43fbb..dfba5e0c9 100644 --- a/sample/sample14-errors-in-wrong-metdata/entity/Post.ts +++ b/sample/sample14-errors-in-wrong-metdata/entity/Post.ts @@ -35,7 +35,7 @@ export class Post { // @JoinTable() // uncomment this and you'll get an error because JoinTable is not allowed here (only many-to-many) editors: PostAuthor[] - @ManyToMany((type) => PostAuthor, (author) => author.manyPosts) + @ManyToMany(() => PostAuthor, (author) => author.manyPosts) @JoinTable() // comment this and you'll get an error because JoinTable must be at least on one side of the many-to-many relationship manyAuthors: PostAuthor[] } diff --git a/sample/sample16-indexes/app.ts b/sample/sample16-indexes/app.ts index b68043e97..c96551b48 100644 --- a/sample/sample16-indexes/app.ts +++ b/sample/sample16-indexes/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { BasePost } from "./entity/BasePost" diff --git a/sample/sample17-versioning/app.ts b/sample/sample17-versioning/app.ts index ebd83d156..48815dc5a 100644 --- a/sample/sample17-versioning/app.ts +++ b/sample/sample17-versioning/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" const options: DataSourceOptions = { diff --git a/sample/sample18-lazy-relations/app.ts b/sample/sample18-lazy-relations/app.ts index e202af831..c0a2120a8 100644 --- a/sample/sample18-lazy-relations/app.ts +++ b/sample/sample18-lazy-relations/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Author } from "./entity/Author" import { Category } from "./entity/Category" @@ -47,13 +47,13 @@ dataSource.initialize().then( return authorRepository.save(author) }) - .then((author: any) => { + .then((author) => { // temporary console.log( "Author with a new post has been saved. Lets try to update post in the author", ) - return author.posts!.then((posts: any) => { + return author.posts!.then((posts) => { // temporary posts![0]!.title = "should be updated second post" return authorRepository.save(author!) @@ -76,7 +76,7 @@ dataSource.initialize().then( posts[1].author = Promise.resolve(null) return postRepository.save(posts[0]) }) - .then((posts) => { + .then(() => { console.log("Two post's author has been removed.") console.log("Now lets check many-to-many relations") @@ -93,7 +93,7 @@ dataSource.initialize().then( return postRepository.save(post) }) - .then((posts) => { + .then(() => { console.log("Post has been saved with its categories. ") console.log("Lets find it now. ") return postRepository.find({ @@ -106,14 +106,13 @@ dataSource.initialize().then( .then((posts) => { console.log("Post with categories are loaded: ", posts) console.log("Lets remove one of the categories: ") - return posts[0].categories.then((categories: any) => { + return posts[0].categories.then((categories) => { // temporary categories!.splice(0, 1) - // console.log(posts[0]); return postRepository.save(posts[0]) }) }) - .then((posts) => { + .then(() => { console.log("One of the post category has been removed.") }) .catch((error) => console.log(error.stack)) diff --git a/sample/sample18-lazy-relations/entity/Category.ts b/sample/sample18-lazy-relations/entity/Category.ts index 6cfdf6005..e48e29ecf 100644 --- a/sample/sample18-lazy-relations/entity/Category.ts +++ b/sample/sample18-lazy-relations/entity/Category.ts @@ -10,6 +10,6 @@ export class Category { @Column() name: string - @ManyToMany((type) => Post, (post) => post.categories) + @ManyToMany(() => Post, (post) => post.categories) posts: Promise } diff --git a/sample/sample19-one-side-relations/app.ts b/sample/sample19-one-side-relations/app.ts index aedc636a1..3d61a8205 100644 --- a/sample/sample19-one-side-relations/app.ts +++ b/sample/sample19-one-side-relations/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Author } from "./entity/Author" import { Category } from "./entity/Category" @@ -61,70 +61,10 @@ dataSource.initialize().then( }, }, }) - - // let secondPost = postRepository.create(); - // secondPost.text = "Second post"; - // secondPost.title = "About second post"; - // return authorRepository.save(author); }) .then((post) => { console.log("Loaded posts: ", post) }) - /* posts[0].title = "should be updated second post"; - - return author.posts.then(posts => { - return authorRepository.save(author); - }); - }) - .then(updatedAuthor => { - console.log("Author has been updated: ", updatedAuthor); - console.log("Now lets load all posts with their authors:"); - return postRepository.find({ alias: "post", leftJoinAndSelect: { author: "post.author" } }); - }) - .then(posts => { - console.log("Posts are loaded: ", posts); - console.log("Now lets delete a post"); - posts[0].author = Promise.resolve(null); - posts[1].author = Promise.resolve(null); - return postRepository.save(posts[0]); - }) - .then(posts => { - console.log("Two post's author has been removed."); - console.log("Now lets check many-to-many relations"); - - let category1 = categoryRepository.create(); - category1.name = "Hello category1"; - - let category2 = categoryRepository.create(); - category2.name = "Bye category2"; - - let post = postRepository.create(); - post.title = "Post & Categories"; - post.text = "Post with many categories"; - post.categories = Promise.resolve([ - category1, - category2 - ]); - - return postRepository.save(post); - }) - .then(posts => { - console.log("Post has been saved with its categories. "); - console.log("Lets find it now. "); - return postRepository.find({ alias: "post", innerJoinAndSelect: { categories: "post.categories" } }); - }) - .then(posts => { - console.log("Post with categories are loaded: ", posts); - console.log("Lets remove one of the categories: "); - return posts[0].categories.then(categories => { - categories.splice(0, 1); - // console.log(posts[0]); - return postRepository.save(posts[0]); - }); - })*/ - .then((posts) => { - // console.log("One of the post category has been removed."); - }) .catch((error) => console.log(error.stack)) }, (error) => console.log("Cannot connect: ", error), diff --git a/sample/sample2-one-to-one/app.ts b/sample/sample2-one-to-one/app.ts index 16b52e52c..32b9c1c05 100644 --- a/sample/sample2-one-to-one/app.ts +++ b/sample/sample2-one-to-one/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostDetails } from "./entity/PostDetails" import { PostCategory } from "./entity/PostCategory" @@ -45,7 +45,7 @@ dataSource.initialize().then( postRepository .save(post) - .then((post) => { + .then(() => { console.log( "Post has been saved. Lets try to find this post using query builder: ", ) diff --git a/sample/sample20-join-without-relation/app.ts b/sample/sample20-join-without-relation/app.ts index 52cb31b86..5412647ad 100644 --- a/sample/sample20-join-without-relation/app.ts +++ b/sample/sample20-join-without-relation/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Author } from "./entity/Author" import { Category } from "./entity/Category" @@ -38,7 +38,6 @@ dataSource.initialize().then( post.text = "Hello how are you?" post.title = "hello" post.authorId = 1 - // post.author = author; post.categories = [category1, category2] Promise.all([ @@ -78,61 +77,6 @@ dataSource.initialize().then( .then((authors) => { console.log("Loaded authors: ", authors) }) - /* posts[0].title = "should be updated second post"; - - return author.posts.then(posts => { - return authorRepository.save(author); - }); - }) - .then(updatedAuthor => { - console.log("Author has been updated: ", updatedAuthor); - console.log("Now lets load all posts with their authors:"); - return postRepository.find({ alias: "post", leftJoinAndSelect: { author: "post.author" } }); - }) - .then(posts => { - console.log("Posts are loaded: ", posts); - console.log("Now lets delete a post"); - posts[0].author = Promise.resolve(null); - posts[1].author = Promise.resolve(null); - return postRepository.save(posts[0]); - }) - .then(posts => { - console.log("Two post's author has been removed."); - console.log("Now lets check many-to-many relations"); - - let category1 = categoryRepository.create(); - category1.name = "Hello category1"; - - let category2 = categoryRepository.create(); - category2.name = "Bye category2"; - - let post = postRepository.create(); - post.title = "Post & Categories"; - post.text = "Post with many categories"; - post.categories = Promise.resolve([ - category1, - category2 - ]); - - return postRepository.save(post); - }) - .then(posts => { - console.log("Post has been saved with its categories. "); - console.log("Lets find it now. "); - return postRepository.find({ alias: "post", innerJoinAndSelect: { categories: "post.categories" } }); - }) - .then(posts => { - console.log("Post with categories are loaded: ", posts); - console.log("Lets remove one of the categories: "); - return posts[0].categories.then(categories => { - categories.splice(0, 1); - // console.log(posts[0]); - return postRepository.save(posts[0]); - }); - })*/ - .then((posts) => { - // console.log("One of the post category has been removed."); - }) .catch((error) => console.log(error.stack)) }, (error) => console.log("Cannot connect: ", error), diff --git a/sample/sample20-join-without-relation/entity/Post.ts b/sample/sample20-join-without-relation/entity/Post.ts index e0b663784..5c8ec2323 100644 --- a/sample/sample20-join-without-relation/entity/Post.ts +++ b/sample/sample20-join-without-relation/entity/Post.ts @@ -18,7 +18,7 @@ export class Post { @Column("int") authorId: number - @ManyToMany((type) => Category) + @ManyToMany(() => Category) @JoinTable() categories: Category[] diff --git a/sample/sample21-custom-join-table-column/app.ts b/sample/sample21-custom-join-table-column/app.ts index c9ed9f9e4..c9ad58956 100644 --- a/sample/sample21-custom-join-table-column/app.ts +++ b/sample/sample21-custom-join-table-column/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Author } from "./entity/Author" import { Category } from "./entity/Category" @@ -38,7 +38,7 @@ dataSource.initialize().then( postRepository .save(post) - .then((post) => { + .then(() => { console.log("Post has been saved. Lets load it now.") return postRepository.find({ join: { diff --git a/sample/sample21-custom-join-table-column/entity/Category.ts b/sample/sample21-custom-join-table-column/entity/Category.ts index 4b9ca750c..b232b2e17 100644 --- a/sample/sample21-custom-join-table-column/entity/Category.ts +++ b/sample/sample21-custom-join-table-column/entity/Category.ts @@ -10,6 +10,6 @@ export class Category { @Column() name: string - @ManyToMany((type) => Post, (post) => post.categories) + @ManyToMany(() => Post, (post) => post.categories) posts: Post[] } diff --git a/sample/sample22-closure-table/app.ts b/sample/sample22-closure-table/app.ts index d206ae203..7bc87f741 100644 --- a/sample/sample22-closure-table/app.ts +++ b/sample/sample22-closure-table/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Category } from "./entity/Category" const options: DataSourceOptions = { @@ -39,7 +39,7 @@ dataSource.initialize().then( return categoryRepository .save(category1) - .then((category) => { + .then(() => { console.log( "Categories has been saved. Lets now load it and all its descendants:", ) diff --git a/sample/sample23-nested-joins/app.ts b/sample/sample23-nested-joins/app.ts index 438565670..65bebbc2a 100644 --- a/sample/sample23-nested-joins/app.ts +++ b/sample/sample23-nested-joins/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Author } from "./entity/Author" import { Category } from "./entity/Category" @@ -41,7 +41,7 @@ dataSource.initialize().then( postRepository .save(post) - .then((post) => { + .then(() => { return postRepository .createQueryBuilder("post") .leftJoin("post.categories", "categories") @@ -63,7 +63,7 @@ dataSource.initialize().then( return postRepository.save(post) }) - .then((updatedPost) => { + .then(() => { return postRepository .createQueryBuilder("post") .leftJoinAndSelect("post.author", "author") @@ -80,7 +80,7 @@ dataSource.initialize().then( loadedPost!.author = author return postRepository.save(loadedPost!) }) - .then((updatedPost) => { + .then(() => { return postRepository .createQueryBuilder("post") .leftJoinAndSelect("post.author", "author") @@ -94,7 +94,7 @@ dataSource.initialize().then( post.author = null return postRepository.save(post) }) - .then((updatedPost) => { + .then(() => { return postRepository .createQueryBuilder("post") .leftJoinAndSelect("post.author", "author") @@ -106,7 +106,7 @@ dataSource.initialize().then( post.author = author2 return postRepository.save(post) }) - .then((updatedPost) => { + .then(() => { return postRepository .createQueryBuilder("post") .leftJoinAndSelect("post.author", "author") diff --git a/sample/sample23-nested-joins/entity/Category.ts b/sample/sample23-nested-joins/entity/Category.ts index 487d3b841..cd3aed30c 100644 --- a/sample/sample23-nested-joins/entity/Category.ts +++ b/sample/sample23-nested-joins/entity/Category.ts @@ -11,7 +11,7 @@ export class Category { @Column() name: string - @ManyToMany((type) => Author) + @ManyToMany(() => Author) @JoinTable() author: Author } diff --git a/sample/sample25-insert-from-inverse-side/app.ts b/sample/sample25-insert-from-inverse-side/app.ts index 5e8afe753..343aa2fd8 100644 --- a/sample/sample25-insert-from-inverse-side/app.ts +++ b/sample/sample25-insert-from-inverse-side/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Author } from "./entity/Author" @@ -27,7 +27,7 @@ dataSource.initialize().then( if (!author) { author = new Author() author.name = "Umed" - return authorRepository.save(author).then((savedAuthor) => { + return authorRepository.save(author).then(() => { return authorRepository.findOneBy({ id: 1 }) }) } @@ -39,7 +39,7 @@ dataSource.initialize().then( post = new Post() post.title = "Hello post" post.text = "This is post contents" - return postRepository.save(post).then((savedPost) => { + return postRepository.save(post).then(() => { return postRepository.findOneBy({ id: 1 }) }) } diff --git a/sample/sample26-embedded-tables/app.ts b/sample/sample26-embedded-tables/app.ts index 6b22a2137..cd0770925 100644 --- a/sample/sample26-embedded-tables/app.ts +++ b/sample/sample26-embedded-tables/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Question } from "./entity/Question" import { Counters } from "./entity/Counters" diff --git a/sample/sample26-embedded-tables/entity/Post.ts b/sample/sample26-embedded-tables/entity/Post.ts index cfda7d7a9..58825f7bb 100644 --- a/sample/sample26-embedded-tables/entity/Post.ts +++ b/sample/sample26-embedded-tables/entity/Post.ts @@ -12,6 +12,6 @@ export class Post { @Column() text: string - @Column((type) => Counters) + @Column(() => Counters) counters: Counters } diff --git a/sample/sample26-embedded-tables/entity/Question.ts b/sample/sample26-embedded-tables/entity/Question.ts index c75673a28..1af6affe3 100644 --- a/sample/sample26-embedded-tables/entity/Question.ts +++ b/sample/sample26-embedded-tables/entity/Question.ts @@ -9,6 +9,6 @@ export class Question { @Column() title: string - @Column((type) => Counters) + @Column(() => Counters) counters: Counters } diff --git a/sample/sample27-composite-primary-keys/app.ts b/sample/sample27-composite-primary-keys/app.ts index 0b20fc698..d02165f76 100644 --- a/sample/sample27-composite-primary-keys/app.ts +++ b/sample/sample27-composite-primary-keys/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" const options: DataSourceOptions = { diff --git a/sample/sample28-single-table-inheritance/app.ts b/sample/sample28-single-table-inheritance/app.ts index 83d534172..b1cbf5329 100644 --- a/sample/sample28-single-table-inheritance/app.ts +++ b/sample/sample28-single-table-inheritance/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Employee } from "./entity/Employee" import { Homesitter } from "./entity/Homesitter" import { Student } from "./entity/Student" diff --git a/sample/sample3-many-to-one/app.ts b/sample/sample3-many-to-one/app.ts index 29c225ceb..40ba0810a 100644 --- a/sample/sample3-many-to-one/app.ts +++ b/sample/sample3-many-to-one/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostDetails } from "./entity/PostDetails" import { PostCategory } from "./entity/PostCategory" @@ -9,11 +9,6 @@ import { PostInformation } from "./entity/PostInformation" import { PostAuthor } from "./entity/PostAuthor" const options: DataSourceOptions = { - // type: "mssql", - // host: "192.168.1.10", - // username: "sa", - // password: "admin12345", - // database: "test", type: "oracle", host: "localhost", username: "system", @@ -51,7 +46,7 @@ dataSource postRepository .save(post) - .then((post) => console.log("Post has been saved")) + .then(() => console.log("Post has been saved")) .catch((error) => console.log("Cannot save. Error: ", error)) }) .catch((error) => console.log("Error: ", error)) diff --git a/sample/sample30-default-order-by/app.ts b/sample/sample30-default-order-by/app.ts index fb5d23ab9..17254fb15 100644 --- a/sample/sample30-default-order-by/app.ts +++ b/sample/sample30-default-order-by/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Category } from "./entity/Category" diff --git a/sample/sample30-default-order-by/entity/Post.ts b/sample/sample30-default-order-by/entity/Post.ts index c92b0f777..2c1833b3c 100644 --- a/sample/sample30-default-order-by/entity/Post.ts +++ b/sample/sample30-default-order-by/entity/Post.ts @@ -19,7 +19,7 @@ export class Post { @Column() text: string - @ManyToMany((type) => Category) + @ManyToMany(() => Category) @JoinTable() categories: Category[] diff --git a/sample/sample31-table-prefix/app.ts b/sample/sample31-table-prefix/app.ts index c3a0ad7fe..9dc754ca0 100644 --- a/sample/sample31-table-prefix/app.ts +++ b/sample/sample31-table-prefix/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Author } from "./entity/Author" import { Category } from "./entity/Category" diff --git a/sample/sample32-migrations/app.ts b/sample/sample32-migrations/app.ts index a7990f578..5f3f3d164 100644 --- a/sample/sample32-migrations/app.ts +++ b/sample/sample32-migrations/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { Author } from "./entity/Author" diff --git a/sample/sample34-mongodb/app.ts b/sample/sample34-mongodb/app.ts index c0b2213a6..9f2e82930 100644 --- a/sample/sample34-mongodb/app.ts +++ b/sample/sample34-mongodb/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" const options: DataSourceOptions = { diff --git a/sample/sample4-many-to-many/app.ts b/sample/sample4-many-to-many/app.ts index f672a578e..4cfaf7a37 100644 --- a/sample/sample4-many-to-many/app.ts +++ b/sample/sample4-many-to-many/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostDetails } from "./entity/PostDetails" @@ -32,7 +32,7 @@ dataSource.initialize().then( postRepository .save(post) - .then((post) => console.log("Post has been saved")) + .then(() => console.log("Post has been saved")) .catch((error) => console.log("Cannot save. Error: ", error)) }, (error) => console.log("Cannot connect: ", error), diff --git a/sample/sample4-many-to-many/entity/Post.ts b/sample/sample4-many-to-many/entity/Post.ts index 32010b915..5b297817d 100644 --- a/sample/sample4-many-to-many/entity/Post.ts +++ b/sample/sample4-many-to-many/entity/Post.ts @@ -25,7 +25,7 @@ export class Post { // Post has relation with PostCategory, however inverse relation is not set // (category does not have relation with post set) - @ManyToMany((type) => PostCategory, { + @ManyToMany(() => PostCategory, { cascade: true, }) @JoinTable() @@ -33,7 +33,7 @@ export class Post { // Post has relation with PostDetails. Cascade insert here means if there is a new PostDetails instance set // on this relation, it will be inserted automatically to the db when you save this Post entity - @ManyToMany((type) => PostDetails, (details) => details.posts, { + @ManyToMany(() => PostDetails, (details) => details.posts, { cascade: ["insert"], }) @JoinTable() @@ -41,7 +41,7 @@ export class Post { // Post has relation with PostImage. Cascade update here means if there are changes to an existing PostImage, it // will be updated automatically to the db when you save this Post entity - @ManyToMany((type) => PostImage, (image) => image.posts, { + @ManyToMany(() => PostImage, (image) => image.posts, { cascade: ["update"], }) @JoinTable() @@ -49,12 +49,12 @@ export class Post { // Post has relation with PostMetadata. No cascades here means that when saving a Post entity, there will be // no creating/updating/destroying PostMetadata. - @ManyToMany((type) => PostMetadata, (metadata) => metadata.posts) + @ManyToMany(() => PostMetadata, (metadata) => metadata.posts) @JoinTable() metadatas: PostMetadata[] // Post has relation with PostInformation. Full cascades here - @ManyToMany((type) => PostInformation, (information) => information.posts, { + @ManyToMany(() => PostInformation, (information) => information.posts, { cascade: true, }) @JoinTable() @@ -62,7 +62,7 @@ export class Post { // Post has relation with author. No cascades here means that when saving a Post entity, there will be // no creating/updating/destroying PostAuthor. - @ManyToMany((type) => PostAuthor, (author) => author.posts) + @ManyToMany(() => PostAuthor, (author) => author.posts) @JoinTable() authors: PostAuthor[] } diff --git a/sample/sample4-many-to-many/entity/PostAuthor.ts b/sample/sample4-many-to-many/entity/PostAuthor.ts index 83c77a79e..f9e26147b 100644 --- a/sample/sample4-many-to-many/entity/PostAuthor.ts +++ b/sample/sample4-many-to-many/entity/PostAuthor.ts @@ -14,6 +14,6 @@ export class PostAuthor { @Column() name: string - @ManyToMany((type) => Post, (post) => post.authors) + @ManyToMany(() => Post, (post) => post.authors) posts: Post[] } diff --git a/sample/sample4-many-to-many/entity/PostDetails.ts b/sample/sample4-many-to-many/entity/PostDetails.ts index 7d5cce21d..5734ea438 100644 --- a/sample/sample4-many-to-many/entity/PostDetails.ts +++ b/sample/sample4-many-to-many/entity/PostDetails.ts @@ -29,7 +29,7 @@ export class PostDetails { }) metadata: string | null - @ManyToMany((type) => Post, (post) => post.details, { + @ManyToMany(() => Post, (post) => post.details, { cascade: true, }) posts: Post[] diff --git a/sample/sample4-many-to-many/entity/PostImage.ts b/sample/sample4-many-to-many/entity/PostImage.ts index 18c0a4804..ecf8bc207 100644 --- a/sample/sample4-many-to-many/entity/PostImage.ts +++ b/sample/sample4-many-to-many/entity/PostImage.ts @@ -14,6 +14,6 @@ export class PostImage { @Column() url: string - @ManyToMany((type) => Post, (post) => post.images) + @ManyToMany(() => Post, (post) => post.images) posts: Post[] } diff --git a/sample/sample4-many-to-many/entity/PostInformation.ts b/sample/sample4-many-to-many/entity/PostInformation.ts index fc04088d9..dde3716d1 100644 --- a/sample/sample4-many-to-many/entity/PostInformation.ts +++ b/sample/sample4-many-to-many/entity/PostInformation.ts @@ -14,7 +14,7 @@ export class PostInformation { @Column() text: string - @ManyToMany((type) => Post, (post) => post.informations, { + @ManyToMany(() => Post, (post) => post.informations, { cascade: ["update"], }) posts: Post[] diff --git a/sample/sample4-many-to-many/entity/PostMetadata.ts b/sample/sample4-many-to-many/entity/PostMetadata.ts index 642418645..3e22f99c8 100644 --- a/sample/sample4-many-to-many/entity/PostMetadata.ts +++ b/sample/sample4-many-to-many/entity/PostMetadata.ts @@ -14,6 +14,6 @@ export class PostMetadata { @Column() description: string - @ManyToMany((type) => Post, (post) => post.metadatas) + @ManyToMany(() => Post, (post) => post.metadatas) posts: Post[] } diff --git a/sample/sample5-subscribers/app.ts b/sample/sample5-subscribers/app.ts index 3c6cd6d16..6c0bb4e81 100644 --- a/sample/sample5-subscribers/app.ts +++ b/sample/sample5-subscribers/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostCategory } from "./entity/PostCategory" import { PostAuthor } from "./entity/PostAuthor" @@ -66,7 +66,7 @@ dataSource.initialize().then( console.log("update finished. Now lets remove entity") return postRepository.remove(loadedPost) }) - .then((loadedPost) => { + .then(() => { console.log("---------------------------") console.log("post removed.") }) diff --git a/sample/sample5-subscribers/entity/PostCategory.ts b/sample/sample5-subscribers/entity/PostCategory.ts index f85ba4294..fd571dff7 100644 --- a/sample/sample5-subscribers/entity/PostCategory.ts +++ b/sample/sample5-subscribers/entity/PostCategory.ts @@ -10,7 +10,7 @@ export class PostCategory { @Column() name: string - @ManyToMany((type) => Post, (post) => post.categories, { + @ManyToMany(() => Post, (post) => post.categories, { cascade: true, }) posts: Post[] = [] diff --git a/sample/sample6-abstract-table/app.ts b/sample/sample6-abstract-table/app.ts index f898057c8..9afacbeac 100644 --- a/sample/sample6-abstract-table/app.ts +++ b/sample/sample6-abstract-table/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostCategory } from "./entity/PostCategory" import { PostAuthor } from "./entity/PostAuthor" diff --git a/sample/sample6-abstract-table/entity/PostCategory.ts b/sample/sample6-abstract-table/entity/PostCategory.ts index 1c7335147..8b04d7fbc 100644 --- a/sample/sample6-abstract-table/entity/PostCategory.ts +++ b/sample/sample6-abstract-table/entity/PostCategory.ts @@ -10,7 +10,7 @@ export class PostCategory { @Column() name: string - @ManyToMany((type) => Post, (post) => post.categories, { + @ManyToMany(() => Post, (post) => post.categories, { cascade: true, }) posts: Post[] = [] diff --git a/sample/sample7-pagination/app.ts b/sample/sample7-pagination/app.ts index 9a4809d13..fb16b54e9 100644 --- a/sample/sample7-pagination/app.ts +++ b/sample/sample7-pagination/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostCategory } from "./entity/PostCategory" import { PostAuthor } from "./entity/PostAuthor" @@ -48,7 +48,7 @@ dataSource.initialize().then( .take(10) Promise.all(posts.map((post) => postRepository.save(post))) - .then((savedPosts) => { + .then(() => { console.log("Posts has been saved. Lets try to load some posts") return qb.getMany() }) diff --git a/sample/sample7-pagination/entity/PostCategory.ts b/sample/sample7-pagination/entity/PostCategory.ts index 04e7481b9..4641ac96a 100644 --- a/sample/sample7-pagination/entity/PostCategory.ts +++ b/sample/sample7-pagination/entity/PostCategory.ts @@ -10,7 +10,7 @@ export class PostCategory { @Column() name: string - @ManyToMany((type) => Post, (post) => post.categories, { + @ManyToMany(() => Post, (post) => post.categories, { cascade: true, }) posts: Post[] = [] diff --git a/sample/sample8-self-referencing/app.ts b/sample/sample8-self-referencing/app.ts index 4da7098e3..d3cbae5ea 100644 --- a/sample/sample8-self-referencing/app.ts +++ b/sample/sample8-self-referencing/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Category } from "./entity/Category" const options: DataSourceOptions = { diff --git a/sample/sample9-entity-listeners/app.ts b/sample/sample9-entity-listeners/app.ts index e45bb9cc1..59e1763ae 100644 --- a/sample/sample9-entity-listeners/app.ts +++ b/sample/sample9-entity-listeners/app.ts @@ -1,5 +1,5 @@ import "reflect-metadata" -import { DataSource, DataSourceOptions } from "../../src/index" +import { DataSource, DataSourceOptions } from "../../src" import { Post } from "./entity/Post" import { PostCategory } from "./entity/PostCategory" import { PostAuthor } from "./entity/PostAuthor" @@ -66,7 +66,7 @@ dataSource.initialize().then( console.log("---------------------------") return postRepository.remove(loadedPost) }) - .then((loadedPost) => { + .then(() => { console.log("post removed.") }) .catch((error) => diff --git a/sample/sample9-entity-listeners/entity/PostCategory.ts b/sample/sample9-entity-listeners/entity/PostCategory.ts index 1ae0414b3..ea1bae4d3 100644 --- a/sample/sample9-entity-listeners/entity/PostCategory.ts +++ b/sample/sample9-entity-listeners/entity/PostCategory.ts @@ -20,7 +20,7 @@ export class PostCategory { @Column() name: string - @ManyToMany((type) => Post, (post) => post.categories, { + @ManyToMany(() => Post, (post) => post.categories, { cascade: true, }) posts: Post[] = []