parent
8c04bd067c
commit
7b948f0380
@ -13,20 +13,18 @@ import { Track } from "../models/Track";
|
|||||||
|
|
||||||
@JsonController("/track")
|
@JsonController("/track")
|
||||||
export class TrackController {
|
export class TrackController {
|
||||||
private repo: Repository<Track>;
|
private repo(): Repository<Track> {
|
||||||
|
return getConnection().getRepository(Track);
|
||||||
public async TrackController() {
|
|
||||||
const trackManager = await getConnection().getRepository(Track);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get("/track")
|
@Get("/track")
|
||||||
async getAll() {
|
async getAll() {
|
||||||
return await this.repo.count();
|
return await this.repo().find();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get("/track/:id")
|
@Get("/track/:id")
|
||||||
getOne(@Param("id") id: number) {
|
async getOne(@Param("id") id: number) {
|
||||||
return "This action returns user #" + id;
|
return await this.repo().findOne({ id: id });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post("/track")
|
@Post("/track")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user