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