Solian/lib/models/attachment.dart

73 lines
1.6 KiB
Dart
Raw Normal View History

2024-09-16 18:14:23 +00:00
import 'package:json_annotation/json_annotation.dart';
import 'package:solian/models/account.dart';
part 'attachment.g.dart';
@JsonSerializable()
2024-08-20 17:53:16 +00:00
class AttachmentPlaceholder {
int chunkCount;
int chunkSize;
Attachment meta;
AttachmentPlaceholder({
required this.chunkCount,
required this.chunkSize,
required this.meta,
});
factory AttachmentPlaceholder.fromJson(Map<String, dynamic> json) =>
_$AttachmentPlaceholderFromJson(json);
2024-08-20 17:53:16 +00:00
Map<String, dynamic> toJson() => _$AttachmentPlaceholderToJson(this);
2024-08-20 17:53:16 +00:00
}
@JsonSerializable()
2024-05-18 10:17:16 +00:00
class Attachment {
int id;
DateTime createdAt;
DateTime updatedAt;
DateTime? deletedAt;
String rid;
2024-05-18 10:17:16 +00:00
String uuid;
int size;
String name;
String alt;
String mimetype;
String hash;
String destination;
bool isAnalyzed;
2024-08-20 17:53:16 +00:00
bool isUploaded;
2024-05-18 10:17:16 +00:00
Map<String, dynamic>? metadata;
2024-08-20 17:53:16 +00:00
Map<String, dynamic>? fileChunks;
2024-05-18 10:17:16 +00:00
bool isMature;
Account? account;
int? accountId;
2024-05-18 10:17:16 +00:00
Attachment({
required this.id,
required this.createdAt,
required this.updatedAt,
required this.deletedAt,
required this.rid,
2024-05-18 10:17:16 +00:00
required this.uuid,
required this.size,
required this.name,
required this.alt,
required this.mimetype,
required this.hash,
required this.destination,
required this.isAnalyzed,
2024-08-20 17:53:16 +00:00
required this.isUploaded,
2024-05-18 10:17:16 +00:00
required this.metadata,
2024-08-20 17:53:16 +00:00
required this.fileChunks,
2024-05-18 10:17:16 +00:00
required this.isMature,
required this.account,
2024-05-18 10:17:16 +00:00
required this.accountId,
});
factory Attachment.fromJson(Map<String, dynamic> json) =>
_$AttachmentFromJson(json);
2024-05-18 10:17:16 +00:00
Map<String, dynamic> toJson() => _$AttachmentToJson(this);
}