Compare commits
3 Commits
3a84cc8ef5
...
7b948f0380
Author | SHA1 | Date | |
---|---|---|---|
7b948f0380 | |||
8c04bd067c | |||
203d95ee1c |
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user