Skip to content

Commit

Permalink
feat(entities): add entities and uuid pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
notusertelken committed Sep 19, 2022
1 parent ade5c6c commit 7d65af7
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 8 deletions.
58 changes: 51 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"@nestjs/platform-express": "^8.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0"
"rxjs": "^7.2.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@nestjs/cli": "^8.0.0",
Expand All @@ -36,6 +37,7 @@
"@types/jest": "27.0.2",
"@types/node": "^16.0.0",
"@types/supertest": "^2.0.11",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
Expand Down
11 changes: 11 additions & 0 deletions src/domain/entities/principal.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Role } from './role.entity';
import { v4 as uuid } from 'uuid';

export class Principal {
id: string;
roles: Role[];
constructor(roles: Role[]) {
this.id = uuid();
this.roles = roles;
}
}
12 changes: 12 additions & 0 deletions src/domain/entities/role.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Scope } from './scope.entity';
import { v4 as uuid } from 'uuid';
export class Role {
id!: string;
name: string;
scopes!: Scope[];
constructor(name: string, scopes: Scope[]) {
this.id = uuid();
this.name = name;
this.scopes = scopes;
}
}
12 changes: 12 additions & 0 deletions src/domain/entities/scope.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { v4 as uuid } from 'uuid';

export class Scope {
id!: string;
urn!: string;
context!: string;
constructor(urn: string, context: string) {
this.id = uuid();
this.urn = urn;
this.context = context;
}
}

0 comments on commit 7d65af7

Please sign in to comment.