mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Update
This commit is contained in:
30
lib/api/user.dart
Normal file
30
lib/api/user.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'user.g.dart';
|
||||
|
||||
@JsonEnum(valueField: 'code')
|
||||
enum UserPermission {
|
||||
none(0),
|
||||
readGallery(1),
|
||||
editGallery(2),
|
||||
all(3);
|
||||
|
||||
const UserPermission(this.code);
|
||||
final int code;
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class BUser {
|
||||
const BUser({
|
||||
required this.id,
|
||||
required this.username,
|
||||
required this.is_admin,
|
||||
required this.permissions,
|
||||
});
|
||||
final int id;
|
||||
final String username;
|
||||
final bool is_admin;
|
||||
final UserPermission permissions;
|
||||
factory BUser.fromJson(Map<String, dynamic> json) => _$BUserFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$BUserToJson(this);
|
||||
}
|
||||
Reference in New Issue
Block a user