-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |