Skip to content

Commit

Permalink
add bet controller
Browse files Browse the repository at this point in the history
  • Loading branch information
syarhei committed Dec 2, 2017
1 parent b8a6ad1 commit d93ca04
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/main/controllers/BetController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package main.controllers;

import main.models.Bet;
import main.services.BetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/bets")
public class BetController extends Controller<Bet> {
@Autowired
private BetService betService;

@GetMapping("/{primaryKey}")
public ResponseEntity getEntity(@PathVariable Integer primaryKey) {
return super.getEntity(primaryKey);
}

@PutMapping("/{primaryKey}")
public ResponseEntity updateEntity(@PathVariable Integer primaryKey, @RequestBody Bet object) {
object.setId(primaryKey);
return super.updateEntity(primaryKey, object);
}

@DeleteMapping("/{primaryKey}")
public ResponseEntity deleteEntity(@PathVariable Integer primaryKey) {
return super.deleteEntity(primaryKey);
}
}
14 changes: 14 additions & 0 deletions src/main/services/BetService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main.services;

import main.models.Bet;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;

@Repository
@Transactional
public class BetService extends Service<Bet> {
public BetService() {
super(Bet.class);
}
}

0 comments on commit d93ca04

Please sign in to comment.