Compare commits

...

3 Commits

View File

@ -8,17 +8,23 @@ import {
Delete,
} from "routing-controllers";
import { OpenAPI } from "routing-controllers-openapi";
import { getConnection, Repository } from "typeorm";
import { Track } from "../models/Track";
@JsonController()
@JsonController("/track")
export class TrackController {
private repo(): Repository<Track> {
return getConnection().getRepository(Track);
}
@Get("/track")
getAll() {
return "This action returns all users";
async getAll() {
return await this.repo().find();
}
@Get("/track/:id")
getOne(@Param("id") id: number) {
return "This action returns user #" + id;
async getOne(@Param("id") id: number) {
return await this.repo().findOne({ id: id });
}
@Post("/track")