@zerotal/tenancy 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +3 -3
- package/src/Tenantable.ts +3 -3
package/README.md
CHANGED
|
@@ -60,16 +60,16 @@ Application.create({ providers }).use([TenancyMiddleware]);
|
|
|
60
60
|
|
|
61
61
|
## Usage
|
|
62
62
|
|
|
63
|
-
Compose `Tenantable` via `
|
|
63
|
+
Compose `Tenantable` via `Model.using` onto any tenant-owned model (the same flat
|
|
64
64
|
form used for every other mixin). Every query is scoped with
|
|
65
65
|
`WHERE tenant_id = <current tenant>` and `create()` injects the `tenant_id`:
|
|
66
66
|
|
|
67
67
|
```ts
|
|
68
|
-
import {
|
|
68
|
+
import { Model, column, table } from "@zerotal/orm";
|
|
69
69
|
import { Tenantable } from "@zerotal/tenancy";
|
|
70
70
|
|
|
71
71
|
@table("projects")
|
|
72
|
-
export class Project extends
|
|
72
|
+
export class Project extends Model.using(Tenantable) {
|
|
73
73
|
@column() name!: string;
|
|
74
74
|
@column() tenantId!: number;
|
|
75
75
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerotal/tenancy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"maturity": "beta",
|
|
6
6
|
"private": false,
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zerotal/core": "1.
|
|
33
|
-
"@zerotal/orm": "1.
|
|
32
|
+
"@zerotal/core": "1.3.0",
|
|
33
|
+
"@zerotal/orm": "1.3.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"typescript": "^5.8.0"
|
package/src/Tenantable.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// ── Tenantable ──────────────────────────────────────────────────────────────
|
|
2
2
|
//
|
|
3
|
-
// Multi-tenant model mixin. Compose it via `
|
|
3
|
+
// Multi-tenant model mixin. Compose it via `Model.using`, like every other mixin:
|
|
4
4
|
//
|
|
5
|
-
// import {
|
|
5
|
+
// import { Model, column, table } from "@zerotal/orm";
|
|
6
6
|
// import { Tenantable } from "@zerotal/tenancy";
|
|
7
7
|
//
|
|
8
8
|
// @table("projects").withTimestamps()
|
|
9
|
-
// export class Project extends
|
|
9
|
+
// export class Project extends Model.using(Tenantable) {
|
|
10
10
|
// @column() name!: string;
|
|
11
11
|
// @column() tenantId!: number;
|
|
12
12
|
// }
|