Categories as map
This commit is contained in:
@@ -6,14 +6,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/vars")
|
@RequestMapping("/api/v1/vars")
|
||||||
public class VariablesController {
|
public class VariablesController {
|
||||||
|
|
||||||
@GetMapping("/categories")
|
@GetMapping("/categories")
|
||||||
public List<Enums.Category> getAllVariables() {
|
public Map<Enums.Category, String> getAllVariables() {
|
||||||
return List.of(Enums.Category.values());
|
return Enums.categoryPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/statuses")
|
@GetMapping("/statuses")
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package _11.asktpk.artisanconnectbackend.utils;
|
package _11.asktpk.artisanconnectbackend.utils;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Enums {
|
public class Enums {
|
||||||
public enum Role {
|
public enum Role {
|
||||||
ADMIN, USER
|
ADMIN, USER
|
||||||
@@ -13,6 +15,31 @@ public class Enums {
|
|||||||
Knitting, Carpentry, Other
|
Knitting, Carpentry, Other
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final Map<Category, String> categoryPL = Map.ofEntries(
|
||||||
|
Map.entry(Category.Handmade, "Rękodzieło"),
|
||||||
|
Map.entry(Category.Woodworking, "Stolarstwo"),
|
||||||
|
Map.entry(Category.Metalworking, "Obróbka metalu"),
|
||||||
|
Map.entry(Category.Ceramics, "Ceramika"),
|
||||||
|
Map.entry(Category.Textiles, "Tekstylia"),
|
||||||
|
Map.entry(Category.Jewelry, "Biżuteria"),
|
||||||
|
Map.entry(Category.Leatherwork, "Wyroby skórzane"),
|
||||||
|
Map.entry(Category.Painting, "Malarstwo"),
|
||||||
|
Map.entry(Category.Sculpture, "Rzeźbiarstwo"),
|
||||||
|
Map.entry(Category.Glasswork, "Szklarstwo"),
|
||||||
|
Map.entry(Category.Furniture, "Meble"),
|
||||||
|
Map.entry(Category.Restoration, "Renowacja"),
|
||||||
|
Map.entry(Category.Tailoring, "Krawiectwo"),
|
||||||
|
Map.entry(Category.Weaving, "Tkactwo"),
|
||||||
|
Map.entry(Category.Calligraphy, "Kaligrafia"),
|
||||||
|
Map.entry(Category.Pottery, "Garncarstwo"),
|
||||||
|
Map.entry(Category.Blacksmithing, "Kowalstwo"),
|
||||||
|
Map.entry(Category.Basketry, "Koszykarstwo"),
|
||||||
|
Map.entry(Category.Embroidery, "Hafciarstwo"),
|
||||||
|
Map.entry(Category.Knitting, "Dzierganie"),
|
||||||
|
Map.entry(Category.Carpentry, "Ciesielstwo"),
|
||||||
|
Map.entry(Category.Other, "Inne")
|
||||||
|
);
|
||||||
|
|
||||||
public enum Status {
|
public enum Status {
|
||||||
ACTIVE, INACTIVE
|
ACTIVE, INACTIVE
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user