Skip to content

Commit b144588

Browse files
authored
Merge pull request #48 from ctrl-hub/include-users-in-group-responses
Add users relationship to Group model
2 parents b3dafb1 + 857d6f3 commit b144588

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

dist/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,13 @@ class Group extends BaseModel {
355355
name = "";
356356
description = "";
357357
bindings = [];
358-
static relationships = [];
358+
static relationships = [
359+
{
360+
name: "users",
361+
type: "array",
362+
modelType: "users"
363+
}
364+
];
359365
constructor(data) {
360366
super(data);
361367
this.name = data?.attributes?.name ?? data?.name ?? "";

dist/models/Group.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ export class Group extends BaseModel {
44
name = '';
55
description = '';
66
bindings = [];
7-
static relationships = [];
7+
static relationships = [
8+
{
9+
name: 'users',
10+
type: 'array',
11+
modelType: 'users',
12+
},
13+
];
814
constructor(data) {
915
super(data);
1016
this.name = data?.attributes?.name ?? data?.name ?? '';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "git",
55
"url": "https://github.com/ctrl-hub/sdk.ts"
66
},
7-
"version": "0.1.124",
7+
"version": "0.1.125",
88
"main": "dist/index.js",
99
"types": "dist/index.d.ts",
1010
"type": "module",

src/models/Group.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ export class Group extends BaseModel implements Partial<JsonApiMapping> {
2323
public description: string = '';
2424
public bindings: Binding[] = [];
2525

26-
static relationships: RelationshipDefinition[] = [];
26+
static relationships: RelationshipDefinition[] = [
27+
{
28+
name: 'users',
29+
type: 'array',
30+
modelType: 'users',
31+
},
32+
];
2733

2834
constructor(data?: any) {
2935
super(data);

0 commit comments

Comments
 (0)