5
5
import org .slf4j .Logger ;
6
6
import org .slf4j .LoggerFactory ;
7
7
import org .springframework .beans .factory .annotation .Autowired ;
8
+ import org .springframework .web .bind .annotation .DeleteMapping ;
9
+ import org .springframework .web .bind .annotation .GetMapping ;
10
+ import org .springframework .web .bind .annotation .PatchMapping ;
8
11
import org .springframework .web .bind .annotation .PathVariable ;
9
12
import org .springframework .web .bind .annotation .PostMapping ;
10
13
import org .springframework .web .bind .annotation .PutMapping ;
@@ -67,13 +70,13 @@ public ReadableCatalog createCatalog(
67
70
@ RequestBody @ Valid PersistableCatalog catalog ,
68
71
@ ApiIgnore MerchantStore merchantStore , @ ApiIgnore Language language ) {
69
72
70
- return catalogFacade .saveCatalog (catalog , merchantStore );
73
+ return catalogFacade .saveCatalog (catalog , merchantStore , language );
71
74
72
75
}
73
76
74
- @ PutMapping (value = "/private/catalog/{id}" )
77
+ @ PatchMapping (value = "/private/catalog/{id}" )
75
78
@ ResponseStatus (HttpStatus .OK )
76
- @ ApiOperation (httpMethod = "PUT " , value = "Update catalog" , notes = "" ,
79
+ @ ApiOperation (httpMethod = "PATCH " , value = "Update catalog" , notes = "" ,
77
80
response = Void .class )
78
81
@ ApiImplicitParams ({
79
82
@ ApiImplicitParam (name = "store" , dataType = "String" , defaultValue = "DEFAULT" ),
@@ -84,21 +87,38 @@ public void updateCatalog(
84
87
@ ApiIgnore MerchantStore merchantStore , @ ApiIgnore Language language ) {
85
88
86
89
catalog .setId (id );
87
- catalogFacade .saveCatalog (catalog , merchantStore );
90
+ catalogFacade .updateCatalog (id , catalog , merchantStore , language );
91
+
92
+ }
93
+
94
+ @ GetMapping (value = "/private/catalog/{id}" )
95
+ @ ResponseStatus (HttpStatus .OK )
96
+ @ ApiOperation (httpMethod = "GET" , value = "Get catalog" , notes = "" ,
97
+ response = Void .class )
98
+ @ ApiImplicitParams ({
99
+ @ ApiImplicitParam (name = "store" , dataType = "String" , defaultValue = "DEFAULT" ),
100
+ @ ApiImplicitParam (name = "lang" , dataType = "String" , defaultValue = "en" )})
101
+ public ReadableCatalog getCatalog (
102
+ @ PathVariable Long id ,
103
+ @ ApiIgnore MerchantStore merchantStore , @ ApiIgnore Language language ) {
104
+
105
+ return catalogFacade .getCatalog (id , merchantStore , language );
106
+
88
107
}
89
108
90
109
91
110
92
- /* @DeleteMapping(value = "/private/content/ ")
93
- @ApiOperation(httpMethod = "DETETE", value = "Deletes a file from CMS ", notes = "Delete a file from server ",
111
+ @ DeleteMapping (value = "/private/catalog/{id} " )
112
+ @ ApiOperation (httpMethod = "DETETE" , value = "Deletes a catalog " , notes = "" ,
94
113
response = Void .class )
95
114
@ ApiImplicitParams ({
96
115
@ ApiImplicitParam (name = "store" , dataType = "String" , defaultValue = "DEFAULT" ),
97
116
@ ApiImplicitParam (name = "lang" , dataType = "String" , defaultValue = "en" )})
98
- public void deleteFile (
99
- @Valid ContentName name,
117
+ public void deleteCatalog (
118
+ @ PathVariable Long id ,
100
119
@ ApiIgnore MerchantStore merchantStore ,
101
120
@ ApiIgnore Language language ) {
102
- contentFacade.delete(merchantStore, name.getName(), name.getContentType());
103
- }*/
121
+
122
+ catalogFacade .deleteCatalog (id , merchantStore , language );
123
+ }
104
124
}
0 commit comments