everybody loves a refactor
This commit is contained in:
@@ -28,7 +28,7 @@ func (p Permission) isSystem() bool {
|
||||
}
|
||||
|
||||
// GetPermissionByName queries the database for a permission matching the given name
|
||||
// Returns nil, nil if no permission is found
|
||||
// Returns a BadRequestNotFound error if no permission is found
|
||||
func GetPermissionByName(ctx context.Context, tx bun.Tx, name permissions.Permission) (*Permission, error) {
|
||||
if name == "" {
|
||||
return nil, errors.New("name cannot be empty")
|
||||
@@ -37,7 +37,7 @@ func GetPermissionByName(ctx context.Context, tx bun.Tx, name permissions.Permis
|
||||
}
|
||||
|
||||
// GetPermissionByID queries the database for a permission matching the given ID
|
||||
// Returns nil, nil if no permission is found
|
||||
// Returns a BadRequestNotFound error if no permission is found
|
||||
func GetPermissionByID(ctx context.Context, tx bun.Tx, id int) (*Permission, error) {
|
||||
if id <= 0 {
|
||||
return nil, errors.New("id must be positive")
|
||||
|
||||
Reference in New Issue
Block a user