Skip to content

Commit

Permalink
fix: theme update by upload. (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby authored Feb 25, 2021
1 parent 867d170 commit 29466c5
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ThemeController(ThemeService themeService,
this.themeSettingService = themeSettingService;
}

@GetMapping("{themeId}")
@GetMapping("{themeId:.+}")
@ApiOperation("Gets theme property by theme id")
public ThemeProperty getBy(@PathVariable("themeId") String themeId) {
return themeService.getThemeOfNonNullBy(themeId);
Expand All @@ -63,7 +63,7 @@ public List<ThemeFile> listFiles() {
return themeService.listThemeFolderBy(themeService.getActivatedThemeId());
}

@GetMapping("{themeId}/files")
@GetMapping("{themeId:.+}/files")
@ApiOperation("Lists theme files by theme id")
public List<ThemeFile> listFiles(@PathVariable("themeId") String themeId) {
return themeService.listThemeFolderBy(themeId);
Expand All @@ -76,7 +76,7 @@ public BaseResponse<String> getContentBy(@RequestParam(name = "path") String pat
.ok(HttpStatus.OK.getReasonPhrase(), themeService.getTemplateContent(path));
}

@GetMapping("{themeId}/files/content")
@GetMapping("{themeId:.+}/files/content")
@ApiOperation("Gets template content by theme id")
public BaseResponse<String> getContentBy(@PathVariable("themeId") String themeId,
@RequestParam(name = "path") String path) {
Expand All @@ -91,7 +91,7 @@ public void updateContentBy(@RequestBody ThemeContentParam param) {
themeService.saveTemplateContent(param.getPath(), param.getContent());
}

@PutMapping("{themeId}/files/content")
@PutMapping("{themeId:.+}/files/content")
@ApiOperation("Updates template content by theme id")
@DisableOnCondition
public void updateContentBy(@PathVariable("themeId") String themeId,
Expand All @@ -113,7 +113,7 @@ public List<String> customPostTemplate() {
ThemeService.CUSTOM_POST_PREFIX);
}

@PostMapping("{themeId}/activation")
@PostMapping("{themeId:.+}/activation")
@ApiOperation("Activates a theme")
public ThemeProperty active(@PathVariable("themeId") String themeId) {
return themeService.activateTheme(themeId);
Expand All @@ -131,7 +131,7 @@ public BaseResponse<Object> fetchConfig() {
return BaseResponse.ok(themeService.fetchConfig(themeService.getActivatedThemeId()));
}

@GetMapping("{themeId}/configurations")
@GetMapping("{themeId:.+}/configurations")
@ApiOperation("Fetches theme configuration by theme id")
public List<Group> fetchConfig(@PathVariable("themeId") String themeId) {
return themeService.fetchConfig(themeId);
Expand All @@ -143,7 +143,7 @@ public Map<String, Object> listSettingsBy() {
return themeSettingService.listAsMapBy(themeService.getActivatedThemeId());
}

@GetMapping("{themeId}/settings")
@GetMapping("{themeId:.+}/settings")
@ApiOperation("Lists theme settings by theme id")
public Map<String, Object> listSettingsBy(@PathVariable("themeId") String themeId) {
return themeSettingService.listAsMapBy(themeId);
Expand All @@ -155,15 +155,15 @@ public void saveSettingsBy(@RequestBody Map<String, Object> settings) {
themeSettingService.save(settings, themeService.getActivatedThemeId());
}

@PostMapping("{themeId}/settings")
@PostMapping("{themeId:.+}/settings")
@ApiOperation("Saves theme settings")
@CacheLock(prefix = "save_theme_setting_by_themeId")
public void saveSettingsBy(@PathVariable("themeId") String themeId,
@RequestBody Map<String, Object> settings) {
themeSettingService.save(settings, themeId);
}

@DeleteMapping("{themeId}")
@DeleteMapping("{themeId:.+}")
@ApiOperation("Deletes a theme")
@DisableOnCondition
public void deleteBy(@PathVariable("themeId") String themeId,
Expand All @@ -177,8 +177,7 @@ public ThemeProperty uploadTheme(@RequestPart("file") MultipartFile file) {
return themeService.upload(file);
}

@PutMapping("upload/{themeId}")
@PostMapping("upload/{themeId}")
@PutMapping("upload/{themeId:.+}")
@ApiOperation("Upgrades theme by file")
public ThemeProperty updateThemeByUpload(@PathVariable("themeId") String themeId,
@RequestPart("file") MultipartFile file) {
Expand Down Expand Up @@ -228,7 +227,7 @@ public ThemeProperty fetchLatestRelease(@RequestParam("uri") String uri) {
return themeService.fetchLatestRelease(uri);
}

@PutMapping("fetching/{themeId}")
@PutMapping("fetching/{themeId:.+}")
@ApiOperation("Upgrades theme from remote")
public ThemeProperty updateThemeByFetching(@PathVariable("themeId") String themeId) {
return themeService.update(themeId);
Expand Down

0 comments on commit 29466c5

Please sign in to comment.