Skip to content

Commit 81e9032

Browse files
authored
Merge pull request #55 from ctrl-hub/add-new-fields-to-permission-model
Add new fields to permission model
2 parents 5605a15 + 4aaaebe commit 81e9032

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

dist/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,19 @@ class Group extends BaseModel {
379379
// src/models/Permission.ts
380380
class Permission extends BaseModel {
381381
type = "permissions";
382+
name = "";
382383
description = "";
384+
category = "";
385+
component = "";
386+
verb = "";
383387
static relationships = [];
384388
constructor(data) {
385389
super(data);
386-
this.description = data?.attributes?.description ?? "";
390+
this.name = data?.attributes?.name ?? data?.name ?? "";
391+
this.description = data?.attributes?.description ?? data?.description ?? "";
392+
this.category = data?.attributes?.category ?? data?.category ?? "";
393+
this.component = data?.attributes?.component ?? data?.component ?? "";
394+
this.verb = data?.attributes?.verb ?? data?.verb;
387395
}
388396
}
389397

dist/models/Permission.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import type { RelationshipDefinition } from '../types/RelationshipDefinition';
22
import { BaseModel } from './BaseModel';
33
export declare class Permission extends BaseModel {
44
type: string;
5+
name: string;
56
description: string;
7+
category: string;
8+
component: string;
9+
verb: string;
610
static relationships: RelationshipDefinition[];
711
constructor(data?: any);
812
}

dist/models/Permission.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import { BaseModel } from './BaseModel';
22
export class Permission extends BaseModel {
33
type = 'permissions';
4+
name = '';
45
description = '';
6+
category = '';
7+
component = '';
8+
verb = '';
59
static relationships = [];
610
constructor(data) {
711
super(data);
8-
this.description = data?.attributes?.description ?? '';
12+
this.name = data?.attributes?.name ?? data?.name ?? '';
13+
this.description = data?.attributes?.description ?? data?.description ?? '';
14+
this.category = data?.attributes?.category ?? data?.category ?? '';
15+
this.component = data?.attributes?.component ?? data?.component ?? '';
16+
this.verb = data?.attributes?.verb ?? data?.verb;
917
}
1018
}

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.130",
7+
"version": "0.1.131",
88
"main": "dist/index.js",
99
"types": "dist/index.d.ts",
1010
"type": "module",

src/models/Permission.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@ import { BaseModel } from '@models/BaseModel';
44
export class Permission extends BaseModel {
55
public type: string = 'permissions';
66

7+
public name: string = '';
8+
79
public description: string = '';
810

11+
public category: string = '';
12+
13+
public component: string = '';
14+
15+
public verb: string = '';
16+
917
static relationships: RelationshipDefinition[] = [];
1018

1119
constructor(data?: any) {
1220
super(data);
13-
this.description = data?.attributes?.description ?? '';
21+
this.name = data?.attributes?.name ?? data?.name ?? '';
22+
this.description = data?.attributes?.description ?? data?.description ?? '';
23+
this.category = data?.attributes?.category ?? data?.category ?? '';
24+
this.component = data?.attributes?.component ?? data?.component ?? '';
25+
this.verb = data?.attributes?.verb ?? data?.verb
1426
}
1527

1628
}

0 commit comments

Comments
 (0)