-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathAdminController.java
More file actions
89 lines (73 loc) · 3.73 KB
/
AdminController.java
File metadata and controls
89 lines (73 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package io.hexlet.cv.controller.admin;
import io.github.inertia4j.spring.Inertia;
import io.hexlet.cv.service.FlashPropsService;
import jakarta.servlet.http.HttpServletRequest;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@AllArgsConstructor
@RequestMapping("/{locale}/admin")
@PreAuthorize("hasRole('ADMIN')")
public class AdminController {
private final Inertia inertia;
private final FlashPropsService flashPropsService;
@GetMapping()
public ResponseEntity<?> adminHomeController(@PathVariable("locale") String locale,
HttpServletRequest request) {
var props = flashPropsService.buildProps(locale, request);
return inertia.render("Admin/Index", props);
}
@GetMapping("/marketing")
public ResponseEntity<?> adminMarketingController(@PathVariable("locale") String locale,
HttpServletRequest request) {
var props = flashPropsService.buildProps(locale, request);
return inertia.render("Admin/Marketing/Index", props);
}
@GetMapping("/knowledgebase")
public ResponseEntity<?> adminKnowledgebaseController(@PathVariable("locale") String locale,
HttpServletRequest request) {
var props = flashPropsService.buildProps(locale, request);
return inertia.render("Admin/Knowledgebase/Index", props);
}
@GetMapping("/interview")
public ResponseEntity<?> adminInterviewController(@PathVariable("locale") String locale,
HttpServletRequest request) {
var props = flashPropsService.buildProps(locale, request);
return inertia.render("Admin/Interview/Index", props);
}
@GetMapping("/grading")
public ResponseEntity<?> adminGradingController(@PathVariable("locale") String locale,
HttpServletRequest request) {
var props = flashPropsService.buildProps(locale, request);
return inertia.render("Admin/Grading/Index", props);
}
@GetMapping("/programs")
public ResponseEntity<?> adminProgramsController(@PathVariable("locale") String locale,
HttpServletRequest request) {
var props = flashPropsService.buildProps(locale, request);
return inertia.render("Admin/Programs/Index", props);
}
@GetMapping("/users")
public ResponseEntity<?> adminUsersController(@PathVariable("locale") String locale,
HttpServletRequest request) {
var props = flashPropsService.buildProps(locale, request);
return inertia.render("Admin/Users/Index", props);
}
@GetMapping("/settings")
public ResponseEntity<?> adminSettingsController(@PathVariable("locale") String locale,
HttpServletRequest request) {
var props = flashPropsService.buildProps(locale, request);
return inertia.render("Admin/Settings/Index", props);
}
@GetMapping("/admin/help")
public ResponseEntity<?> adminHelpController(@PathVariable("locale") String locale,
HttpServletRequest request) {
var props = flashPropsService.buildProps(locale, request);
return inertia.render("Admin/Help/Index", props);
}
}