xfgdfgf
Some checks failed
CI fuzzy controller / container-test-job (push) Failing after 2m53s

This commit is contained in:
Anton Romanov 2025-02-17 13:18:04 +04:00
parent 9666419ed2
commit be3f70f14c
4 changed files with 62 additions and 23 deletions

View File

@ -1,23 +0,0 @@
package ru.ulstu.fc.project.controller;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import ru.ulstu.fc.project.model.Project;
import ru.ulstu.fc.project.model.ProjectForm;
import ru.ulstu.fc.project.service.ProjectRulesService;
import ru.ulstu.fc.project.service.ProjectService;
import ru.ulstu.fc.user.model.UserRoleConstants;
@Controller
@Hidden
@RequestMapping("projectRules")
@Secured({UserRoleConstants.ADMIN})
public class ProjecRulesController {
}

View File

@ -0,0 +1,47 @@
package ru.ulstu.fc.rule.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import ru.ulstu.fc.project.model.Project;
import ru.ulstu.fc.project.model.ProjectForm;
import ru.ulstu.fc.rule.model.Rule;
import ru.ulstu.fc.rule.model.RuleForm;
@Controller
@RequestMapping("rule")
public class RuleController {
private final RuleService ruleService;
public RuleController(RuleService ruleService) {
this.ruleService = ruleService;
}
@GetMapping("/edit/{ruleId}")
public String edit(@PathVariable(value = "ruleId") Integer id, Model model) {
model.addAttribute("rule",
new RuleForm((id != null && id != 0)
? ruleService.getById(id)
: new Rule()));
return "rule/edit";
}
@PostMapping(value = "save", params = "save")
public String save(RuleForm ruleForm, Model model) {
model.addAttribute("rule", ruleService.save(ruleForm));
return "redirect:/project/edit/"+ruleForm.getProjectId();
}
@PostMapping(value = "save", params = "delete")
public String delete(RuleForm ruleForm) {
if (ruleForm != null && ruleForm.getId() != null) {
ruleService.delete(ruleForm);
}
return "redirect:/project/edit/"+ruleForm.getProjectId();
}
}

View File

@ -0,0 +1,5 @@
package ru.ulstu.fc.rule.controller;
public class RuleService {
}

View File

@ -0,0 +1,10 @@
package ru.ulstu.fc.rule.model;
public class RuleForm {
private final Integer projectId;
public Integer getProjectId() {
return projectId;
}
}