-
-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typeorm): Update typescript version and change typeorm version se…
…mver pattern Related #738
- Loading branch information
Showing
11 changed files
with
45 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,6 @@ | |
"supertest": "4.0.2", | ||
"ts-node": "8.5.2", | ||
"tslint": "5.20.1", | ||
"typescript": "3.5.3" | ||
"typescript": "3.7.4" | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,22 +1,26 @@ | ||
import {BodyParams, Controller, Get, Post} from "@tsed/common"; | ||
import {BodyParams, Controller, Get, PathParams, Post} from "@tsed/common"; | ||
import {ReturnsArray} from "@tsed/swagger"; | ||
import {User} from "../../entity/User"; | ||
import {UsersService} from "../../services/UsersService"; | ||
import {User} from "../../entities/User"; | ||
import {UserRepository} from "../../repositories/UserRepository"; | ||
|
||
@Controller("/users") | ||
export class UsersCtrl { | ||
|
||
constructor(private usersService: UsersService) { | ||
constructor(private userRepository: UserRepository) { | ||
} | ||
|
||
@Post("/") | ||
create(@BodyParams() user: User): Promise<User> { | ||
return this.usersService.create(user); | ||
return this.userRepository.save(user); | ||
} | ||
|
||
@Get("/:id") | ||
async get(@PathParams() id: string): Promise<User> { | ||
return this.userRepository.findByID(id); | ||
} | ||
|
||
@Get("/") | ||
@ReturnsArray(User) | ||
async getList(): Promise<User[]> { | ||
return this.usersService.find(); | ||
return this.userRepository.find(); | ||
} | ||
} |
File renamed without changes.
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,10 @@ | ||
import {Repository} from "typeorm"; | ||
import {EntityRepository} from "@tsed/typeorm"; | ||
import {User} from "../entities/User"; | ||
|
||
@EntityRepository(User) | ||
export class UserRepository extends Repository<User> { | ||
findByID(id: string): Promise<User> { | ||
return this.findOne(id); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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