mirror of
https://github.com/valitydev/org-manager.git
synced 2024-11-06 08:25:21 +00:00
Merge pull request #4 from rbkmoney/ft/BJ-1020/modify-organization
BJ-1020: modify organization **dependecy-track не возможно удовлетворить
This commit is contained in:
commit
92a5f92a39
4
pom.xml
4
pom.xml
@ -21,7 +21,7 @@
|
||||
<java.version>11</java.version>
|
||||
<server.port>8022</server.port>
|
||||
<exposed.ports>${server.port}</exposed.ports>
|
||||
<dockerfile.base.service.tag>57e26d8ee999d7b0b50248c22afc63e6f926d276</dockerfile.base.service.tag>
|
||||
<dockerfile.base.service.tag>c0612d6052ac049496b72a23a04acb142035f249</dockerfile.base.service.tag>
|
||||
<dockerfile.registry>dr2.rbkmoney.com</dockerfile.registry>
|
||||
<shared.resources.version>0.3.6</shared.resources.version>
|
||||
<keycloak.version>11.0.3</keycloak.version>
|
||||
@ -52,7 +52,7 @@
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney</groupId>
|
||||
<artifactId>swag-organizations</artifactId>
|
||||
<version>1.10-260e548-server</version>
|
||||
<version>1.11-5a058ca-server</version>
|
||||
</dependency>
|
||||
|
||||
<!--spring-->
|
||||
|
@ -68,8 +68,8 @@ public class OrgsController implements OrgsApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> revokeInvitation(String xRequestID, String orgId, String invitationId, InlineObject inlineObject) {
|
||||
return invitationService.revoke(orgId, invitationId, inlineObject);
|
||||
public ResponseEntity<Void> revokeInvitation(String xRequestID, String orgId, String invitationId, InlineObject1 inlineObject1) {
|
||||
return invitationService.revoke(orgId, invitationId, inlineObject1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -85,6 +85,11 @@ public class OrgsController implements OrgsApi {
|
||||
return organizationRoleService.list(orgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Organization> patchOrg(String xRequestID, String orgId, InlineObject inlineObject) {
|
||||
return organizationService.modify(orgId, inlineObject.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> assignMemberRole(
|
||||
String xRequestID,
|
||||
|
@ -4,10 +4,7 @@ import com.rbkmoney.orgmanager.converter.InvitationConverter;
|
||||
import com.rbkmoney.orgmanager.entity.InvitationEntity;
|
||||
import com.rbkmoney.orgmanager.repository.InvitationRepository;
|
||||
import com.rbkmoney.orgmanager.repository.OrganizationRepository;
|
||||
import com.rbkmoney.swag.organizations.model.InlineObject;
|
||||
import com.rbkmoney.swag.organizations.model.InlineResponse2002;
|
||||
import com.rbkmoney.swag.organizations.model.Invitation;
|
||||
import com.rbkmoney.swag.organizations.model.InvitationStatusName;
|
||||
import com.rbkmoney.swag.organizations.model.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -75,7 +72,7 @@ public class InvitationService {
|
||||
.results(invitations));
|
||||
}
|
||||
|
||||
public ResponseEntity<Void> revoke(String orgId, String invitationId, InlineObject inlineObject) {
|
||||
public ResponseEntity<Void> revoke(String orgId, String invitationId, InlineObject1 inlineObject) {
|
||||
Optional<InvitationEntity> entity = invitationRepository.findById(invitationId);
|
||||
|
||||
if (entity.isEmpty()) {
|
||||
|
@ -67,6 +67,15 @@ public class OrganizationService {
|
||||
.body(savedOrganization);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public ResponseEntity<Organization> modify(String orgId, String orgName) {
|
||||
OrganizationEntity organizationEntity = organizationRepository.getOne(orgId);
|
||||
organizationEntity.setName(orgName);
|
||||
Organization savedOrganization = organizationConverter.toDomain(organizationEntity);
|
||||
|
||||
return ResponseEntity.ok(savedOrganization);
|
||||
}
|
||||
|
||||
public ResponseEntity<Organization> get(String orgId) {
|
||||
Optional<OrganizationEntity> entity = organizationRepository.findById(orgId);
|
||||
|
||||
|
@ -17,7 +17,6 @@ import com.rbkmoney.swag.organizations.model.OrganizationSearchResult;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -30,7 +29,6 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
|
@ -7,6 +7,7 @@ import com.rbkmoney.orgmanager.entity.OrganizationRoleEntity;
|
||||
import com.rbkmoney.orgmanager.entity.ScopeEntity;
|
||||
import com.rbkmoney.orgmanager.service.OrganizationService;
|
||||
import com.rbkmoney.swag.organizations.model.Organization;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -47,6 +48,32 @@ public class OrganizationRepositoryTest extends AbstractRepositoryTest {
|
||||
@Autowired
|
||||
private OrganizationRoleRepository scopeRepository;
|
||||
|
||||
@Test
|
||||
public void shouldModifyOrganization() {
|
||||
// Given
|
||||
MemberEntity member = MemberEntity.builder()
|
||||
.id("memberId")
|
||||
.email("email")
|
||||
.build();
|
||||
OrganizationEntity organization = OrganizationEntity.builder()
|
||||
.id(ORGANIZATION_ID)
|
||||
.createdAt(LocalDateTime.now())
|
||||
.name("name")
|
||||
.owner("owner")
|
||||
.members(Set.of(member))
|
||||
.build();
|
||||
|
||||
// When
|
||||
organizationRepository.save(organization);
|
||||
|
||||
String modifyOrgName = "testOrgName";
|
||||
organizationService.modify(ORGANIZATION_ID, modifyOrgName);
|
||||
|
||||
Optional<OrganizationEntity> organizationEntityOptional = organizationService.findById(ORGANIZATION_ID);
|
||||
Assert.assertTrue(organizationEntityOptional.isPresent());
|
||||
Assert.assertEquals(modifyOrgName, organizationEntityOptional.get().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldSaveOrganizationWithMembers() {
|
||||
// Given
|
||||
|
@ -4,10 +4,7 @@ import com.rbkmoney.orgmanager.converter.InvitationConverter;
|
||||
import com.rbkmoney.orgmanager.entity.InvitationEntity;
|
||||
import com.rbkmoney.orgmanager.repository.InvitationRepository;
|
||||
import com.rbkmoney.orgmanager.repository.OrganizationRepository;
|
||||
import com.rbkmoney.swag.organizations.model.InlineObject;
|
||||
import com.rbkmoney.swag.organizations.model.InlineResponse2002;
|
||||
import com.rbkmoney.swag.organizations.model.Invitation;
|
||||
import com.rbkmoney.swag.organizations.model.InvitationStatusName;
|
||||
import com.rbkmoney.swag.organizations.model.*;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
@ -154,9 +151,9 @@ public class InvitationServiceTest {
|
||||
.thenReturn(Optional.of(entity));
|
||||
|
||||
// When
|
||||
ResponseEntity<Void> response = service.revoke(orgId, invitationId, new InlineObject()
|
||||
ResponseEntity<Void> response = service.revoke(orgId, invitationId, new InlineObject1()
|
||||
.reason("reason")
|
||||
.status(InlineObject.StatusEnum.REVOKED));
|
||||
.status(InlineObject1.StatusEnum.REVOKED));
|
||||
|
||||
// Then
|
||||
assertThat(entity.getStatus())
|
||||
@ -179,7 +176,7 @@ public class InvitationServiceTest {
|
||||
.thenReturn(Optional.empty());
|
||||
|
||||
// When
|
||||
ResponseEntity<Void> response = service.revoke(orgId, invitationId, new InlineObject());
|
||||
ResponseEntity<Void> response = service.revoke(orgId, invitationId, new InlineObject1());
|
||||
|
||||
// Then
|
||||
assertThat(response.getStatusCode())
|
||||
|
Loading…
Reference in New Issue
Block a user