-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rich text notes class and migration (#354)
* [303] feat: add rich text notes class and migration * [303] style: fix comment
- Loading branch information
1 parent
59eff24
commit cd4e484
Showing
12 changed files
with
329 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import 'package:isar/isar.dart'; | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
import '../label/label.dart'; | ||
|
||
part 'note.g.dart'; | ||
|
||
// ignore_for_file: must_be_immutable, public_member_api_docs | ||
|
||
List<String> _labelToJson(IsarLinks<Label> labels) => labels.map((label) => label.name).toList(); | ||
|
||
/// Legacy model of the rich text note. | ||
@JsonSerializable() | ||
@Collection() | ||
@Deprecated('Legacy model of the rich text note') | ||
class Note { | ||
@JsonKey(includeFromJson: false, includeToJson: false) | ||
Id id = Isar.autoIncrement; | ||
|
||
@JsonKey(includeFromJson: false, includeToJson: false) | ||
@ignore | ||
bool selected = false; | ||
|
||
bool deleted; | ||
|
||
bool pinned; | ||
|
||
DateTime createdTime; | ||
|
||
DateTime editedTime; | ||
|
||
String title; | ||
|
||
String content; | ||
|
||
@JsonKey(includeFromJson: false, includeToJson: true, toJson: _labelToJson) | ||
IsarLinks<Label> labels = IsarLinks<Label>(); | ||
|
||
Note({ | ||
required this.deleted, | ||
required this.pinned, | ||
required this.createdTime, | ||
required this.editedTime, | ||
required this.title, | ||
required this.content, | ||
}); | ||
} |
Oops, something went wrong.