login
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
part of '../auth_dtos.dart';
|
||||
|
||||
@freezed
|
||||
class UserDto with _$UserDto {
|
||||
const UserDto._();
|
||||
|
||||
const factory UserDto({
|
||||
@JsonKey(name: "id") String? id,
|
||||
@JsonKey(name: "organization_id") String? organizationId,
|
||||
@JsonKey(name: "outlet_id") String? outletId,
|
||||
@JsonKey(name: "name") String? name,
|
||||
@JsonKey(name: "email") String? email,
|
||||
@JsonKey(name: "role") String? role,
|
||||
@JsonKey(name: "permissions") Map<String, dynamic>? permissions,
|
||||
@JsonKey(name: "is_active") bool? isActive,
|
||||
@JsonKey(name: "created_at") String? createdAt,
|
||||
@JsonKey(name: "updated_at") String? updatedAt,
|
||||
}) = _UserDto;
|
||||
|
||||
factory UserDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$UserDtoFromJson(json);
|
||||
|
||||
User toDomain() => User(
|
||||
id: id ?? '',
|
||||
organizationId: organizationId ?? '',
|
||||
outletId: outletId ?? '',
|
||||
name: name ?? '',
|
||||
email: email ?? '',
|
||||
role: role ?? '',
|
||||
permissions: permissions ?? {},
|
||||
isActive: isActive ?? false,
|
||||
createdAt: createdAt ?? '',
|
||||
updatedAt: updatedAt ?? '',
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user