Frontend first draft
This commit is contained in:
25
frontend/pshared/lib/data/dto/account/account.dart
Normal file
25
frontend/pshared/lib/data/dto/account/account.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/account/base.dart';
|
||||
|
||||
part 'account.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class AccountDTO extends AccountBaseDTO {
|
||||
final String login;
|
||||
|
||||
const AccountDTO({
|
||||
required super.id,
|
||||
required super.createdAt,
|
||||
required super.updatedAt,
|
||||
required super.name,
|
||||
required super.avatarUrl,
|
||||
required super.locale,
|
||||
required this.login,
|
||||
});
|
||||
|
||||
factory AccountDTO.fromJson(Map<String, dynamic> json) => _$AccountDTOFromJson(json);
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$AccountDTOToJson(this);
|
||||
}
|
||||
27
frontend/pshared/lib/data/dto/account/base.dart
Normal file
27
frontend/pshared/lib/data/dto/account/base.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/storable.dart';
|
||||
|
||||
part 'base.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class AccountBaseDTO extends StorableDTO {
|
||||
final String name;
|
||||
final String locale;
|
||||
final String? avatarUrl;
|
||||
|
||||
const AccountBaseDTO({
|
||||
required super.id,
|
||||
required super.createdAt,
|
||||
required super.updatedAt,
|
||||
required this.name,
|
||||
required this.avatarUrl,
|
||||
required this.locale,
|
||||
});
|
||||
|
||||
factory AccountBaseDTO.fromJson(Map<String, dynamic> json) => _$AccountBaseDTOFromJson(json);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$AccountBaseDTOToJson(this);
|
||||
}
|
||||
23
frontend/pshared/lib/data/dto/organization.dart
Normal file
23
frontend/pshared/lib/data/dto/organization.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:pshared/data/dto/storable.dart';
|
||||
|
||||
part 'organization.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class OrganizationDTO extends StorableDTO {
|
||||
final String timeZone;
|
||||
final String? logoUrl;
|
||||
|
||||
const OrganizationDTO({
|
||||
required super.id,
|
||||
required super.createdAt,
|
||||
required super.updatedAt,
|
||||
required this.timeZone,
|
||||
this.logoUrl,
|
||||
});
|
||||
|
||||
factory OrganizationDTO.fromJson(Map<String, dynamic> json) => _$OrganizationDTOFromJson(json);
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$OrganizationDTOToJson(this);
|
||||
}
|
||||
16
frontend/pshared/lib/data/dto/organization/description.dart
Normal file
16
frontend/pshared/lib/data/dto/organization/description.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'description.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class OrganizationDescriptionDTO {
|
||||
final String? logoUrl;
|
||||
|
||||
const OrganizationDescriptionDTO({
|
||||
this.logoUrl,
|
||||
});
|
||||
|
||||
factory OrganizationDescriptionDTO.fromJson(Map<String, dynamic> json) => _$OrganizationDescriptionDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$OrganizationDescriptionDTOToJson(this);
|
||||
}
|
||||
22
frontend/pshared/lib/data/dto/permissions/access.dart
Normal file
22
frontend/pshared/lib/data/dto/permissions/access.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/permissions/data/permissions.dart';
|
||||
import 'package:pshared/data/dto/permissions/description/description.dart';
|
||||
|
||||
part 'access.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class UserAccessDTO {
|
||||
final PermissionsDescriptionDTO descriptions;
|
||||
final PermissionsDataDTO permissions;
|
||||
|
||||
const UserAccessDTO({
|
||||
required this.descriptions,
|
||||
required this.permissions,
|
||||
});
|
||||
|
||||
factory UserAccessDTO.fromJson(Map<String, dynamic> json) => _$UserAccessDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$UserAccessDTOToJson(this);
|
||||
}
|
||||
|
||||
19
frontend/pshared/lib/data/dto/permissions/action_effect.dart
Normal file
19
frontend/pshared/lib/data/dto/permissions/action_effect.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
// data/action_effect_dto.dart
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'action_effect.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class ActionEffectDTO {
|
||||
final String action;
|
||||
final String effect;
|
||||
|
||||
const ActionEffectDTO({
|
||||
required this.action,
|
||||
required this.effect,
|
||||
});
|
||||
|
||||
factory ActionEffectDTO.fromJson(Map<String, dynamic> json) => _$ActionEffectDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$ActionEffectDTOToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/permissions/action_effect.dart';
|
||||
|
||||
part 'permission.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class PermissionDTO {
|
||||
final String roleDescriptionRef;
|
||||
final String organizationRef;
|
||||
final String descriptionRef;
|
||||
final String? objectRef;
|
||||
final ActionEffectDTO effect;
|
||||
final String accountRef;
|
||||
|
||||
const PermissionDTO({
|
||||
required this.roleDescriptionRef,
|
||||
required this.organizationRef,
|
||||
required this.descriptionRef,
|
||||
required this.objectRef,
|
||||
required this.effect,
|
||||
required this.accountRef,
|
||||
});
|
||||
|
||||
factory PermissionDTO.fromJson(Map<String, dynamic> json) => _$PermissionDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$PermissionDTOToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/permissions/data/permission.dart';
|
||||
import 'package:pshared/data/dto/permissions/data/policy.dart';
|
||||
import 'package:pshared/data/dto/permissions/data/role.dart';
|
||||
|
||||
part 'permissions.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class PermissionsDataDTO {
|
||||
final List<RoleDTO> roles;
|
||||
final List<PolicyDTO> policies;
|
||||
final List<PermissionDTO> permissions;
|
||||
|
||||
const PermissionsDataDTO({
|
||||
required this.roles,
|
||||
required this.policies,
|
||||
required this.permissions,
|
||||
});
|
||||
|
||||
factory PermissionsDataDTO.fromJson(Map<String, dynamic> json) => _$PermissionsDataDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$PermissionsDataDTOToJson(this);
|
||||
}
|
||||
26
frontend/pshared/lib/data/dto/permissions/data/policy.dart
Normal file
26
frontend/pshared/lib/data/dto/permissions/data/policy.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/permissions/action_effect.dart';
|
||||
|
||||
part 'policy.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class PolicyDTO {
|
||||
final String roleDescriptionRef;
|
||||
final String organizationRef;
|
||||
final String descriptionRef;
|
||||
final String? objectRef;
|
||||
final ActionEffectDTO effect;
|
||||
|
||||
const PolicyDTO({
|
||||
required this.roleDescriptionRef,
|
||||
required this.organizationRef,
|
||||
required this.descriptionRef,
|
||||
required this.objectRef,
|
||||
required this.effect,
|
||||
});
|
||||
|
||||
factory PolicyDTO.fromJson(Map<String, dynamic> json) => _$PolicyDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$PolicyDTOToJson(this);
|
||||
}
|
||||
20
frontend/pshared/lib/data/dto/permissions/data/role.dart
Normal file
20
frontend/pshared/lib/data/dto/permissions/data/role.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'role.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class RoleDTO {
|
||||
final String accountRef;
|
||||
final String organizationRef;
|
||||
final String descriptionRef;
|
||||
|
||||
const RoleDTO({
|
||||
required this.accountRef,
|
||||
required this.descriptionRef,
|
||||
required this.organizationRef,
|
||||
});
|
||||
|
||||
factory RoleDTO.fromJson(Map<String, dynamic> json) => _$RoleDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$RoleDTOToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/permissions/description/policy.dart';
|
||||
import 'package:pshared/data/dto/permissions/description/role.dart';
|
||||
|
||||
part 'description.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class PermissionsDescriptionDTO {
|
||||
final List<RoleDescriptionDTO> roles;
|
||||
final List<PolicyDescriptionDTO> policies;
|
||||
|
||||
const PermissionsDescriptionDTO({
|
||||
required this.roles,
|
||||
required this.policies,
|
||||
});
|
||||
|
||||
factory PermissionsDescriptionDTO.fromJson(Map<String, dynamic> json) => _$PermissionsDescriptionDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$PermissionsDescriptionDTOToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:pshared/data/dto/storable.dart';
|
||||
import 'package:pshared/models/resources.dart';
|
||||
|
||||
part 'policy.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class PolicyDescriptionDTO extends StorableDTO {
|
||||
final List<ResourceType>? resourceTypes;
|
||||
final String? organizationRef;
|
||||
|
||||
const PolicyDescriptionDTO({
|
||||
required super.id,
|
||||
required super.createdAt,
|
||||
required super.updatedAt,
|
||||
required this.resourceTypes,
|
||||
required this.organizationRef,
|
||||
});
|
||||
|
||||
factory PolicyDescriptionDTO.fromJson(Map<String, dynamic> json) => _$PolicyDescriptionDTOFromJson(json);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$PolicyDescriptionDTOToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:pshared/data/dto/storable.dart';
|
||||
|
||||
part 'role.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class RoleDescriptionDTO extends StorableDTO {
|
||||
final String organizationRef;
|
||||
|
||||
const RoleDescriptionDTO({
|
||||
required super.id,
|
||||
required super.createdAt,
|
||||
required super.updatedAt,
|
||||
required this.organizationRef,
|
||||
});
|
||||
|
||||
factory RoleDescriptionDTO.fromJson(Map<String, dynamic> json) => _$RoleDescriptionDTOFromJson(json);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$RoleDescriptionDTOToJson(this);
|
||||
}
|
||||
0
frontend/pshared/lib/data/dto/pfe/services.dart
Normal file
0
frontend/pshared/lib/data/dto/pfe/services.dart
Normal file
20
frontend/pshared/lib/data/dto/storable.dart
Normal file
20
frontend/pshared/lib/data/dto/storable.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'storable.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class StorableDTO {
|
||||
final String id;
|
||||
final DateTime createdAt;
|
||||
final DateTime updatedAt;
|
||||
|
||||
const StorableDTO({
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
factory StorableDTO.fromJson(Map<String, dynamic> json) => _$StorableDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$StorableDTOToJson(this);
|
||||
}
|
||||
Reference in New Issue
Block a user