1
0
mirror of https://github.com/h7x4/Jisho-Study-Tool.git synced 2024-12-22 22:07:29 +01:00
Jisho-Study-Tool/lib/models/history/search.dart

30 lines
570 B
Dart

import 'package:objectbox/objectbox.dart';
import './kanji_query.dart';
import './word_query.dart';
@Entity()
class Search {
int id;
@Property(type: PropertyType.date)
late final DateTime timestamp;
final wordQuery = ToOne<WordQuery>();
final kanjiQuery = ToOne<KanjiQuery>();
Search({
this.id = 0,
required this.timestamp
}); // {
bool isKanji() {
// // TODO: better error message
if (this.wordQuery.target == null && this.kanjiQuery.target == null)
throw Exception();
return this.wordQuery.target == null;
}
}