mirror of https://github.com/halo-dev/halo
				
				
				
			Create menu get api for menu.
							parent
							
								
									d7aebebf18
								
							
						
					
					
						commit
						473f17c257
					
				| 
						 | 
				
			
			@ -44,6 +44,18 @@ public class MenuController {
 | 
			
		|||
        return menuService.listAsTree(sort);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get menu by menuId.
 | 
			
		||||
     *
 | 
			
		||||
     * @param menuId menuId
 | 
			
		||||
     * @return MenuDTO
 | 
			
		||||
     */
 | 
			
		||||
    @GetMapping("{menuId:\\d+}")
 | 
			
		||||
    @ApiOperation("Get menu detail by id")
 | 
			
		||||
    public MenuDTO getBy(@PathVariable("menuId") Integer menuId) {
 | 
			
		||||
        return new MenuDTO().convertFrom(menuService.getById(menuId));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping
 | 
			
		||||
    @ApiOperation("Creates a menu")
 | 
			
		||||
    public MenuDTO createBy(@RequestBody @Valid MenuParam menuParam) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -75,7 +75,21 @@ public class PhotoController {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping
 | 
			
		||||
    public Photo createBy(@Valid @RequestBody PhotoParam photoParam) {
 | 
			
		||||
        return photoService.createBy(photoParam);
 | 
			
		||||
    public PhotoDTO createBy(@Valid @RequestBody PhotoParam photoParam) {
 | 
			
		||||
        return new PhotoDTO().convertFrom(photoService.createBy(photoParam));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PutMapping("{photoId:\\d+}")
 | 
			
		||||
    @ApiOperation("Updates a photo")
 | 
			
		||||
    public PhotoDTO updateBy(@PathVariable("photoId") Integer photoId,
 | 
			
		||||
                             @RequestBody @Valid PhotoParam photoParam) {
 | 
			
		||||
        // Get the photo
 | 
			
		||||
        Photo photo = photoService.getById(photoId);
 | 
			
		||||
 | 
			
		||||
        // Update changed properties of the photo
 | 
			
		||||
        photoParam.update(photo);
 | 
			
		||||
 | 
			
		||||
        // Update menu in database
 | 
			
		||||
        return new PhotoDTO().convertFrom(photoService.update(photo));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,4 +24,8 @@ public class PhotoDTO implements OutputConverter<PhotoDTO, Photo> {
 | 
			
		|||
    private String url;
 | 
			
		||||
 | 
			
		||||
    private String team;
 | 
			
		||||
 | 
			
		||||
    private String location;
 | 
			
		||||
 | 
			
		||||
    private String description;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue