2023-07-28 02:21:42 +00:00
|
|
|
// To parse this JSON data, do
|
|
|
|
//
|
|
|
|
// final assignedRole = assignedRoleFromJson(jsonString);
|
|
|
|
|
|
|
|
import 'package:meta/meta.dart';
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
AssignedRole assignedRoleFromJson(String str) => AssignedRole.fromJson(json.decode(str));
|
|
|
|
|
|
|
|
String assignedRoleToJson(AssignedRole data) => json.encode(data.toJson());
|
|
|
|
|
|
|
|
class AssignedRole {
|
|
|
|
final int? id;
|
|
|
|
final Role? role;
|
|
|
|
final CreatedBy? user;
|
|
|
|
final DateTime? createdAt;
|
|
|
|
final DateTime? updatedAt;
|
|
|
|
final CreatedBy? createdBy;
|
|
|
|
final CreatedBy? updatedBy;
|
|
|
|
|
|
|
|
AssignedRole({
|
|
|
|
required this.id,
|
|
|
|
required this.role,
|
|
|
|
required this.user,
|
|
|
|
required this.createdAt,
|
|
|
|
required this.updatedAt,
|
|
|
|
required this.createdBy,
|
|
|
|
required this.updatedBy,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory AssignedRole.fromJson(Map<String, dynamic> json) => AssignedRole(
|
|
|
|
id: json["id"],
|
|
|
|
role: json['role'] == null?null: Role.fromJson(json["role"]),
|
|
|
|
user: json['role'] == null?null: CreatedBy.fromJson(json["user"]),
|
|
|
|
createdAt:json["created_at"] == null?null: DateTime.parse(json["created_at"]),
|
|
|
|
updatedAt: json["updated_at"] == null?null: DateTime.parse(json["updated_at"]),
|
|
|
|
createdBy: json["created_by"] == null? null: CreatedBy.fromJson(json["created_by"]),
|
|
|
|
updatedBy: json["updated_by"] == null? null: CreatedBy.fromJson(json["updated_by"]),
|
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"role": role?.toJson(),
|
|
|
|
"user": user?.toJson(),
|
|
|
|
"created_at": createdAt?.toIso8601String(),
|
|
|
|
"updated_at": updatedAt?.toIso8601String(),
|
|
|
|
"created_by": createdBy?.toJson(),
|
|
|
|
"updated_by": updatedBy?.toJson(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
class CreatedBy {
|
|
|
|
final int id;
|
|
|
|
final String username;
|
|
|
|
final String firstName;
|
|
|
|
final String lastName;
|
|
|
|
final String email;
|
|
|
|
final bool isActive;
|
|
|
|
|
|
|
|
CreatedBy({
|
|
|
|
required this.id,
|
|
|
|
required this.username,
|
|
|
|
required this.firstName,
|
|
|
|
required this.lastName,
|
|
|
|
required this.email,
|
|
|
|
required this.isActive,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory CreatedBy.fromJson(Map<String, dynamic> json) => CreatedBy(
|
|
|
|
id: json["id"],
|
|
|
|
username: json["username"],
|
|
|
|
firstName: json["first_name"],
|
|
|
|
lastName: json["last_name"],
|
|
|
|
email: json["email"],
|
|
|
|
isActive: json["is_active"],
|
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"username": username,
|
|
|
|
"first_name": firstName,
|
|
|
|
"last_name": lastName,
|
|
|
|
"email": email,
|
|
|
|
"is_active": isActive,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
class Role {
|
|
|
|
final int id;
|
2023-09-13 02:45:03 +00:00
|
|
|
final String? name;
|
|
|
|
final String? slug;
|
|
|
|
final String? shorthand;
|
|
|
|
final DateTime? createdAt;
|
|
|
|
final DateTime? updatedAt;
|
|
|
|
final CreatedBy? createdBy;
|
|
|
|
final CreatedBy? updatedBy;
|
2023-07-28 02:21:42 +00:00
|
|
|
|
|
|
|
Role({
|
|
|
|
required this.id,
|
|
|
|
required this.name,
|
|
|
|
required this.slug,
|
|
|
|
required this.shorthand,
|
|
|
|
required this.createdAt,
|
|
|
|
required this.updatedAt,
|
|
|
|
required this.createdBy,
|
|
|
|
required this.updatedBy,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory Role.fromJson(Map<String, dynamic> json) => Role(
|
|
|
|
id: json["id"],
|
|
|
|
name: json["name"],
|
|
|
|
slug: json["slug"],
|
|
|
|
shorthand: json["shorthand"],
|
2023-09-13 02:45:03 +00:00
|
|
|
createdAt:json["created_at"] ==null?null: DateTime.parse(json["created_at"]),
|
|
|
|
updatedAt:json["updated_at"] == null?null: DateTime.parse(json["updated_at"]),
|
|
|
|
createdBy:json["created_by"] == null?null: CreatedBy.fromJson(json["created_by"]),
|
|
|
|
updatedBy:json["updated_by"] == null?null: CreatedBy.fromJson(json["updated_by"]),
|
2023-07-28 02:21:42 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"name": name,
|
|
|
|
"slug": slug,
|
|
|
|
"shorthand": shorthand,
|
2023-09-13 02:45:03 +00:00
|
|
|
"created_at": createdAt?.toIso8601String(),
|
|
|
|
"updated_at": updatedAt?.toIso8601String(),
|
|
|
|
"created_by": createdBy?.toJson(),
|
|
|
|
"updated_by": updatedBy?.toJson(),
|
2023-07-28 02:21:42 +00:00
|
|
|
};
|
|
|
|
}
|