57 lines
1.4 KiB
Dart
57 lines
1.4 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import 'package:pshared/data/dto/date_time.dart';
|
|
import 'package:pshared/data/dto/permissions/bound.dart';
|
|
|
|
part 'invitation.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class InvitationContentDTO {
|
|
final String email;
|
|
final String name;
|
|
final String comment;
|
|
|
|
const InvitationContentDTO({
|
|
required this.email,
|
|
required this.name,
|
|
required this.comment,
|
|
});
|
|
|
|
factory InvitationContentDTO.fromJson(Map<String, dynamic> json) => _$InvitationContentDTOFromJson(json);
|
|
Map<String, dynamic> toJson() => _$InvitationContentDTOToJson(this);
|
|
}
|
|
|
|
@JsonSerializable(explicitToJson: true)
|
|
class InvitationDTO extends PermissionBoundDTO {
|
|
final String roleRef;
|
|
final String inviterRef;
|
|
final String status;
|
|
|
|
@UtcIso8601Converter()
|
|
final DateTime expiresAt;
|
|
|
|
@JsonKey(name: 'description')
|
|
final InvitationContentDTO content;
|
|
|
|
@JsonKey(defaultValue: false)
|
|
final bool isArchived;
|
|
|
|
const InvitationDTO({
|
|
required super.id,
|
|
required super.createdAt,
|
|
required super.updatedAt,
|
|
required super.permissionRef,
|
|
required super.organizationRef,
|
|
required this.roleRef,
|
|
required this.inviterRef,
|
|
required this.status,
|
|
required this.expiresAt,
|
|
required this.content,
|
|
this.isArchived = false,
|
|
});
|
|
|
|
factory InvitationDTO.fromJson(Map<String, dynamic> json) => _$InvitationDTOFromJson(json);
|
|
@override
|
|
Map<String, dynamic> toJson() => _$InvitationDTOToJson(this);
|
|
}
|