104 lines
2.1 KiB
Dart
104 lines
2.1 KiB
Dart
import 'package:hive/hive.dart';
|
|
import '../../domain/entities/inspiration_image.dart';
|
|
|
|
part 'hive_inspiration_image.g.dart';
|
|
|
|
@HiveType(typeId: 0)
|
|
class HiveInspirationImage {
|
|
@HiveField(0)
|
|
final String id;
|
|
|
|
@HiveField(1)
|
|
final String filePath;
|
|
|
|
@HiveField(2)
|
|
final String thumbnailPath;
|
|
|
|
@HiveField(3)
|
|
final String? folderId;
|
|
|
|
@HiveField(4)
|
|
final List<String> tags;
|
|
|
|
@HiveField(5)
|
|
final String? note;
|
|
|
|
@HiveField(6)
|
|
final DateTime createdAt;
|
|
|
|
@HiveField(7)
|
|
final DateTime updatedAt;
|
|
|
|
@HiveField(8)
|
|
final String? originalName;
|
|
|
|
@HiveField(9)
|
|
final int fileSize;
|
|
|
|
@HiveField(10)
|
|
final String mimeType;
|
|
|
|
@HiveField(11)
|
|
final int? width;
|
|
|
|
@HiveField(12)
|
|
final int? height;
|
|
|
|
@HiveField(13)
|
|
final bool isFavorite;
|
|
|
|
HiveInspirationImage({
|
|
required this.id,
|
|
required this.filePath,
|
|
required this.thumbnailPath,
|
|
this.folderId,
|
|
required this.tags,
|
|
this.note,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.originalName,
|
|
required this.fileSize,
|
|
required this.mimeType,
|
|
this.width,
|
|
this.height,
|
|
this.isFavorite = false,
|
|
});
|
|
|
|
factory HiveInspirationImage.fromEntity(InspirationImage entity) {
|
|
return HiveInspirationImage(
|
|
id: entity.id,
|
|
filePath: entity.filePath,
|
|
thumbnailPath: entity.thumbnailPath,
|
|
folderId: entity.folderId,
|
|
tags: entity.tags,
|
|
note: entity.note,
|
|
createdAt: entity.createdAt,
|
|
updatedAt: entity.updatedAt,
|
|
originalName: entity.originalName,
|
|
fileSize: entity.fileSize,
|
|
mimeType: entity.mimeType,
|
|
width: entity.width,
|
|
height: entity.height,
|
|
isFavorite: entity.isFavorite,
|
|
);
|
|
}
|
|
|
|
InspirationImage toEntity() {
|
|
return InspirationImage(
|
|
id: id,
|
|
filePath: filePath,
|
|
thumbnailPath: thumbnailPath,
|
|
folderId: folderId,
|
|
tags: tags,
|
|
note: note,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
originalName: originalName,
|
|
fileSize: fileSize,
|
|
mimeType: mimeType,
|
|
width: width,
|
|
height: height,
|
|
isFavorite: isFavorite,
|
|
);
|
|
}
|
|
} |