Skip to content

Commit

Permalink
Merge pull request #2282 from DamnClin/rename-apply-endpoint
Browse files Browse the repository at this point in the history
Rename module apply endpoint
  • Loading branch information
pascalgrimaud authored Jun 28, 2022
2 parents e109701 + 830b696 commit 967c8d3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import tech.jhipster.lite.generator.module.application.JHipsterModulesApplicationService;

@Component
class JHipsterModulesApplicationHandlerMapping extends AbstractUrlHandlerMapping {
class JHipsterModulesPatchApplicationHandlerMapping extends AbstractUrlHandlerMapping {

private final Map<String, JHipsterModuleApplicationController> controllers;

public JHipsterModulesApplicationHandlerMapping(
public JHipsterModulesPatchApplicationHandlerMapping(
ObjectMapper json,
JHipsterModulesResources modulesResources,
JHipsterModulesApplicationService modules
Expand All @@ -31,7 +31,7 @@ private Map<String, JHipsterModuleApplicationController> buildControllers(
}

private Function<JHipsterModuleResource, String> toApplyUrl() {
return moduleResource -> moduleResource.moduleUrl() + "/apply";
return moduleResource -> moduleResource.moduleUrl() + "/apply-patch";
}

private Function<JHipsterModuleResource, JHipsterModuleApplicationController> toApplyerController(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ private Map<String, PathItem> modulesApplications(JHipsterModulesResources modul
return modules
.stream()
.collect(
Collectors.toMap(module -> module.moduleUrl() + "/apply", module -> moduleApplicationDefinition(module.apiDoc(), module.slug()))
Collectors.toMap(
module -> module.moduleUrl() + "/apply-patch",
module -> moduleApplicationDefinition(module.apiDoc(), module.slug())
)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class RestModulesRepository implements ModulesRepository {

apply(module: ModuleSlug, moduleToApply: ModuleToApply): Promise<void> {
return this.axiosInstance
.post<void, RestModuleToApply>(`/api/modules/${module}/apply`, toRestModuleToApply(moduleToApply))
.post<void, RestModuleToApply>(`/api/modules/${module}/apply-patch`, toRestModuleToApply(moduleToApply))
.then(() => undefined);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void applyModuleForDefaultProject(String moduleSlug, Map<String, Object>
}

private String applyModuleUrl(String moduleSlug) {
return moduleUrl(moduleSlug) + "/apply";
return moduleUrl(moduleSlug) + "/apply-patch";
}

private String moduleUrl(String moduleSlug) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/javascript/cypress/integration/Modules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Modules', () => {
cy.intercept({ path: '/api/modules' }, { fixture: 'modules.json' });

cy.intercept({
path: '/api/modules/spring-test/apply',
path: '/api/modules/spring-test/apply-patch',
method: 'POST',
}).as('spring-test-creation');

Expand All @@ -54,7 +54,7 @@ describe('Modules', () => {
cy.intercept({ path: '/api/modules' }, { fixture: 'modules.json' });

cy.intercept({
path: '/api/modules/spring-cucumber/apply',
path: '/api/modules/spring-cucumber/apply-patch',
method: 'POST',
}).as('spring-cucumber-creation');

Expand Down

0 comments on commit 967c8d3

Please sign in to comment.