-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19d9c49
commit 5d208c7
Showing
14 changed files
with
309 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,5 @@ package-lock.json | |
|
||
.mail.ts.bk | ||
src/bk | ||
swagger.json | ||
swagger.json | ||
todo.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export enum PermissionCategory { | ||
CanViewTransactions = "canViewTransactions", | ||
CanViewRefunds = "canViewRefunds", | ||
CanLogRefunds = "canLogRefunds", | ||
CanViewUsers = "canViewUsers", | ||
CanCreateUsers = "canCreateUsers", | ||
CanEditUsers = "canEditUsers", | ||
CanBlacklistWhitelistUsers = "canBlacklistWhitelistUsers", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm"; | ||
import ExtendedBaseEntity from "./extended-base-entity"; | ||
import { Organization } from "./organization"; | ||
import { OrganizationRole } from "./organization-role.entity"; | ||
import { Profile } from "./profile"; | ||
import { User } from "./user"; | ||
|
||
@Entity() | ||
export class OrganizationMember extends ExtendedBaseEntity { | ||
@PrimaryGeneratedColumn("uuid") | ||
id: string; | ||
|
||
@ManyToOne(() => User, (user) => user.organizationMembers) | ||
user_id: User; | ||
|
||
@ManyToOne( | ||
() => Organization, | ||
(organization) => organization.organizationMembers, | ||
) | ||
organization_id: Organization; | ||
|
||
@ManyToOne(() => OrganizationRole, (role) => role.organizationMembers) | ||
role: OrganizationRole; | ||
|
||
@ManyToOne(() => Profile) | ||
profile_id: Profile; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
Column, | ||
Entity, | ||
ManyToOne, | ||
OneToMany, | ||
PrimaryGeneratedColumn, | ||
} from "typeorm"; | ||
import ExtendedBaseEntity from "./extended-base-entity"; | ||
import { Organization } from "./organization"; | ||
import { OrganizationMember } from "./organization-member"; | ||
import { Permissions } from "./permissions.entity"; | ||
|
||
@Entity("roles") | ||
export class OrganizationRole extends ExtendedBaseEntity { | ||
@PrimaryGeneratedColumn("uuid") | ||
id: string; | ||
|
||
@Column({ length: 50, nullable: false }) | ||
name: string; | ||
|
||
@Column({ length: 200, nullable: true }) | ||
description: string; | ||
|
||
@OneToMany(() => Permissions, (permission) => permission.role, { | ||
eager: false, | ||
}) | ||
permissions: Permissions[]; | ||
|
||
@ManyToOne(() => Organization, (organization) => organization.role, { | ||
eager: false, | ||
}) | ||
organization: Organization; | ||
|
||
@OneToMany(() => OrganizationMember, (member) => member.role) | ||
organizationMembers: OrganizationMember[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm"; | ||
import { PermissionCategory } from "../enums/permission-category.enum"; | ||
import ExtendedBaseEntity from "./extended-base-entity"; | ||
import { OrganizationRole } from "./organization-role.entity"; | ||
|
||
@Entity() | ||
export class Permissions extends ExtendedBaseEntity { | ||
@PrimaryGeneratedColumn("uuid") | ||
id: string; | ||
@Column({ | ||
type: "enum", | ||
enum: PermissionCategory, | ||
}) | ||
category: PermissionCategory; | ||
|
||
@Column({ type: "boolean", nullable: false }) | ||
permission_list: boolean; | ||
|
||
@ManyToOne(() => OrganizationRole, (role) => role.permissions, { | ||
eager: false, | ||
}) | ||
role: OrganizationRole; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.