Frontend first draft
This commit is contained in:
15
frontend/pshared/lib/models/permissions/action.dart
Normal file
15
frontend/pshared/lib/models/permissions/action.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
enum Action {
|
||||
create,
|
||||
read,
|
||||
update,
|
||||
delete,
|
||||
}
|
||||
|
||||
extension ActionExtension on Action {
|
||||
String toShortString() => toString().split('.').last;
|
||||
|
||||
static Action fromString(String value) => Action.values.firstWhere(
|
||||
(e) => e.toShortString() == value,
|
||||
orElse: () => throw ArgumentError('Invalid action: $value'),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user