Compare commits
No commits in common. "7b948f0380e6cc8e3d4a8b2ef54ffa34931d7f07" and "3a84cc8ef56c20fce74707f0aa9df7f120ee693e" have entirely different histories.
7b948f0380
...
3a84cc8ef5
@ -1,44 +1,38 @@
|
||||
import {
|
||||
JsonController,
|
||||
Param,
|
||||
Body,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
JsonController,
|
||||
Param,
|
||||
Body,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
} from "routing-controllers";
|
||||
import { OpenAPI } from "routing-controllers-openapi";
|
||||
import { getConnection, Repository } from "typeorm";
|
||||
import { Track } from "../models/Track";
|
||||
|
||||
@JsonController("/track")
|
||||
@JsonController()
|
||||
export class TrackController {
|
||||
private repo(): Repository<Track> {
|
||||
return getConnection().getRepository(Track);
|
||||
}
|
||||
@Get("/track")
|
||||
getAll() {
|
||||
return "This action returns all users";
|
||||
}
|
||||
|
||||
@Get("/track")
|
||||
async getAll() {
|
||||
return await this.repo().find();
|
||||
}
|
||||
@Get("/track/:id")
|
||||
getOne(@Param("id") id: number) {
|
||||
return "This action returns user #" + id;
|
||||
}
|
||||
|
||||
@Get("/track/:id")
|
||||
async getOne(@Param("id") id: number) {
|
||||
return await this.repo().findOne({ id: id });
|
||||
}
|
||||
@Post("/track")
|
||||
post(@Body() user: any) {
|
||||
return "Saving user...";
|
||||
}
|
||||
|
||||
@Post("/track")
|
||||
post(@Body() user: any) {
|
||||
return "Saving user...";
|
||||
}
|
||||
@Put("/track/:id")
|
||||
put(@Param("id") id: number, @Body() user: any) {
|
||||
return "Updating a user...";
|
||||
}
|
||||
|
||||
@Put("/track/:id")
|
||||
put(@Param("id") id: number, @Body() user: any) {
|
||||
return "Updating a user...";
|
||||
}
|
||||
|
||||
@Delete("/track/:id")
|
||||
remove(@Param("id") id: number) {
|
||||
return "Removing user...";
|
||||
}
|
||||
@Delete("/track/:id")
|
||||
remove(@Param("id") id: number) {
|
||||
return "Removing user...";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user