diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/controllers/account/package-info.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/controllers/account/package-info.java new file mode 100644 index 00000000..0fab94e5 --- /dev/null +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/controllers/account/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 = { "account" } +) +package com.svalyn.studio.application.controllers.account; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file 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/account/package-info.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/package-info.java new file mode 100644 index 00000000..240ce81c --- /dev/null +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/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 = { "account", "account::api" } +) +package com.svalyn.studio.application.services.account; + +import org.springframework.modulith.ApplicationModule; \ No newline at end of file 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..654184b7 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,25 @@ org.eclipse.emf.ecore.xmi 2.17.0 + + org.springframework.modulith + spring-modulith-core + + + org.jmolecules + jmolecules-ddd + + + + 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/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/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/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..4b6632af --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/package-info.java @@ -0,0 +1,24 @@ +/* + * 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 = { "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..ac3a3335 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/repositories/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +@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..48578934 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/account/services/api/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +@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/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/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/Review.java b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/Review.java index 288c8142..a7867045 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,7 @@ 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.springframework.data.annotation.Id; import org.springframework.data.jdbc.core.mapping.AggregateReference; import org.springframework.data.relational.core.mapping.Table; 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..676e173a --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/history/package-info.java @@ -0,0 +1,34 @@ +/* + * 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 = { + "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..285f5e58 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/api/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +@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..04cd02b8 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/message/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.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/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..80678b29 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/notification/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 = { "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..127610a1 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,7 @@ 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.springframework.data.annotation.Id; import org.springframework.data.jdbc.core.mapping.AggregateReference; import org.springframework.data.relational.core.mapping.Table; 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..39c414eb 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,7 @@ 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.springframework.data.annotation.Id; import org.springframework.data.jdbc.core.mapping.AggregateReference; import org.springframework.data.relational.core.mapping.Table; 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/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..a94a3911 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/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 = { "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..ae10170d --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/repositories/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +@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..4543506f --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/organization/services/api/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +@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/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..b10ddad5 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/package-info.java @@ -0,0 +1,31 @@ +/* + * 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 = { + "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..560b39b9 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/project/repositories/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +@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/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..8298e482 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/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 = { "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..7f206a80 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/resource/repositories/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +@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/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..ef56d196 --- /dev/null +++ b/backend/svalyn-studio-domain/src/main/java/com/svalyn/studio/domain/tag/package-info.java @@ -0,0 +1,33 @@ +/* + * 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 = { + "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/pom.xml b/backend/svalyn-studio/pom.xml index 6d0d1b0f..8f6ab039 100644 --- a/backend/svalyn-studio/pom.xml +++ b/backend/svalyn-studio/pom.xml @@ -95,6 +95,12 @@ 1.0.0 test + + org.springframework.modulith + spring-modulith-starter-test + 1.0.0 + test + 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/ModularityTests.java b/backend/svalyn-studio/src/test/java/com/svalyn/studio/ModularityTests.java new file mode 100644 index 00000000..baf8d42b --- /dev/null +++ b/backend/svalyn-studio/src/test/java/com/svalyn/studio/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; + +import org.junit.jupiter.api.Test; +import org.springframework.modulith.core.ApplicationModules; +import org.springframework.modulith.docs.Documenter; + +/** + * Tests of the organization of the application modules. + * + * @author sbegaudeau + */ +public class ModularityTests { + + private final ApplicationModules modules = ApplicationModules.of(SvalynStudio.class); + + @Test + public void verifyModules() { + this.modules.verify(); + } + + @Test + public void generateDocumentation() { + new Documenter(this.modules).writeDocumentation().writeIndividualModulesAsPlantUml(); + } +} 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;