Skip to content

Commit

Permalink
commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
s7monk committed Jan 24, 2024
1 parent 671f262 commit 1a281e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ public CatalogController(CatalogService catalogService) {
@PostMapping("/create")
public R<Void> createCatalog(@RequestBody CatalogDTO catalogDTO) {
try {
return catalogService.createCatalog(catalogDTO);
if (catalogService.checkCatalogNameUnique(catalogDTO)) {
return R.failed(Status.CATALOG_NAME_IS_EXIST, catalogDTO.getName());
}
catalogService.createCatalog(catalogDTO);
return R.succeed();
} catch (Exception e) {
log.error("Exception with creating catalog.", e);
return R.failed(Status.CATALOG_CREATE_ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ public interface CatalogService extends IService<CatalogInfo> {
* @param catalogDTO catalog for the catalog.
* @return The created catalog.
*/
R<Void> createCatalog(CatalogDTO catalogDTO);
void createCatalog(CatalogDTO catalogDTO);
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ public boolean checkCatalogNameUnique(CatalogDTO catalogDTO) {
}

@Override
public R<Void> createCatalog(CatalogDTO catalogDTO) {
if (checkCatalogNameUnique(catalogDTO)) {
return R.failed(Status.CATALOG_NAME_IS_EXIST, catalogDTO.getName());
}

public void createCatalog(CatalogDTO catalogDTO) {
if (catalogDTO.getType().equalsIgnoreCase(CatalogMode.FILESYSTEM.getMode())) {
PaimonServiceFactory.createFileSystemCatalogService(
catalogDTO.getName(), catalogDTO.getWarehouse(), catalogDTO.getOptions());
Expand Down

0 comments on commit 1a281e4

Please sign in to comment.