From 481ffb94aecabde5ddbe929072fb186d42fe9f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20B=C3=A9gaudeau?= Date: Wed, 13 Sep 2023 21:48:13 +0200 Subject: [PATCH] [205] Use Spring Modulith and JMolecules to detail the architecture of the project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://github.com/svalyn/svalyn-studio/issues/205 Signed-off-by: Stéphane Bégaudeau --- .../controllers/viewer/ViewerController.java | 2 +- .../AccountModifiedEventListener.java | 2 +- .../OrganizationCreatedEventListener.java | 2 +- .../ProjectCreatedEventListener.java | 2 +- .../ProjectDeletedEventListener.java | 2 +- .../ProjectModifiedEventListener.java | 2 +- .../account/AuthenticationTokenService.java | 2 +- .../notification/NotificationService.java | 2 +- .../organization/InvitationService.java | 2 +- .../organization/OrganizationService.java | 2 +- backend/svalyn-studio-domain/pom.xml | 43 ++++++++++++++++++ .../svalyn/studio/domain/account/Account.java | 3 +- .../domain/account/AuthenticationToken.java | 2 + .../{authentication => account}/IUser.java | 4 +- .../studio/domain/account/OAuth2Metadata.java | 2 + .../domain/account/PasswordCredentials.java | 2 + .../ProfileProvider.java | 2 +- .../UserIdProvider.java | 5 +-- .../account/events/AccountCreatedEvent.java | 2 + .../account/events/AccountDeletedEvent.java | 2 + .../account/events/AccountModifiedEvent.java | 2 + .../AuthenticationTokenCreatedEvent.java | 2 + .../AuthenticationTokenModifiedEvent.java | 2 + .../events/OAuth2MetadataCreatedEvent.java | 2 + .../studio/domain/account/package-info.java | 30 +++++++++++++ .../account/repositories/package-info.java | 28 ++++++++++++ .../services/AccountUpdateService.java | 2 +- .../services/AuthorizationService.java | 2 +- .../account/services/api/package-info.java | 28 ++++++++++++ .../studio/domain/activity/ActivityEntry.java | 6 ++- .../activity/OrganizationActivityEntry.java | 4 +- .../domain/activity/ProjectActivityEntry.java | 4 +- .../events/ActivityEntryCreatedEvent.java | 2 + ...OrganizationActivityEntryCreatedEvent.java | 2 + .../ProjectActivityEntryCreatedEvent.java | 2 + .../svalyn/studio/domain/business/Domain.java | 6 ++- .../business/events/DomainCreatedEvent.java | 2 + .../svalyn/studio/domain/history/Branch.java | 6 ++- .../svalyn/studio/domain/history/Change.java | 6 ++- .../studio/domain/history/ChangeProposal.java | 6 ++- .../studio/domain/history/ChangeResource.java | 2 + .../svalyn/studio/domain/history/Review.java | 4 +- .../history/events/BranchCreatedEvent.java | 2 + .../history/events/BranchModifiedEvent.java | 2 + .../history/events/ChangeCreatedEvent.java | 2 + .../history/events/ChangeDeletedEvent.java | 2 + .../events/ChangeProposalCreatedEvent.java | 2 + .../events/ChangeProposalDeletedEvent.java | 2 + .../events/ChangeProposalIntegratedEvent.java | 2 + .../events/ChangeProposalModifiedEvent.java | 2 + .../events/ResourcesAddedToChangeEvent.java | 2 + .../ResourcesRemovedFromChangeEvent.java | 2 + .../history/events/ReviewModifiedEvent.java | 2 + .../history/events/ReviewPerformedEvent.java | 2 + .../studio/domain/history/package-info.java | 39 ++++++++++++++++ .../ChangeProposalCreationService.java | 2 +- .../ChangeProposalDeletionService.java | 2 +- .../services/ChangeProposalUpdateService.java | 2 +- .../domain/message/api/package-info.java | 28 ++++++++++++ .../studio/domain/message/package-info.java | 30 +++++++++++++ .../domain/notification/Notification.java | 6 ++- .../events/NotificationCreatedEvent.java | 3 ++ .../events/NotificationMarkedAsDoneEvent.java | 3 ++ .../events/NotificationMarkedAsReadEvent.java | 3 ++ .../NotificationMarkedAsUnreadEvent.java | 3 ++ .../domain/notification/package-info.java | 30 +++++++++++++ .../services/NotificationUpdateService.java | 2 +- .../domain/organization/Invitation.java | 4 +- .../domain/organization/Membership.java | 4 +- .../domain/organization/Organization.java | 6 ++- .../events/InvitationAcceptedEvent.java | 2 + .../events/InvitationDeclinedEvent.java | 2 + .../events/InvitationRevokedEvent.java | 2 + .../events/MemberInvitedEvent.java | 2 + .../organization/events/MemberLeftEvent.java | 2 + .../events/MembershipRevokedEvent.java | 2 + .../events/OrganizationCreatedEvent.java | 2 + .../events/OrganizationDeletedEvent.java | 2 + .../events/OrganizationModifiedEvent.java | 2 + .../domain/organization/package-info.java | 30 +++++++++++++ .../repositories/package-info.java | 28 ++++++++++++ .../services/OrganizationCreationService.java | 2 +- .../services/OrganizationDeletionService.java | 2 +- .../services/OrganizationUpdateService.java | 2 +- .../services/api/package-info.java | 28 ++++++++++++ .../svalyn/studio/domain/project/Project.java | 6 ++- .../project/events/ProjectCreatedEvent.java | 2 + .../project/events/ProjectDeletedEvent.java | 2 + .../project/events/ProjectModifiedEvent.java | 2 + .../studio/domain/project/package-info.java | 36 +++++++++++++++ .../project/repositories/package-info.java | 28 ++++++++++++ .../services/ProjectCreationService.java | 2 +- .../services/ProjectDeletionService.java | 2 +- .../services/ProjectUpdateService.java | 2 +- .../studio/domain/resource/Resource.java | 6 ++- .../resource/events/ResourceCreatedEvent.java | 2 + .../resource/events/ResourceDeletedEvent.java | 2 + .../studio/domain/resource/package-info.java | 30 +++++++++++++ .../resource/repositories/package-info.java | 28 ++++++++++++ .../studio/domain/tag/OrganizationTag.java | 6 ++- .../svalyn/studio/domain/tag/ProjectTag.java | 6 ++- .../com/svalyn/studio/domain/tag/Tag.java | 6 ++- .../events/TagAddedToOrganizationEvent.java | 2 + .../tag/events/TagAddedToProjectEvent.java | 2 + .../domain/tag/events/TagCreatedEvent.java | 2 + .../studio/domain/tag/package-info.java | 38 ++++++++++++++++ .../tag/services/TagCreationService.java | 2 +- .../svalyn/studio/domain/ModularityTests.java | 44 +++++++++++++++++++ .../security/SvalynOAuth2User.java | 2 +- .../security/SvalynSystemUser.java | 2 +- .../security/SvalynUserDetails.java | 2 +- .../java/com/svalyn/studio/package-info.java | 25 +++++++++++ ...thMockPrincipalSecurityContextFactory.java | 2 +- ...nCreatedEventListenerIntegrationTests.java | 2 +- 114 files changed, 767 insertions(+), 64 deletions(-) rename backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/{authentication => account}/IUser.java (93%) rename backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/{authentication => account}/ProfileProvider.java (97%) rename backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/{authentication => account}/UserIdProvider.java (93%) create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/repositories/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/api/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/api/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/repositories/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/api/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/repositories/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/repositories/package-info.java create mode 100644 backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/package-info.java create mode 100644 backend/svalyn-studio-domain/src/test/java/com/svalyn/studio/domain/ModularityTests.java create mode 100644 backend/svalyn-studio/src/main/java/com/svalyn/studio/package-info.java diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/controllers/viewer/ViewerController.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/controllers/viewer/ViewerController.java index 37330893..ac5a58c5 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/controllers/viewer/ViewerController.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/controllers/viewer/ViewerController.java @@ -19,7 +19,7 @@ package com.svalyn.studio.application.controllers.viewer; import com.svalyn.studio.application.services.account.api.IAccountService; -import com.svalyn.studio.domain.authentication.IUser; +import com.svalyn.studio.domain.account.IUser; import org.springframework.graphql.data.method.annotation.QueryMapping; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.stereotype.Controller; diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/AccountModifiedEventListener.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/AccountModifiedEventListener.java index e642a6b2..36aa7dd2 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/AccountModifiedEventListener.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/AccountModifiedEventListener.java @@ -20,7 +20,7 @@ package com.svalyn.studio.application.listeners.notification; import com.svalyn.studio.domain.account.events.AccountModifiedEvent; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.notification.Notification; import com.svalyn.studio.domain.notification.repositories.INotificationRepository; import org.springframework.stereotype.Service; diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/OrganizationCreatedEventListener.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/OrganizationCreatedEventListener.java index faa37a59..e498a515 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/OrganizationCreatedEventListener.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/OrganizationCreatedEventListener.java @@ -19,7 +19,7 @@ package com.svalyn.studio.application.listeners.notification; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.notification.Notification; import com.svalyn.studio.domain.notification.repositories.INotificationRepository; import com.svalyn.studio.domain.organization.events.OrganizationCreatedEvent; diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectCreatedEventListener.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectCreatedEventListener.java index 8c549801..a3a7044e 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectCreatedEventListener.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectCreatedEventListener.java @@ -19,7 +19,7 @@ package com.svalyn.studio.application.listeners.notification; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.notification.Notification; import com.svalyn.studio.domain.notification.repositories.INotificationRepository; import com.svalyn.studio.domain.organization.Membership; diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectDeletedEventListener.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectDeletedEventListener.java index a3192e8c..0227e2b2 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectDeletedEventListener.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectDeletedEventListener.java @@ -19,7 +19,7 @@ package com.svalyn.studio.application.listeners.notification; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.notification.Notification; import com.svalyn.studio.domain.notification.repositories.INotificationRepository; import com.svalyn.studio.domain.organization.Membership; diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectModifiedEventListener.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectModifiedEventListener.java index 80c3fe3f..b045eca4 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectModifiedEventListener.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/listeners/notification/ProjectModifiedEventListener.java @@ -19,7 +19,7 @@ package com.svalyn.studio.application.listeners.notification; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.notification.Notification; import com.svalyn.studio.domain.notification.repositories.INotificationRepository; import com.svalyn.studio.domain.organization.Membership; diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/AuthenticationTokenService.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/AuthenticationTokenService.java index dd22c311..643bb304 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/AuthenticationTokenService.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/AuthenticationTokenService.java @@ -35,7 +35,7 @@ import com.svalyn.studio.domain.account.AuthenticationTokenCreated; import com.svalyn.studio.domain.account.repositories.IAccountRepository; import com.svalyn.studio.domain.account.services.api.IAccountUpdateService; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/notification/NotificationService.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/notification/NotificationService.java index e09b529b..cd1e082a 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/notification/NotificationService.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/notification/NotificationService.java @@ -30,7 +30,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.Success; import com.svalyn.studio.domain.account.repositories.IAccountRepository; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.notification.Notification; import com.svalyn.studio.domain.notification.NotificationStatus; import com.svalyn.studio.domain.notification.repositories.INotificationRepository; diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/organization/InvitationService.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/organization/InvitationService.java index f0dc9427..0bd78363 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/organization/InvitationService.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/organization/InvitationService.java @@ -34,7 +34,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.Success; import com.svalyn.studio.domain.account.repositories.IAccountRepository; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.message.api.IMessageService; import com.svalyn.studio.domain.organization.Invitation; import com.svalyn.studio.domain.organization.Organization; diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/organization/OrganizationService.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/organization/OrganizationService.java index 8ff5fb53..31491c4d 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/organization/OrganizationService.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/organization/OrganizationService.java @@ -34,7 +34,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.Success; import com.svalyn.studio.domain.account.repositories.IAccountRepository; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.organization.Organization; import com.svalyn.studio.domain.organization.repositories.IOrganizationRepository; import com.svalyn.studio.domain.organization.services.api.IOrganizationCreationService; diff --git a/backend/svalyn-studio-domain/pom.xml b/backend/svalyn-studio-domain/pom.xml index 3f8275bc..fdb13bfc 100644 --- a/backend/svalyn-studio-domain/pom.xml +++ b/backend/svalyn-studio-domain/pom.xml @@ -40,6 +40,25 @@ UTF-8 + + + + org.springframework.modulith + spring-modulith-bom + 1.0.0 + import + pom + + + org.jmolecules + jmolecules-bom + 2023.1.0 + import + pom + + + + org.springframework.boot @@ -78,5 +97,29 @@ org.eclipse.emf.ecore.xmi 2.17.0 + + org.springframework.modulith + spring-modulith-core + + + org.jmolecules + jmolecules-ddd + + + org.jmolecules + jmolecules-events + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.modulith + spring-modulith-starter-test + 1.0.0 + test + \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/Account.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/Account.java index 0b109f62..129e5b15 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/Account.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/Account.java @@ -27,7 +27,7 @@ import com.svalyn.studio.domain.account.events.AuthenticationTokenCreatedEvent; import com.svalyn.studio.domain.account.events.AuthenticationTokenModifiedEvent; import com.svalyn.studio.domain.account.events.OAuth2MetadataCreatedEvent; -import com.svalyn.studio.domain.authentication.ProfileProvider; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -48,6 +48,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table(name = "account") public class Account extends AbstractValidatingAggregateRoot implements Persistable { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/AuthenticationToken.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/AuthenticationToken.java index ba6422ae..23a5eeca 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/AuthenticationToken.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/AuthenticationToken.java @@ -19,6 +19,7 @@ package com.svalyn.studio.domain.account; +import org.jmolecules.ddd.annotation.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@Entity @Table(name = "authentication_token") public class AuthenticationToken { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/authentication/IUser.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/IUser.java similarity index 93% rename from backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/authentication/IUser.java rename to backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/IUser.java index 2363abb6..a193e9da 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/authentication/IUser.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/IUser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Stéphane Bégaudeau. + * Copyright (c) 2022-2023 Stéphane Bégaudeau. * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, @@ -16,7 +16,7 @@ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.svalyn.studio.domain.authentication; +package com.svalyn.studio.domain.account; import java.util.UUID; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/OAuth2Metadata.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/OAuth2Metadata.java index bc6465bb..dcb00a9b 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/OAuth2Metadata.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/OAuth2Metadata.java @@ -19,6 +19,7 @@ package com.svalyn.studio.domain.account; +import org.jmolecules.ddd.annotation.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@Entity @Table(name = "oauth2_metadata") public class OAuth2Metadata { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/PasswordCredentials.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/PasswordCredentials.java index 7417a153..c82867fd 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/PasswordCredentials.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/PasswordCredentials.java @@ -19,6 +19,7 @@ package com.svalyn.studio.domain.account; +import org.jmolecules.ddd.annotation.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@Entity @Table(name = "password_credentials") public class PasswordCredentials { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/authentication/ProfileProvider.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/ProfileProvider.java similarity index 97% rename from backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/authentication/ProfileProvider.java rename to backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/ProfileProvider.java index 111a558d..6bfba8d0 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/authentication/ProfileProvider.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/ProfileProvider.java @@ -17,7 +17,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.svalyn.studio.domain.authentication; +package com.svalyn.studio.domain.account; import com.svalyn.studio.domain.Profile; import org.springframework.security.core.Authentication; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/authentication/UserIdProvider.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/UserIdProvider.java similarity index 93% rename from backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/authentication/UserIdProvider.java rename to backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/UserIdProvider.java index f1fecb68..3bc11ee6 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/authentication/UserIdProvider.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/UserIdProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Stéphane Bégaudeau. + * Copyright (c) 2022-2023 Stéphane Bégaudeau. * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, @@ -16,9 +16,8 @@ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.svalyn.studio.domain.authentication; +package com.svalyn.studio.domain.account; -import com.svalyn.studio.domain.account.Account; import org.springframework.data.jdbc.core.mapping.AggregateReference; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountCreatedEvent.java index c850f0fe..adc7cf42 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountCreatedEvent.java @@ -21,6 +21,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.account.Account; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -30,6 +31,7 @@ * * @author sbegaudeau */ +@DomainEvent public record AccountCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountDeletedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountDeletedEvent.java index d0b29e2f..286fd9c4 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountDeletedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountDeletedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.account.Account; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record AccountDeletedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountModifiedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountModifiedEvent.java index be61509f..ca9ddcd0 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountModifiedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AccountModifiedEvent.java @@ -21,6 +21,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.account.Account; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -30,6 +31,7 @@ * * @author sbegaudeau */ +@DomainEvent public record AccountModifiedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AuthenticationTokenCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AuthenticationTokenCreatedEvent.java index e7bfb7b6..b5d1e8a8 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AuthenticationTokenCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AuthenticationTokenCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.account.Account; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record AuthenticationTokenCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AuthenticationTokenModifiedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AuthenticationTokenModifiedEvent.java index b123c6e6..fc419dbc 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AuthenticationTokenModifiedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/AuthenticationTokenModifiedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.account.Account; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record AuthenticationTokenModifiedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/OAuth2MetadataCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/OAuth2MetadataCreatedEvent.java index 6d31bf0e..4dbfdda2 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/OAuth2MetadataCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/events/OAuth2MetadataCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.account.Account; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record OAuth2MetadataCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/package-info.java new file mode 100644 index 00000000..5233a532 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/package-info.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The account bounded context. + * + * @author sbegaudeau + */ +@ApplicationModule( + allowedDependencies = { "message::api" } +) +package com.svalyn.studio.domain.account; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/repositories/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/repositories/package-info.java new file mode 100644 index 00000000..b0a7dd97 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/repositories/package-info.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The repositories of the account bounded context. + * + * @author sbegaudeau + */ +@NamedInterface("repositories") +package com.svalyn.studio.domain.account.repositories; + +import org.springframework.modulith.NamedInterface; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/AccountUpdateService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/AccountUpdateService.java index 069a9b5e..923ebbed 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/AccountUpdateService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/AccountUpdateService.java @@ -28,7 +28,7 @@ import com.svalyn.studio.domain.account.repositories.IAccountRepository; import com.svalyn.studio.domain.account.services.api.IAccountUpdateService; import com.svalyn.studio.domain.account.services.api.IPasswordGenerator; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.message.api.IMessageService; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/AuthorizationService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/AuthorizationService.java index 552af7ed..b043cc34 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/AuthorizationService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/AuthorizationService.java @@ -21,7 +21,7 @@ import com.svalyn.studio.domain.account.AccountRole; import com.svalyn.studio.domain.account.services.api.IAuthorizationService; -import com.svalyn.studio.domain.authentication.IUser; +import com.svalyn.studio.domain.account.IUser; import org.springframework.security.core.Authentication; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/api/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/api/package-info.java new file mode 100644 index 00000000..90b3cf36 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/api/package-info.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The API of the account bounded context. + * + * @author sbegaudeau + */ +@NamedInterface("api") +package com.svalyn.studio.domain.account.services.api; + +import org.springframework.modulith.NamedInterface; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/ActivityEntry.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/ActivityEntry.java index 54e2edfc..060fdf02 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/ActivityEntry.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/ActivityEntry.java @@ -22,8 +22,9 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; import com.svalyn.studio.domain.activity.events.ActivityEntryCreatedEvent; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -39,6 +40,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("activity") public class ActivityEntry extends AbstractValidatingAggregateRoot implements Persistable { @Transient diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/OrganizationActivityEntry.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/OrganizationActivityEntry.java index 0d83882f..2c16f32c 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/OrganizationActivityEntry.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/OrganizationActivityEntry.java @@ -21,8 +21,9 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.activity.events.OrganizationActivityEntryCreatedEvent; -import com.svalyn.studio.domain.authentication.ProfileProvider; +import com.svalyn.studio.domain.account.ProfileProvider; import com.svalyn.studio.domain.organization.Organization; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -39,6 +40,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("organization_activity") public class OrganizationActivityEntry extends AbstractValidatingAggregateRoot implements Persistable { @Transient diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/ProjectActivityEntry.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/ProjectActivityEntry.java index aa47983a..11e0606c 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/ProjectActivityEntry.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/ProjectActivityEntry.java @@ -21,8 +21,9 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.activity.events.ProjectActivityEntryCreatedEvent; -import com.svalyn.studio.domain.authentication.ProfileProvider; +import com.svalyn.studio.domain.account.ProfileProvider; import com.svalyn.studio.domain.project.Project; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -39,6 +40,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("project_activity") public class ProjectActivityEntry extends AbstractValidatingAggregateRoot implements Persistable { @Transient diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/ActivityEntryCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/ActivityEntryCreatedEvent.java index 94594957..3a672080 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/ActivityEntryCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/ActivityEntryCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.activity.ActivityEntry; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ActivityEntryCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/OrganizationActivityEntryCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/OrganizationActivityEntryCreatedEvent.java index 1a892f1c..1a7bcc8d 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/OrganizationActivityEntryCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/OrganizationActivityEntryCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.activity.OrganizationActivityEntry; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record OrganizationActivityEntryCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/ProjectActivityEntryCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/ProjectActivityEntryCreatedEvent.java index 776e3e5f..15397b4d 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/ProjectActivityEntryCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/activity/events/ProjectActivityEntryCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.activity.ProjectActivityEntry; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ProjectActivityEntryCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/business/Domain.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/business/Domain.java index 5b020947..1e702884 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/business/Domain.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/business/Domain.java @@ -21,9 +21,10 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.business.events.DomainCreatedEvent; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -39,6 +40,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("domain") public class Domain extends AbstractValidatingAggregateRoot implements Persistable { @Transient diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/business/events/DomainCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/business/events/DomainCreatedEvent.java index 9630f8e0..b75c481f 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/business/events/DomainCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/business/events/DomainCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.business.Domain; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record DomainCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Branch.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Branch.java index d62010dd..1d2fd296 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Branch.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Branch.java @@ -21,11 +21,12 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.history.events.BranchCreatedEvent; import com.svalyn.studio.domain.history.events.BranchModifiedEvent; import com.svalyn.studio.domain.project.Project; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -42,6 +43,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("branch") public class Branch extends AbstractValidatingAggregateRoot implements Persistable { @Transient diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Change.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Change.java index d7ec8303..a1486f68 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Change.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Change.java @@ -21,12 +21,13 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.history.events.ChangeCreatedEvent; import com.svalyn.studio.domain.history.events.ChangeDeletedEvent; import com.svalyn.studio.domain.history.events.ResourcesAddedToChangeEvent; import com.svalyn.studio.domain.history.events.ResourcesRemovedFromChangeEvent; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -47,6 +48,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("change") public class Change extends AbstractValidatingAggregateRoot implements Persistable { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/ChangeProposal.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/ChangeProposal.java index bb9359d6..68eb4c01 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/ChangeProposal.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/ChangeProposal.java @@ -21,8 +21,8 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.history.events.ChangeProposalCreatedEvent; import com.svalyn.studio.domain.history.events.ChangeProposalDeletedEvent; import com.svalyn.studio.domain.history.events.ChangeProposalIntegratedEvent; @@ -30,6 +30,7 @@ import com.svalyn.studio.domain.history.events.ReviewModifiedEvent; import com.svalyn.studio.domain.history.events.ReviewPerformedEvent; import com.svalyn.studio.domain.project.Project; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -49,6 +50,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("change_proposal") public class ChangeProposal extends AbstractValidatingAggregateRoot implements Persistable { @Transient diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/ChangeResource.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/ChangeResource.java index 980d527f..439852b8 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/ChangeResource.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/ChangeResource.java @@ -20,6 +20,7 @@ package com.svalyn.studio.domain.history; import com.svalyn.studio.domain.resource.Resource; +import org.jmolecules.ddd.annotation.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -35,6 +36,7 @@ * * @author sbegaudeau */ +@Entity @Table("change_resource") public class ChangeResource implements Persistable { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Review.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Review.java index 288c8142..c7c128c0 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Review.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Review.java @@ -20,7 +20,8 @@ package com.svalyn.studio.domain.history; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; +import org.jmolecules.ddd.annotation.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.jdbc.core.mapping.AggregateReference; import org.springframework.data.relational.core.mapping.Table; @@ -34,6 +35,7 @@ * * @author sbegaudeau */ +@Entity @Table(name = "review") public class Review { @Id diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/BranchCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/BranchCreatedEvent.java index e8425ada..ca38f70d 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/BranchCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/BranchCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.history.Branch; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record BranchCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/BranchModifiedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/BranchModifiedEvent.java index aea073c7..b8636ff3 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/BranchModifiedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/BranchModifiedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.history.Branch; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record BranchModifiedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeCreatedEvent.java index 08129a3e..9edfd570 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.history.Change; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ChangeCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeDeletedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeDeletedEvent.java index ffe3b1e3..dbfc97b9 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeDeletedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeDeletedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.history.Change; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ChangeDeletedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalCreatedEvent.java index 0d926433..7b33dcc6 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.history.ChangeProposal; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ChangeProposalCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalDeletedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalDeletedEvent.java index 3d29b504..84d1961c 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalDeletedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalDeletedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.history.ChangeProposal; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ChangeProposalDeletedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalIntegratedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalIntegratedEvent.java index b85d70fc..635dcf9c 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalIntegratedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalIntegratedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.history.ChangeProposal; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ChangeProposalIntegratedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalModifiedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalModifiedEvent.java index f0a9620d..cb865f39 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalModifiedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ChangeProposalModifiedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.history.ChangeProposal; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ChangeProposalModifiedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ResourcesAddedToChangeEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ResourcesAddedToChangeEvent.java index 1eb34001..2be983fa 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ResourcesAddedToChangeEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ResourcesAddedToChangeEvent.java @@ -23,6 +23,7 @@ import com.svalyn.studio.domain.history.Change; import com.svalyn.studio.domain.history.ChangeResource; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.List; @@ -33,6 +34,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ResourcesAddedToChangeEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ResourcesRemovedFromChangeEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ResourcesRemovedFromChangeEvent.java index 6903d40c..bb10af5c 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ResourcesRemovedFromChangeEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ResourcesRemovedFromChangeEvent.java @@ -23,6 +23,7 @@ import com.svalyn.studio.domain.history.Change; import com.svalyn.studio.domain.history.ChangeResource; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.List; @@ -33,6 +34,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ResourcesRemovedFromChangeEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ReviewModifiedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ReviewModifiedEvent.java index 99c87fc2..e72b1519 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ReviewModifiedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ReviewModifiedEvent.java @@ -23,6 +23,7 @@ import com.svalyn.studio.domain.history.ChangeProposal; import com.svalyn.studio.domain.history.Review; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -32,6 +33,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ReviewModifiedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ReviewPerformedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ReviewPerformedEvent.java index 4c047c9a..9f7e796d 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ReviewPerformedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/events/ReviewPerformedEvent.java @@ -23,6 +23,7 @@ import com.svalyn.studio.domain.history.ChangeProposal; import com.svalyn.studio.domain.history.Review; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -32,6 +33,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ReviewPerformedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/package-info.java new file mode 100644 index 00000000..436e0876 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/package-info.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The history bounded context. + * + * @author sbegaudeau + */ +@ApplicationModule( + allowedDependencies = { + "account", + "organization", + "organization::api", + "project", + "project::repositories", + "resource", + "resource::repositories", + "message::api" + } +) +package com.svalyn.studio.domain.history; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalCreationService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalCreationService.java index 1aa8bfa4..4a491950 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalCreationService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalCreationService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.history.Change; import com.svalyn.studio.domain.history.ChangeProposal; import com.svalyn.studio.domain.history.ChangeResource; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalDeletionService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalDeletionService.java index d034c416..510d38d6 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalDeletionService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalDeletionService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.history.ChangeProposal; import com.svalyn.studio.domain.history.repositories.IChangeProposalRepository; import com.svalyn.studio.domain.history.services.api.IChangeProposalDeletionService; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalUpdateService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalUpdateService.java index 5f1d1065..941c7ced 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalUpdateService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/services/ChangeProposalUpdateService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.history.ChangeProposal; import com.svalyn.studio.domain.history.ChangeProposalStatus; import com.svalyn.studio.domain.history.ChangeResource; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/api/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/api/package-info.java new file mode 100644 index 00000000..61f2d832 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/api/package-info.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The API of the message bounded context. + * + * @author sbegaudeau + */ +@NamedInterface("api") +package com.svalyn.studio.domain.message.api; + +import org.springframework.modulith.NamedInterface; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/package-info.java new file mode 100644 index 00000000..a1be5f79 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/package-info.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The message bounded context. + * + * @author sbegaudeau + */ +@ApplicationModule( + allowedDependencies = { } +) +package com.svalyn.studio.domain.message; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/Notification.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/Notification.java index 693f97b7..0de3bfac 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/Notification.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/Notification.java @@ -21,12 +21,13 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.notification.events.NotificationCreatedEvent; import com.svalyn.studio.domain.notification.events.NotificationMarkedAsDoneEvent; import com.svalyn.studio.domain.notification.events.NotificationMarkedAsReadEvent; import com.svalyn.studio.domain.notification.events.NotificationMarkedAsUnreadEvent; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -42,6 +43,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("notification") public class Notification extends AbstractValidatingAggregateRoot implements Persistable { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationCreatedEvent.java index 77b72493..60c3df5d 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationCreatedEvent.java @@ -23,6 +23,8 @@ import com.svalyn.studio.domain.notification.Notification; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; + import java.time.Instant; import java.util.UUID; @@ -31,6 +33,7 @@ * * @author sbegaudeau */ +@DomainEvent public record NotificationCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsDoneEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsDoneEvent.java index 93d5107a..754da439 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsDoneEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsDoneEvent.java @@ -23,6 +23,8 @@ import com.svalyn.studio.domain.notification.Notification; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; + import java.time.Instant; import java.util.UUID; @@ -31,6 +33,7 @@ * * @author sbegaudeau */ +@DomainEvent public record NotificationMarkedAsDoneEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsReadEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsReadEvent.java index 17944431..79b6acd7 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsReadEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsReadEvent.java @@ -23,6 +23,8 @@ import com.svalyn.studio.domain.notification.Notification; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; + import java.time.Instant; import java.util.UUID; @@ -31,6 +33,7 @@ * * @author sbegaudeau */ +@DomainEvent public record NotificationMarkedAsReadEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsUnreadEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsUnreadEvent.java index d38325f0..02abe7c0 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsUnreadEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/events/NotificationMarkedAsUnreadEvent.java @@ -23,6 +23,8 @@ import com.svalyn.studio.domain.notification.Notification; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; + import java.time.Instant; import java.util.UUID; @@ -31,6 +33,7 @@ * * @author sbegaudeau */ +@DomainEvent public record NotificationMarkedAsUnreadEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/package-info.java new file mode 100644 index 00000000..f16f1a62 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/package-info.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The notification bounded context. + * + * @author sbegaudeau + */ +@ApplicationModule( + allowedDependencies = { "account" } +) +package com.svalyn.studio.domain.notification; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/services/NotificationUpdateService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/services/NotificationUpdateService.java index 0716400d..13ac2469 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/services/NotificationUpdateService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/services/NotificationUpdateService.java @@ -21,7 +21,7 @@ import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.notification.NotificationStatus; import com.svalyn.studio.domain.notification.repositories.INotificationRepository; import com.svalyn.studio.domain.notification.services.api.INotificationUpdateService; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Invitation.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Invitation.java index 8a303898..ef4ee320 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Invitation.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Invitation.java @@ -19,7 +19,8 @@ package com.svalyn.studio.domain.organization; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; +import org.jmolecules.ddd.annotation.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.jdbc.core.mapping.AggregateReference; import org.springframework.data.relational.core.mapping.Table; @@ -33,6 +34,7 @@ * * @author sbegaudeau */ +@Entity @Table(name = "invitation") public class Invitation { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Membership.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Membership.java index 259df124..892c3152 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Membership.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Membership.java @@ -19,7 +19,8 @@ package com.svalyn.studio.domain.organization; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; +import org.jmolecules.ddd.annotation.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.jdbc.core.mapping.AggregateReference; import org.springframework.data.relational.core.mapping.Table; @@ -33,6 +34,7 @@ * * @author sbegaudeau */ +@Entity @Table(name = "membership") public class Membership { @Id diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Organization.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Organization.java index abeae5ed..cdf77b80 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Organization.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/Organization.java @@ -20,8 +20,8 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.organization.events.InvitationAcceptedEvent; import com.svalyn.studio.domain.organization.events.InvitationDeclinedEvent; import com.svalyn.studio.domain.organization.events.InvitationRevokedEvent; @@ -31,6 +31,7 @@ import com.svalyn.studio.domain.organization.events.OrganizationCreatedEvent; import com.svalyn.studio.domain.organization.events.OrganizationDeletedEvent; import com.svalyn.studio.domain.organization.events.OrganizationModifiedEvent; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -54,6 +55,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("organization") public class Organization extends AbstractValidatingAggregateRoot implements Persistable { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationAcceptedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationAcceptedEvent.java index f04449d6..cab9d1ff 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationAcceptedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationAcceptedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.organization.Invitation; import com.svalyn.studio.domain.organization.Organization; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record InvitationAcceptedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationDeclinedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationDeclinedEvent.java index 872f7482..e5bc7a4f 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationDeclinedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationDeclinedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.organization.Invitation; import com.svalyn.studio.domain.organization.Organization; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record InvitationDeclinedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationRevokedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationRevokedEvent.java index 01bab87d..db9df94a 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationRevokedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/InvitationRevokedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.organization.Invitation; import com.svalyn.studio.domain.organization.Organization; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record InvitationRevokedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MemberInvitedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MemberInvitedEvent.java index 6579c364..0a025ff3 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MemberInvitedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MemberInvitedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.organization.Invitation; import com.svalyn.studio.domain.organization.Organization; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record MemberInvitedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MemberLeftEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MemberLeftEvent.java index 52a75a04..8ea78197 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MemberLeftEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MemberLeftEvent.java @@ -21,6 +21,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.organization.Organization; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -30,6 +31,7 @@ * * @author sbegaudeau */ +@DomainEvent public record MemberLeftEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MembershipRevokedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MembershipRevokedEvent.java index f9a14ff6..fafd113e 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MembershipRevokedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/MembershipRevokedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.organization.Membership; import com.svalyn.studio.domain.organization.Organization; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record MembershipRevokedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationCreatedEvent.java index 7b7b1db1..432cea4e 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationCreatedEvent.java @@ -21,6 +21,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.organization.Organization; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -30,6 +31,7 @@ * * @author sbegaudeau */ +@DomainEvent public record OrganizationCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationDeletedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationDeletedEvent.java index 2aa5ea9d..034cd3c6 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationDeletedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationDeletedEvent.java @@ -21,6 +21,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.organization.Organization; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -30,6 +31,7 @@ * * @author sbegaudeau */ +@DomainEvent public record OrganizationDeletedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationModifiedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationModifiedEvent.java index 688a481b..0cdbe192 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationModifiedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/events/OrganizationModifiedEvent.java @@ -21,6 +21,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.organization.Organization; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -30,6 +31,7 @@ * * @author sbegaudeau */ +@DomainEvent public record OrganizationModifiedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/package-info.java new file mode 100644 index 00000000..38239897 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/package-info.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The organization bounded context. + * + * @author sbegaudeau + */ +@ApplicationModule( + allowedDependencies = { "account", "account::repositories", "message::api" } +) +package com.svalyn.studio.domain.organization; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/repositories/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/repositories/package-info.java new file mode 100644 index 00000000..e5da19bf --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/repositories/package-info.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The repositories of the organization bounded context. + * + * @author sbegaudeau + */ +@NamedInterface("repositories") +package com.svalyn.studio.domain.organization.repositories; + +import org.springframework.modulith.NamedInterface; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationCreationService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationCreationService.java index 4e4adeb4..dff39cee 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationCreationService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationCreationService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.message.api.IMessageService; import com.svalyn.studio.domain.organization.Organization; import com.svalyn.studio.domain.organization.repositories.IOrganizationRepository; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationDeletionService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationDeletionService.java index 0633408b..b348e404 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationDeletionService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationDeletionService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.message.api.IMessageService; import com.svalyn.studio.domain.organization.MembershipRole; import com.svalyn.studio.domain.organization.repositories.IOrganizationRepository; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationUpdateService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationUpdateService.java index ec363a81..107dabd2 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationUpdateService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/OrganizationUpdateService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.message.api.IMessageService; import com.svalyn.studio.domain.organization.MembershipRole; import com.svalyn.studio.domain.organization.repositories.IOrganizationRepository; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/api/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/api/package-info.java new file mode 100644 index 00000000..3e5b3583 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/api/package-info.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The API of the organization bounded context. + * + * @author sbegaudeau + */ +@NamedInterface("api") +package com.svalyn.studio.domain.organization.services.api; + +import org.springframework.modulith.NamedInterface; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/Project.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/Project.java index e3cf832c..10d27b16 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/Project.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/Project.java @@ -21,12 +21,13 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.organization.Organization; import com.svalyn.studio.domain.project.events.ProjectCreatedEvent; import com.svalyn.studio.domain.project.events.ProjectDeletedEvent; import com.svalyn.studio.domain.project.events.ProjectModifiedEvent; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -43,6 +44,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("project") public class Project extends AbstractValidatingAggregateRoot implements Persistable { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectCreatedEvent.java index 6cab89db..25c862cc 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.project.Project; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ProjectCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectDeletedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectDeletedEvent.java index 68494da6..8a1994e2 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectDeletedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectDeletedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.project.Project; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ProjectDeletedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectModifiedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectModifiedEvent.java index 88669819..7ec8720e 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectModifiedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/events/ProjectModifiedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.project.Project; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ProjectModifiedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/package-info.java new file mode 100644 index 00000000..cd9a3fcd --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/package-info.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The project bounded context. + * + * @author sbegaudeau + */ +@ApplicationModule( + allowedDependencies = { + "account", + "organization", + "organization::api", + "organization::repositories", + "message::api" + } +) +package com.svalyn.studio.domain.project; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/repositories/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/repositories/package-info.java new file mode 100644 index 00000000..71743a32 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/repositories/package-info.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The repositories of the project bounded context. + * + * @author sbegaudeau + */ +@NamedInterface("repositories") +package com.svalyn.studio.domain.project.repositories; + +import org.springframework.modulith.NamedInterface; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectCreationService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectCreationService.java index 09f3101f..e25e6e9c 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectCreationService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectCreationService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.message.api.IMessageService; import com.svalyn.studio.domain.organization.MembershipRole; import com.svalyn.studio.domain.organization.repositories.IOrganizationRepository; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectDeletionService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectDeletionService.java index fc956762..98ff5882 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectDeletionService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectDeletionService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.message.api.IMessageService; import com.svalyn.studio.domain.organization.MembershipRole; import com.svalyn.studio.domain.organization.repositories.IOrganizationRepository; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectUpdateService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectUpdateService.java index fbeb1ec2..5934b39e 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectUpdateService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/services/ProjectUpdateService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.message.api.IMessageService; import com.svalyn.studio.domain.organization.MembershipRole; import com.svalyn.studio.domain.organization.repositories.IOrganizationRepository; diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/Resource.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/Resource.java index 8b8c115c..602eb0b9 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/Resource.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/Resource.java @@ -21,10 +21,11 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.resource.events.ResourceCreatedEvent; import com.svalyn.studio.domain.resource.events.ResourceDeletedEvent; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -40,6 +41,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("resource") public class Resource extends AbstractValidatingAggregateRoot implements Persistable { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/events/ResourceCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/events/ResourceCreatedEvent.java index a560f600..c276981f 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/events/ResourceCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/events/ResourceCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.resource.Resource; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ResourceCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/events/ResourceDeletedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/events/ResourceDeletedEvent.java index 4cb65205..76773835 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/events/ResourceDeletedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/events/ResourceDeletedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.resource.Resource; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record ResourceDeletedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/package-info.java new file mode 100644 index 00000000..0c37956d --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/package-info.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The resource bounded context. + * + * @author sbegaudeau + */ +@ApplicationModule( + allowedDependencies = { "account", "message::api" } +) +package com.svalyn.studio.domain.resource; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/repositories/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/repositories/package-info.java new file mode 100644 index 00000000..68b97e99 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/repositories/package-info.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The repositories of the resource bounded context. + * + * @author sbegaudeau + */ +@NamedInterface("repositories") +package com.svalyn.studio.domain.resource.repositories; + +import org.springframework.modulith.NamedInterface; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/OrganizationTag.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/OrganizationTag.java index 24a5baeb..8c46ef18 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/OrganizationTag.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/OrganizationTag.java @@ -21,10 +21,11 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.organization.Organization; import com.svalyn.studio.domain.tag.events.TagAddedToOrganizationEvent; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -41,6 +42,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table(name = "organization_tag") public class OrganizationTag extends AbstractValidatingAggregateRoot implements Persistable { diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/ProjectTag.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/ProjectTag.java index da5d4c40..cd6e7364 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/ProjectTag.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/ProjectTag.java @@ -21,10 +21,11 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.project.Project; import com.svalyn.studio.domain.tag.events.TagAddedToProjectEvent; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -41,6 +42,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table(name = "project_tag") public class ProjectTag extends AbstractValidatingAggregateRoot implements Persistable { @Transient diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/Tag.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/Tag.java index 2ffed4ac..3f5d022a 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/Tag.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/Tag.java @@ -21,9 +21,10 @@ import com.svalyn.studio.domain.AbstractValidatingAggregateRoot; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.ProfileProvider; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.ProfileProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.tag.events.TagCreatedEvent; +import org.jmolecules.ddd.annotation.AggregateRoot; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -39,6 +40,7 @@ * * @author sbegaudeau */ +@AggregateRoot @Table("tag") public class Tag extends AbstractValidatingAggregateRoot implements Persistable { @Transient diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagAddedToOrganizationEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagAddedToOrganizationEvent.java index c99bc339..dfe3ebf6 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagAddedToOrganizationEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagAddedToOrganizationEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.tag.OrganizationTag; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record TagAddedToOrganizationEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagAddedToProjectEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagAddedToProjectEvent.java index 00e99438..e8d1509c 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagAddedToProjectEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagAddedToProjectEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.tag.ProjectTag; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record TagAddedToProjectEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagCreatedEvent.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagCreatedEvent.java index b56363ea..521fec0b 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagCreatedEvent.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/events/TagCreatedEvent.java @@ -22,6 +22,7 @@ import com.svalyn.studio.domain.Profile; import com.svalyn.studio.domain.tag.Tag; import jakarta.validation.constraints.NotNull; +import org.jmolecules.event.annotation.DomainEvent; import java.time.Instant; import java.util.UUID; @@ -31,6 +32,7 @@ * * @author sbegaudeau */ +@DomainEvent public record TagCreatedEvent( @NotNull UUID id, @NotNull Instant createdOn, diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/package-info.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/package-info.java new file mode 100644 index 00000000..02a05916 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/package-info.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * The tag bounded context. + * + * @author sbegaudeau + */ +@ApplicationModule( + allowedDependencies = { + "account", + "organization", + "organization::api", + "organization::repositories", + "project", + "project::repositories", + "message::api" + } +) +package com.svalyn.studio.domain.tag; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file diff --git a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/services/TagCreationService.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/services/TagCreationService.java index c30b2697..d1beaa6c 100644 --- a/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/services/TagCreationService.java +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/services/TagCreationService.java @@ -22,7 +22,7 @@ import com.svalyn.studio.domain.Failure; import com.svalyn.studio.domain.IResult; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.message.api.IMessageService; import com.svalyn.studio.domain.organization.MembershipRole; import com.svalyn.studio.domain.organization.repositories.IOrganizationRepository; diff --git a/backend/svalyn-studio-domain/src/test/java/com/svalyn/studio/domain/ModularityTests.java b/backend/svalyn-studio-domain/src/test/java/com/svalyn/studio/domain/ModularityTests.java new file mode 100644 index 00000000..e6abad2e --- /dev/null +++ b/backend/svalyn-studio-domain/src/test/java/com/svalyn/studio/domain/ModularityTests.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package com.svalyn.studio.domain; + +import org.junit.jupiter.api.Test; +import org.springframework.modulith.core.ApplicationModules; +import org.springframework.modulith.docs.Documenter; + +/** + * Ensure the respect of the modularity rules of the account aggregate. + * + * @author sbegaudeau + */ +public class ModularityTests { + + private final ApplicationModules domainModules = ApplicationModules.of("com.svalyn.studio.domain"); + + @Test + public void verifyModules() { + this.domainModules.verify(); + + new Documenter(this.domainModules).writeDocumentation() + .writeModuleCanvases() + .writeIndividualModulesAsPlantUml() + .writeModulesAsPlantUml(); + } +} diff --git a/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynOAuth2User.java b/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynOAuth2User.java index 084ade75..83180545 100644 --- a/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynOAuth2User.java +++ b/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynOAuth2User.java @@ -19,7 +19,7 @@ package com.svalyn.studio.infrastructure.security; import com.svalyn.studio.domain.account.Account; -import com.svalyn.studio.domain.authentication.IUser; +import com.svalyn.studio.domain.account.IUser; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.oauth2.core.OAuth2AccessToken; diff --git a/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynSystemUser.java b/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynSystemUser.java index 8347f840..6105b523 100644 --- a/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynSystemUser.java +++ b/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynSystemUser.java @@ -19,7 +19,7 @@ package com.svalyn.studio.infrastructure.security; -import com.svalyn.studio.domain.authentication.IUser; +import com.svalyn.studio.domain.account.IUser; import java.io.Serializable; import java.util.Objects; diff --git a/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynUserDetails.java b/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynUserDetails.java index 15f1be77..1f5e6b1a 100644 --- a/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynUserDetails.java +++ b/backend/svalyn-studio-infrastructure/src/main/java/com/svalyn/studio/infrastructure/security/SvalynUserDetails.java @@ -19,7 +19,7 @@ package com.svalyn.studio.infrastructure.security; -import com.svalyn.studio.domain.authentication.IUser; +import com.svalyn.studio.domain.account.IUser; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; diff --git a/backend/svalyn-studio/src/main/java/com/svalyn/studio/package-info.java b/backend/svalyn-studio/src/main/java/com/svalyn/studio/package-info.java new file mode 100644 index 00000000..89587d8b --- /dev/null +++ b/backend/svalyn-studio/src/main/java/com/svalyn/studio/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 Stéphane Bégaudeau. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +@ApplicationModule( + allowedDependencies = { } +) +package com.svalyn.studio; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file diff --git a/backend/svalyn-studio/src/test/java/com/svalyn/studio/WithMockPrincipalSecurityContextFactory.java b/backend/svalyn-studio/src/test/java/com/svalyn/studio/WithMockPrincipalSecurityContextFactory.java index 32e458ee..36b54dd3 100644 --- a/backend/svalyn-studio/src/test/java/com/svalyn/studio/WithMockPrincipalSecurityContextFactory.java +++ b/backend/svalyn-studio/src/test/java/com/svalyn/studio/WithMockPrincipalSecurityContextFactory.java @@ -19,7 +19,7 @@ package com.svalyn.studio; import com.svalyn.studio.domain.account.repositories.IAccountRepository; -import com.svalyn.studio.domain.authentication.IUser; +import com.svalyn.studio.domain.account.IUser; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/backend/svalyn-studio/src/test/java/com/svalyn/studio/domain/notification/OrganizationCreatedEventListenerIntegrationTests.java b/backend/svalyn-studio/src/test/java/com/svalyn/studio/domain/notification/OrganizationCreatedEventListenerIntegrationTests.java index 0e959a4f..292ec7b8 100644 --- a/backend/svalyn-studio/src/test/java/com/svalyn/studio/domain/notification/OrganizationCreatedEventListenerIntegrationTests.java +++ b/backend/svalyn-studio/src/test/java/com/svalyn/studio/domain/notification/OrganizationCreatedEventListenerIntegrationTests.java @@ -23,7 +23,7 @@ import com.svalyn.studio.DomainEvents; import com.svalyn.studio.WithMockPrincipal; import com.svalyn.studio.domain.Success; -import com.svalyn.studio.domain.authentication.UserIdProvider; +import com.svalyn.studio.domain.account.UserIdProvider; import com.svalyn.studio.domain.notification.events.NotificationCreatedEvent; import com.svalyn.studio.domain.notification.repositories.INotificationRepository; import com.svalyn.studio.domain.organization.events.OrganizationCreatedEvent;