You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

81 lines
2.2 KiB

import 'organization.dart';
import 'page.dart';
import 'role.dart';
class User {
String? id;
String? username;
dynamic email;
String? name;
bool? enabled;
dynamic posts;
String? organizationId;
Organization? organization;
String? organizationName;
String? organizationLevel;
List<Role>? roles;
List<dynamic>? permissions;
List<Page>? pages;
dynamic company;
String? signatureImage;
User({
this.id,
this.username,
this.email,
this.name,
this.enabled,
this.posts,
this.organizationId,
this.organization,
this.organizationName,
this.organizationLevel,
this.roles,
this.permissions,
this.pages,
this.company,
this.signatureImage,
});
factory User.fromJson(Map<String, dynamic> json) => User(
id: json['id'] as String?,
username: json['username'] as String?,
email: json['email'] as dynamic,
name: json['name'] as String?,
enabled: json['enabled'] as bool?,
posts: json['posts'] as dynamic,
organizationId: json['organizationId'] as String?,
organization: json['organization'] == null
? null
: Organization.fromJson(json['organization'] as Map<String, dynamic>),
organizationName: json['organizationName'] as String?,
organizationLevel: json['organizationLevel'] as String?,
roles: (json['roles'] as List<dynamic>?)
?.map((e) => Role.fromJson(e as Map<String, dynamic>))
.toList(),
permissions: json['permissions'] as List<dynamic>?,
pages: (json['pages'] as List<dynamic>?)
?.map((e) => Page.fromJson(e as Map<String, dynamic>))
.toList(),
company: json['company'] as dynamic,
signatureImage: json['signatureImage'] as String?,
);
Map<String, dynamic> toJson() => {
'id': id,
'username': username,
'email': email,
'name': name,
'enabled': enabled,
'posts': posts,
'organizationId': organizationId,
'organization': organization?.toJson(),
'organizationName': organizationName,
'organizationLevel': organizationLevel,
'roles': roles?.map((e) => e.toJson()).toList(),
'permissions': permissions,
'pages': pages?.map((e) => e.toJson()).toList(),
'company': company,
'signatureImage': signatureImage,
};
}