diff --git a/.jhipster/Asset.json b/.jhipster/Asset.json index 9c3d4501..cb941126 100644 --- a/.jhipster/Asset.json +++ b/.jhipster/Asset.json @@ -49,7 +49,7 @@ "otherEntityField": "documentDate" } ], - "changelogDate": "20190403083740", + "changelogDate": "20190418143053", "entityTableName": "asset", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/.jhipster/Customer.json b/.jhipster/Customer.json index 76b1a567..dd33afe4 100644 --- a/.jhipster/Customer.json +++ b/.jhipster/Customer.json @@ -90,7 +90,7 @@ "relationshipName": "sepamandate" } ], - "changelogDate": "20190403083735", + "changelogDate": "20190418143050", "entityTableName": "customer", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/.jhipster/Membership.json b/.jhipster/Membership.json index 38b6361e..dff081ff 100644 --- a/.jhipster/Membership.json +++ b/.jhipster/Membership.json @@ -50,7 +50,7 @@ "otherEntityField": "prefix" } ], - "changelogDate": "20190403083738", + "changelogDate": "20190418143051", "entityTableName": "membership", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/.jhipster/SepaMandate.json b/.jhipster/SepaMandate.json index 403ec21d..8e5c7fdf 100644 --- a/.jhipster/SepaMandate.json +++ b/.jhipster/SepaMandate.json @@ -72,7 +72,7 @@ "otherEntityField": "prefix" } ], - "changelogDate": "20190418100951", + "changelogDate": "20190418143054", "entityTableName": "sepa_mandate", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/.jhipster/Share.json b/.jhipster/Share.json index 918983a7..5ea62ab2 100644 --- a/.jhipster/Share.json +++ b/.jhipster/Share.json @@ -49,7 +49,7 @@ "otherEntityField": "documentDate" } ], - "changelogDate": "20190403083739", + "changelogDate": "20190418143052", "entityTableName": "share", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/package-lock.json b/package-lock.json index 96002d14..544d36a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6025,7 +6025,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -6046,7 +6046,7 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true }, "brace-expansion": { "version": "1.1.11", @@ -6066,17 +6066,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -6193,7 +6193,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true }, "ini": { "version": "1.3.5", @@ -6226,7 +6226,7 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true }, "minipass": { "version": "2.3.5", @@ -6330,7 +6330,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -6427,7 +6427,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -6525,12 +6525,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true } } }, diff --git a/src/main/java/org/hostsharing/hsadminng/domain/Membership.java b/src/main/java/org/hostsharing/hsadminng/domain/Membership.java index 2073fef7..d6e4e5bd 100644 --- a/src/main/java/org/hostsharing/hsadminng/domain/Membership.java +++ b/src/main/java/org/hostsharing/hsadminng/domain/Membership.java @@ -30,15 +30,23 @@ public class Membership implements Serializable { private Long id; @NotNull - @Column(name = "since_date", nullable = false) - private LocalDate sinceDate; + @Column(name = "document_date", nullable = false) + private LocalDate documentDate; - @Column(name = "until_date") - private LocalDate untilDate; + @NotNull + @Column(name = "member_from", nullable = false) + private LocalDate memberFrom; - @OneToMany(mappedBy = "member") + @Column(name = "member_until") + private LocalDate memberUntil; + + @Size(max = 160) + @Column(name = "remark", length = 160) + private String remark; + + @OneToMany(mappedBy = "membership") private Set shares = new HashSet<>(); - @OneToMany(mappedBy = "member") + @OneToMany(mappedBy = "membership") private Set assets = new HashSet<>(); @ManyToOne(optional = false) @NotNull @@ -54,30 +62,56 @@ public class Membership implements Serializable { this.id = id; } - public LocalDate getSinceDate() { - return sinceDate; + public LocalDate getDocumentDate() { + return documentDate; } - public Membership sinceDate(LocalDate sinceDate) { - this.sinceDate = sinceDate; + public Membership documentDate(LocalDate documentDate) { + this.documentDate = documentDate; return this; } - public void setSinceDate(LocalDate sinceDate) { - this.sinceDate = sinceDate; + public void setDocumentDate(LocalDate documentDate) { + this.documentDate = documentDate; } - public LocalDate getUntilDate() { - return untilDate; + public LocalDate getMemberFrom() { + return memberFrom; } - public Membership untilDate(LocalDate untilDate) { - this.untilDate = untilDate; + public Membership memberFrom(LocalDate memberFrom) { + this.memberFrom = memberFrom; return this; } - public void setUntilDate(LocalDate untilDate) { - this.untilDate = untilDate; + public void setMemberFrom(LocalDate memberFrom) { + this.memberFrom = memberFrom; + } + + public LocalDate getMemberUntil() { + return memberUntil; + } + + public Membership memberUntil(LocalDate memberUntil) { + this.memberUntil = memberUntil; + return this; + } + + public void setMemberUntil(LocalDate memberUntil) { + this.memberUntil = memberUntil; + } + + public String getRemark() { + return remark; + } + + public Membership remark(String remark) { + this.remark = remark; + return this; + } + + public void setRemark(String remark) { + this.remark = remark; } public Set getShares() { @@ -168,8 +202,10 @@ public class Membership implements Serializable { public String toString() { return "Membership{" + "id=" + getId() + - ", sinceDate='" + getSinceDate() + "'" + - ", untilDate='" + getUntilDate() + "'" + + ", documentDate='" + getDocumentDate() + "'" + + ", memberFrom='" + getMemberFrom() + "'" + + ", memberUntil='" + getMemberUntil() + "'" + + ", remark='" + getRemark() + "'" + "}"; } } diff --git a/src/main/java/org/hostsharing/hsadminng/repository/MembershipRepository.java b/src/main/java/org/hostsharing/hsadminng/repository/MembershipRepository.java index 4f6fb4d1..b62fa01e 100644 --- a/src/main/java/org/hostsharing/hsadminng/repository/MembershipRepository.java +++ b/src/main/java/org/hostsharing/hsadminng/repository/MembershipRepository.java @@ -16,6 +16,6 @@ import org.springframework.stereotype.Repository; public interface MembershipRepository extends JpaRepository, JpaSpecificationExecutor { @Query("SELECT CASE WHEN COUNT(m)> 0 THEN TRUE ELSE FALSE END " + - " FROM Membership m WHERE m.customer.id=:customerId AND m.to IS NULL") + " FROM Membership m WHERE m.customer.id=:customerId AND m.memberUntil IS NULL") boolean hasUncancelledMembershipForCustomer(@Param("customerId") final long customerId); } diff --git a/src/main/java/org/hostsharing/hsadminng/service/MembershipValidator.java b/src/main/java/org/hostsharing/hsadminng/service/MembershipValidator.java index 61d28dd6..359a417b 100644 --- a/src/main/java/org/hostsharing/hsadminng/service/MembershipValidator.java +++ b/src/main/java/org/hostsharing/hsadminng/service/MembershipValidator.java @@ -14,7 +14,7 @@ public class MembershipValidator { private MembershipRepository membershipRepository; public void validate(final MembershipDTO membershipDTO) { - if (membershipDTO.getTo() != null && !membershipDTO.getTo().isAfter(membershipDTO.getFrom())) { + if (membershipDTO.getMemberUntil() != null && !membershipDTO.getMemberUntil().isAfter(membershipDTO.getMemberFrom())) { throw new BadRequestAlertException("Invalid untilDate", Membership.ENTITY_NAME, "untilDateMustBeAfterSinceDate"); } diff --git a/src/main/java/org/hostsharing/hsadminng/service/dto/MembershipDTO.java b/src/main/java/org/hostsharing/hsadminng/service/dto/MembershipDTO.java index 72831def..63956fec 100644 --- a/src/main/java/org/hostsharing/hsadminng/service/dto/MembershipDTO.java +++ b/src/main/java/org/hostsharing/hsadminng/service/dto/MembershipDTO.java @@ -3,6 +3,7 @@ import java.time.LocalDate; import javax.validation.constraints.*; import java.io.Serializable; import java.util.Objects; +import java.util.function.Consumer; /** * A DTO for the Membership entity. diff --git a/src/main/resources/config/liquibase/changelog/20190418073043_added_entity_Customer.xml b/src/main/resources/config/liquibase/changelog/20190418143050_added_entity_Customer.xml similarity index 97% rename from src/main/resources/config/liquibase/changelog/20190418073043_added_entity_Customer.xml rename to src/main/resources/config/liquibase/changelog/20190418143050_added_entity_Customer.xml index 598384eb..fc201b01 100644 --- a/src/main/resources/config/liquibase/changelog/20190418073043_added_entity_Customer.xml +++ b/src/main/resources/config/liquibase/changelog/20190418143050_added_entity_Customer.xml @@ -16,7 +16,7 @@ - + diff --git a/src/main/resources/config/liquibase/changelog/20190418073044_added_entity_Membership.xml b/src/main/resources/config/liquibase/changelog/20190418143051_added_entity_Membership.xml similarity index 97% rename from src/main/resources/config/liquibase/changelog/20190418073044_added_entity_Membership.xml rename to src/main/resources/config/liquibase/changelog/20190418143051_added_entity_Membership.xml index 3daf95d2..db36e0aa 100644 --- a/src/main/resources/config/liquibase/changelog/20190418073044_added_entity_Membership.xml +++ b/src/main/resources/config/liquibase/changelog/20190418143051_added_entity_Membership.xml @@ -16,7 +16,7 @@ - + diff --git a/src/main/resources/config/liquibase/changelog/20190418073044_added_entity_constraints_Membership.xml b/src/main/resources/config/liquibase/changelog/20190418143051_added_entity_constraints_Membership.xml similarity index 93% rename from src/main/resources/config/liquibase/changelog/20190418073044_added_entity_constraints_Membership.xml rename to src/main/resources/config/liquibase/changelog/20190418143051_added_entity_constraints_Membership.xml index 91904792..0f6b6866 100644 --- a/src/main/resources/config/liquibase/changelog/20190418073044_added_entity_constraints_Membership.xml +++ b/src/main/resources/config/liquibase/changelog/20190418143051_added_entity_constraints_Membership.xml @@ -6,7 +6,7 @@ - + - + diff --git a/src/main/resources/config/liquibase/changelog/20190418073045_added_entity_constraints_Share.xml b/src/main/resources/config/liquibase/changelog/20190418143052_added_entity_constraints_Share.xml similarity index 92% rename from src/main/resources/config/liquibase/changelog/20190418073045_added_entity_constraints_Share.xml rename to src/main/resources/config/liquibase/changelog/20190418143052_added_entity_constraints_Share.xml index fcd8cdb2..c52cc369 100644 --- a/src/main/resources/config/liquibase/changelog/20190418073045_added_entity_constraints_Share.xml +++ b/src/main/resources/config/liquibase/changelog/20190418143052_added_entity_constraints_Share.xml @@ -6,7 +6,7 @@ - + - + diff --git a/src/main/resources/config/liquibase/changelog/20190418073046_added_entity_constraints_Asset.xml b/src/main/resources/config/liquibase/changelog/20190418143053_added_entity_constraints_Asset.xml similarity index 92% rename from src/main/resources/config/liquibase/changelog/20190418073046_added_entity_constraints_Asset.xml rename to src/main/resources/config/liquibase/changelog/20190418143053_added_entity_constraints_Asset.xml index 246217d8..dacb9c2b 100644 --- a/src/main/resources/config/liquibase/changelog/20190418073046_added_entity_constraints_Asset.xml +++ b/src/main/resources/config/liquibase/changelog/20190418143053_added_entity_constraints_Asset.xml @@ -6,7 +6,7 @@ - + - + diff --git a/src/main/resources/config/liquibase/changelog/20190418143054_added_entity_constraints_SepaMandate.xml b/src/main/resources/config/liquibase/changelog/20190418143054_added_entity_constraints_SepaMandate.xml new file mode 100644 index 00000000..de60c224 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20190418143054_added_entity_constraints_SepaMandate.xml @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index 1b1e5941..201616d6 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -5,22 +5,15 @@ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> - - - - - - - + + + + + - - - - - + + + + - - - - diff --git a/src/main/webapp/app/entities/entity.module.ts b/src/main/webapp/app/entities/entity.module.ts index 48ab67e5..00686b57 100644 --- a/src/main/webapp/app/entities/entity.module.ts +++ b/src/main/webapp/app/entities/entity.module.ts @@ -1,49 +1,9 @@ -import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; +import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { RouterModule } from '@angular/router'; @NgModule({ imports: [ RouterModule.forChild([ - { - path: 'customer', - loadChildren: './customer/customer.module#HsadminNgCustomerModule' - }, - { - path: 'contact', - loadChildren: './contact/contact.module#HsadminNgContactModule' - }, - { - path: 'customer-contact', - loadChildren: './customer-contact/customer-contact.module#HsadminNgCustomerContactModule' - }, - { - path: 'membership', - loadChildren: './membership/membership.module#HsadminNgMembershipModule' - }, - { - path: 'share', - loadChildren: './share/share.module#HsadminNgShareModule' - }, - { - path: 'asset', - loadChildren: './asset/asset.module#HsadminNgAssetModule' - }, - { - path: 'customer', - loadChildren: './customer/customer.module#HsadminNgCustomerModule' - }, - { - path: 'membership', - loadChildren: './membership/membership.module#HsadminNgMembershipModule' - }, - { - path: 'share', - loadChildren: './share/share.module#HsadminNgShareModule' - }, - { - path: 'asset', - loadChildren: './asset/asset.module#HsadminNgAssetModule' - }, { path: 'customer', loadChildren: './customer/customer.module#HsadminNgCustomerModule' diff --git a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-update.component.ts b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-update.component.ts index 815a3773..ba809340 100644 --- a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-update.component.ts +++ b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-update.component.ts @@ -19,11 +19,11 @@ export class SepaMandateUpdateComponent implements OnInit { isSaving: boolean; customers: ICustomer[]; - createdDp: any; + documentDateDp: any; validFromDp: any; - validToDp: any; + validUntilDp: any; lastUsedDp: any; - cancelledDp: any; + cancellationDateDp: any; constructor( protected jhiAlertService: JhiAlertService, diff --git a/src/test/java/org/hostsharing/hsadminng/repository/MembershipRepositoryIntTest.java b/src/test/java/org/hostsharing/hsadminng/repository/MembershipRepositoryIntTest.java index 94a48e7d..52337747 100644 --- a/src/test/java/org/hostsharing/hsadminng/repository/MembershipRepositoryIntTest.java +++ b/src/test/java/org/hostsharing/hsadminng/repository/MembershipRepositoryIntTest.java @@ -69,7 +69,7 @@ public class MembershipRepositoryIntTest { private Customer createCustomer() { final Customer customer = new Customer(); customer.setPrefix(RandomStringUtils.randomAlphabetic(3).toLowerCase()); - customer.setNumber(RandomUtils.nextInt(10001, 19999)); + customer.setReference(RandomUtils.nextInt(10001, 19999)); customer.setName(RandomStringUtils.randomAlphabetic(10)); customer.setContractualAddress(RandomStringUtils.randomAlphabetic(10)); customerRepository.save(customer); @@ -80,9 +80,9 @@ public class MembershipRepositoryIntTest { final Customer customer = createCustomer(); final Membership membership = new Membership(); membership.setCustomer(customer); - membership.setTo(LocalDate.parse(from)); + membership.setMemberUntil(LocalDate.parse(from)); if (to != null) { - membership.setFrom(LocalDate.parse(to)); + membership.setMemberFrom(LocalDate.parse(to)); } membershipRepository.save(membership); return customer; diff --git a/src/test/java/org/hostsharing/hsadminng/service/MembershipValidatorUnitTest.java b/src/test/java/org/hostsharing/hsadminng/service/MembershipValidatorUnitTest.java index 217602ec..a27c5d21 100644 --- a/src/test/java/org/hostsharing/hsadminng/service/MembershipValidatorUnitTest.java +++ b/src/test/java/org/hostsharing/hsadminng/service/MembershipValidatorUnitTest.java @@ -101,12 +101,12 @@ public class MembershipValidatorUnitTest { GivenMembershipValidationTestCase since(final String sinceDate) { - membershipDto.setFrom(LocalDate.parse(sinceDate)); + membershipDto.setMemberFrom(LocalDate.parse(sinceDate)); return this; } public GivenMembershipValidationTestCase until(final String untilDate) { - membershipDto.setTo(LocalDate.parse(untilDate)); + membershipDto.setMemberUntil(LocalDate.parse(untilDate)); return this; } diff --git a/src/test/java/org/hostsharing/hsadminng/web/rest/CustomerResourceIntTest.java b/src/test/java/org/hostsharing/hsadminng/web/rest/CustomerResourceIntTest.java index 8a3334f1..ce8721fc 100644 --- a/src/test/java/org/hostsharing/hsadminng/web/rest/CustomerResourceIntTest.java +++ b/src/test/java/org/hostsharing/hsadminng/web/rest/CustomerResourceIntTest.java @@ -50,8 +50,8 @@ public class CustomerResourceIntTest { private static final Integer DEFAULT_REFERENCE = 10000; private static final Integer UPDATED_REFERENCE = 10001; - private static final String DEFAULT_PREFIX = "nf"; - private static final String UPDATED_PREFIX = "m2"; + private static final String DEFAULT_PREFIX = "hu"; + private static final String UPDATED_PREFIX = "umj"; private static final String DEFAULT_NAME = "AAAAAAAAAA"; private static final String UPDATED_NAME = "BBBBBBBBBB"; @@ -62,12 +62,6 @@ public class CustomerResourceIntTest { private static final String DEFAULT_CONTRACTUAL_ADDRESS = "AAAAAAAAAA"; private static final String UPDATED_CONTRACTUAL_ADDRESS = "BBBBBBBBBB"; - private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA"; - private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB"; - private static final String DEFAULT_CONTRACTUAL_SALUTATION = "AAAAAAAAAA"; - private static final String UPDATED_CONTRACTUAL_SALUTATION = "BBBBBBBBBB"; - - @Autowired private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA"; private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB"; @@ -77,6 +71,7 @@ public class CustomerResourceIntTest { private static final String DEFAULT_REMARK = "AAAAAAAAAA"; private static final String UPDATED_REMARK = "BBBBBBBBBB"; + @Autowired private CustomerRepository customerRepository; @Autowired @@ -570,41 +565,41 @@ public class CustomerResourceIntTest { @Test @Transactional - public void getAllCustomersByContractualAddressIsEqualToSomething() throws Exception { + public void getAllCustomersByBillingAddressIsEqualToSomething() throws Exception { // Initialize the database customerRepository.saveAndFlush(customer); - // Get all the customerList where contractualAddress equals to DEFAULT_CONTRACTUAL_ADDRESS - defaultCustomerShouldBeFound("contractualAddress.equals=" + DEFAULT_CONTRACTUAL_ADDRESS); + // Get all the customerList where billingAddress equals to DEFAULT_BILLING_ADDRESS + defaultCustomerShouldBeFound("billingAddress.equals=" + DEFAULT_BILLING_ADDRESS); - // Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS - defaultCustomerShouldNotBeFound("contractualAddress.equals=" + UPDATED_CONTRACTUAL_ADDRESS); + // Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS + defaultCustomerShouldNotBeFound("billingAddress.equals=" + UPDATED_BILLING_ADDRESS); } @Test @Transactional - public void getAllCustomersByContractualAddressIsInShouldWork() throws Exception { + public void getAllCustomersByBillingAddressIsInShouldWork() throws Exception { // Initialize the database customerRepository.saveAndFlush(customer); - // Get all the customerList where contractualAddress in DEFAULT_CONTRACTUAL_ADDRESS or UPDATED_CONTRACTUAL_ADDRESS - defaultCustomerShouldBeFound("contractualAddress.in=" + DEFAULT_CONTRACTUAL_ADDRESS + "," + UPDATED_CONTRACTUAL_ADDRESS); + // Get all the customerList where billingAddress in DEFAULT_BILLING_ADDRESS or UPDATED_BILLING_ADDRESS + defaultCustomerShouldBeFound("billingAddress.in=" + DEFAULT_BILLING_ADDRESS + "," + UPDATED_BILLING_ADDRESS); - // Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS - defaultCustomerShouldNotBeFound("contractualAddress.in=" + UPDATED_CONTRACTUAL_ADDRESS); + // Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS + defaultCustomerShouldNotBeFound("billingAddress.in=" + UPDATED_BILLING_ADDRESS); } @Test @Transactional - public void getAllCustomersByContractualAddressIsNullOrNotNull() throws Exception { + public void getAllCustomersByBillingAddressIsNullOrNotNull() throws Exception { // Initialize the database customerRepository.saveAndFlush(customer); - // Get all the customerList where contractualAddress is not null - defaultCustomerShouldBeFound("contractualAddress.specified=true"); + // Get all the customerList where billingAddress is not null + defaultCustomerShouldBeFound("billingAddress.specified=true"); - // Get all the customerList where contractualAddress is null - defaultCustomerShouldNotBeFound("contractualAddress.specified=false"); + // Get all the customerList where billingAddress is null + defaultCustomerShouldNotBeFound("billingAddress.specified=false"); } @Test