Compare commits
3 Commits
3a84cc8ef5
...
7b948f0380
Author | SHA1 | Date | |
---|---|---|---|
7b948f0380 | |||
8c04bd067c | |||
203d95ee1c |
@ -8,17 +8,23 @@ import {
|
|||||||
Delete,
|
Delete,
|
||||||
} from "routing-controllers";
|
} from "routing-controllers";
|
||||||
import { OpenAPI } from "routing-controllers-openapi";
|
import { OpenAPI } from "routing-controllers-openapi";
|
||||||
|
import { getConnection, Repository } from "typeorm";
|
||||||
|
import { Track } from "../models/Track";
|
||||||
|
|
||||||
@JsonController()
|
@JsonController("/track")
|
||||||
export class TrackController {
|
export class TrackController {
|
||||||
|
private repo(): Repository<Track> {
|
||||||
|
return getConnection().getRepository(Track);
|
||||||
|
}
|
||||||
|
|
||||||
@Get("/track")
|
@Get("/track")
|
||||||
getAll() {
|
async getAll() {
|
||||||
return "This action returns all users";
|
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