Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {User} from "../../entity/User";
import {UsersService} from "../../services/UsersService";
@Controller("/users")
export class UsersCtrl {
constructor(private usersService: UsersService) {
}
@Post("/")
create(@BodyParams() user: User): Promise {
return this.usersService.create(user);
}
@Get("/")
@ReturnsArray(User)
async getList(): Promise {
return this.usersService.find();
}
}
@Post("/:id")
@Returns(Calendar)
async update(@PathParams("id") @Required() id: string,
@BodyParams() @Required() calendar: CreateCalendar): Promise {
return this.calendarsService.update({id, ...calendar});
}
@Delete("/")
@Status(204)
async remove(@BodyParams("id") @Required() id: string): Promise {
await this.calendarsService.remove(id);
}
@Get("/")
@ReturnsArray(Calendar)
async getAllCalendars() {
return this.calendarsService.query();
}
}