diff options
author | crupest <crupest@outlook.com> | 2021-01-03 19:07:35 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-01-03 19:07:35 +0800 |
commit | 69d56e560fc280e9a570e858c29878514b1b5575 (patch) | |
tree | 1ac062fa80c8e6886f1eb86a4b1e4c5abc6d953d /BackEnd/Timeline/Services | |
parent | 4f301a32778fb006bcf2cc183c7118ca5961f7ba (diff) | |
download | timeline-69d56e560fc280e9a570e858c29878514b1b5575.tar.gz timeline-69d56e560fc280e9a570e858c29878514b1b5575.tar.bz2 timeline-69d56e560fc280e9a570e858c29878514b1b5575.zip |
fix: Fix a critical bug in bookmark timeline service.
It used to create two entry with the same timeline. Now it will not create a duplicate one.
Diffstat (limited to 'BackEnd/Timeline/Services')
-rw-r--r-- | BackEnd/Timeline/Services/BookmarkTimelineService.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Services/BookmarkTimelineService.cs b/BackEnd/Timeline/Services/BookmarkTimelineService.cs index 09438193..2ec3af62 100644 --- a/BackEnd/Timeline/Services/BookmarkTimelineService.cs +++ b/BackEnd/Timeline/Services/BookmarkTimelineService.cs @@ -94,6 +94,11 @@ namespace Timeline.Services var timelineId = await _timelineService.GetTimelineIdByName(timelineName);
+ if (await _database.BookmarkTimelines.SingleOrDefaultAsync(t => t.TimelineId == timelineId) is not null)
+ {
+ return;
+ }
+
_database.BookmarkTimelines.Add(new BookmarkTimelineEntity
{
TimelineId = timelineId,
|