aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Services/BookmarkTimelineService.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-01-03 19:07:35 +0800
committercrupest <crupest@outlook.com>2021-01-03 19:07:35 +0800
commita19b19f866fd85aaae9351bb898ab2898d202a47 (patch)
treeff44340698e19c70ca05b786c9a3c6b1431c823f /BackEnd/Timeline/Services/BookmarkTimelineService.cs
parent955704d1e8c3f47b8672cbbd77f4bfb6068fd7b2 (diff)
downloadtimeline-a19b19f866fd85aaae9351bb898ab2898d202a47.tar.gz
timeline-a19b19f866fd85aaae9351bb898ab2898d202a47.tar.bz2
timeline-a19b19f866fd85aaae9351bb898ab2898d202a47.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/BookmarkTimelineService.cs')
-rw-r--r--BackEnd/Timeline/Services/BookmarkTimelineService.cs5
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,