-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multitenancy support #141
Multitenancy support #141
Conversation
Due to what is seemingly an issue with the Spine core the `MirrorProjection` messages can be delivered only within a single `BoundedContext` - the one which is registered last. So the "main" bounded context, where the multitenant tests run and multiple aggregates are read, is now registered last and the "auxiliary" single-tenant context will contain a `UserInfo` aggregate and a corresponding projection instead of having a single visible aggregate. Also fixed how the `observe`d event is handled in the single-tenant tests.
Also documented the tenant-related classes.
...to avoid skipping versions `1.5.4`-`1.5.10` of Spine `web`. The `base` and `core` dependencies remain `1.5.11` and `1.5.10` correspondingly.
Codecov Report
@@ Coverage Diff @@
## master #141 +/- ##
============================================
+ Coverage 62.00% 62.14% +0.13%
Complexity 178 178
============================================
Files 86 87 +1
Lines 2116 2174 +58
Branches 38 38
============================================
+ Hits 1312 1351 +39
- Misses 795 814 +19
Partials 9 9 |
@armiol, @dmdashenkov PTAL. |
* @param {!string} tenantIdValue the tenant ID | ||
* @return {TenantId} a new `TenantId` instance | ||
*/ | ||
static plainString(tenantIdValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's have convenience methods for other types of TennantId
s as well.
client-js/main/client/tenant.js
Outdated
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the empty line.
client-js/package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "spine-web", | |||
"version": "1.5.3", | |||
"version": "1.5.11", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep in sync this version and the version quoted in the PR description.
import io.spine.core.UserId; | ||
import io.spine.server.aggregate.AggregateRepository; | ||
|
||
class UserInfoRepository extends AggregateRepository<UserId, UserInfoAggregate> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class UserInfoRepository extends AggregateRepository<UserId, UserInfoAggregate> { | |
final class UserInfoRepository extends AggregateRepository<UserId, UserInfoAggregate> { |
import io.spine.core.UserId; | ||
import io.spine.server.projection.ProjectionRepository; | ||
|
||
class UserInfoViewRepository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class UserInfoViewRepository | |
final class UserInfoViewRepository |
@dmdashenkov PTAL again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple of comments to discuss.
import io.spine.core.UserId; | ||
import io.spine.server.aggregate.AggregateRepository; | ||
|
||
final class UserInfoRepository extends AggregateRepository<UserId, UserInfoAggregate> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if you can use the default repository instead of explicitly declaring one.
import io.spine.core.UserId; | ||
import io.spine.server.projection.ProjectionRepository; | ||
|
||
final class UserInfoViewRepository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
This PR adds the multitenancy support to the JS client.
The
Client
factory API now accepts aTenantProvider
as a part of the passed client options.The
TenantProvider
defines the current tenant ID to be used for all requests done with the client.The current tenant ID can be dynamically updated with the help of
TenantProvider.update(TenantId)
.For single-tenant applications, the
TenantProvider
can be omitted in the options.Spine web version advances to
1.5.4
.