generated from PackagrIO/goweb-template
-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
8d28b50
commit 8229977
Showing
19 changed files
with
471 additions
and
47 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
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
20 changes: 20 additions & 0 deletions
20
backend/pkg/database/migrations/20240827214347/user_permission.go
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,20 @@ | ||
package _20240827214347 | ||
|
||
import ( | ||
"github.com/fastenhealth/fasten-onprem/backend/pkg/models" | ||
"github.com/google/uuid" | ||
) | ||
|
||
type Permission string | ||
|
||
const ( | ||
PermissionManageSources Permission = "manage_sources" | ||
PermissionRead Permission = "read" | ||
) | ||
|
||
type UserPermission struct { | ||
models.ModelBase | ||
UserID uuid.UUID `json:"user_id" gorm:"type:uuid"` | ||
TargetUserID uuid.UUID `json:"target_user_id" gorm:"type:uuid"` | ||
Permission Permission `json:"permission"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,13 @@ | ||
package models | ||
|
||
import ( | ||
"github.com/fastenhealth/fasten-onprem/backend/pkg" | ||
"github.com/google/uuid" | ||
) | ||
|
||
type UserPermission struct { | ||
ModelBase | ||
UserID uuid.UUID `json:"user_id" gorm:"type:uuid"` | ||
TargetUserID uuid.UUID `json:"target_user_id" gorm:"type:uuid"` | ||
Permission pkg.Permission `json:"permission"` | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
export const POSSIBLE_PERMISSIONS = [ | ||
{ name: 'Manage Sources', value: 'manage_sources' }, | ||
{ name: 'Read', value: 'read' }, | ||
] | ||
|
||
export class User { | ||
user_id?: number | ||
id?: string | ||
full_name?: string | ||
username?: string | ||
email?: string | ||
password?: string | ||
role?: string | ||
permissions?: { | ||
[targetUserId: string]: { | ||
[key in typeof POSSIBLE_PERMISSIONS[number]['value']]: boolean; | ||
} | ||
} | ||
} |
Oops, something went wrong.