mirror of
https://gitea.gofwd.group/Forward_Group/ballistic-builder-spring.git
synced 2026-01-20 16:51:03 -05:00
adding version to the endpoints
This commit is contained in:
@@ -19,7 +19,7 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/auth")
|
||||
@RequestMapping({"/api/auth", "/api/v1/auth"})
|
||||
@CrossOrigin
|
||||
public class AuthController {
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/builder")
|
||||
@RequestMapping({"/api/builder", "/api/v1/builder"})
|
||||
@CrossOrigin
|
||||
public class BuilderBootstrapController {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/categories")
|
||||
@RequestMapping({"/api/categories", "/api/v1/categories"})
|
||||
@CrossOrigin // you can tighten origins later
|
||||
public class CategoryController {
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/imports")
|
||||
@RequestMapping({"/api/admin/imports", "/api/v1/admin/imports"})
|
||||
|
||||
@CrossOrigin(origins = "http://localhost:3000")
|
||||
public class ImportController {
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@ package group.goforward.battlbuilder.controllers;
|
||||
import group.goforward.battlbuilder.model.Merchant;
|
||||
import group.goforward.battlbuilder.repos.MerchantRepository;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api/admin", "/api/v1/admin"})
|
||||
public class MerchantDebugController {
|
||||
|
||||
private final MerchantRepository merchantRepository;
|
||||
@@ -16,7 +18,7 @@ public class MerchantDebugController {
|
||||
this.merchantRepository = merchantRepository;
|
||||
}
|
||||
|
||||
@GetMapping("/api/admin/debug/merchants")
|
||||
@GetMapping("/debug/merchants")
|
||||
public List<Merchant> listMerchants() {
|
||||
return merchantRepository.findAll();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/part-role-mappings")
|
||||
@RequestMapping({"/api/part-role-mappings", "/api/v1/part-role-mappings"})
|
||||
public class PartRoleMappingController {
|
||||
|
||||
private final PartRoleMappingService service;
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
*/
|
||||
@Deprecated
|
||||
@RestController
|
||||
@RequestMapping("/api/products")
|
||||
@RequestMapping({"/api/products", "/api/v1/products"})
|
||||
@CrossOrigin
|
||||
@ConditionalOnProperty(name = "app.api.legacy.enabled", havingValue = "true", matchIfMissing = false)
|
||||
public class ProductController {
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/brands")
|
||||
@RequestMapping({"/api/v1/brands", "/api/brands"})
|
||||
public class BrandController {
|
||||
@Autowired
|
||||
private BrandRepository repo;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package group.goforward.battlbuilder.controllers.api;
|
||||
|
||||
import group.goforward.battlbuilder.model.Build;
|
||||
import group.goforward.battlbuilder.repos.BuildRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/v1/api/builds")
|
||||
public class BuildController {
|
||||
@Autowired
|
||||
private BuildRepository repo;
|
||||
@Autowired
|
||||
// private BuildsService service;
|
||||
//@Cacheable(value="getAllStates")
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<List<Build>> getAll() {
|
||||
List<Build> builds = repo.findAll();
|
||||
return ResponseEntity.ok(builds);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<Build> getAllBuildsById(@PathVariable Integer id) {
|
||||
return repo.findById(id)
|
||||
.map(ResponseEntity::ok)
|
||||
.orElse(ResponseEntity.notFound().build());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -15,11 +15,11 @@ import java.time.Duration;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/images")
|
||||
public class ImagesController {
|
||||
public class ImageController {
|
||||
|
||||
private final ImageService imageService;
|
||||
|
||||
public ImagesController(ImageService imageService) {
|
||||
public ImageController(ImageService imageService) {
|
||||
this.imageService = imageService;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.UUID;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/users/me")
|
||||
@RequestMapping({"/api/v1/users/me", "/api/users/me"})
|
||||
@CrossOrigin
|
||||
public class MeController {
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/states")
|
||||
@RequestMapping({"/api/states", "/api/v1/states"})
|
||||
public class StateController {
|
||||
@Autowired
|
||||
private StateRepository repo;
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/user")
|
||||
@RequestMapping({"/api/user", "/api/v1/user"})
|
||||
public class UserController {
|
||||
private final UserRepository repo;
|
||||
private final UsersService usersService;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package group.goforward.battlbuilder.services;
|
||||
|
||||
import aj.org.objectweb.asm.commons.Remapper;
|
||||
import group.goforward.battlbuilder.model.Brand;
|
||||
|
||||
public interface BuildsService {
|
||||
Brand save(Brand item);
|
||||
|
||||
Remapper findById(Integer id);
|
||||
|
||||
void deleteById(Integer id);
|
||||
}
|
||||
Reference in New Issue
Block a user