Made index redirect to the upload page

This commit is contained in:
Rostislav Raykov
2024-10-06 23:57:06 +03:00
parent 6ad142ec55
commit 33b53792b5
2 changed files with 23 additions and 2 deletions

View File

@@ -25,6 +25,11 @@ public class FileViewController {
this.fileService = fileService;
}
@GetMapping("/upload")
public String showUploadFile() {
return "upload";
}
@PostMapping("/upload")
public String saveFile(@RequestParam("file") MultipartFile file,
@RequestParam("description") String description,
@@ -64,8 +69,10 @@ public class FileViewController {
}
@PostMapping("/extend/{id}")
public String extendFile(@PathVariable Long id) {
public String extendFile(@PathVariable Long id, Model model) {
fileService.extendFile(id);
return "redirect:/file/list";
model.addAttribute("file", fileService.getFile(id));
return "fileView";
}
}

View File

@@ -0,0 +1,14 @@
package org.rostislav.quickdrop.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.view.RedirectView;
@Controller
public class IndexViewController {
@GetMapping("/")
public RedirectView index() {
return new RedirectView("/file/upload");
}
}