diff options
Diffstat (limited to 'Timeline')
-rw-r--r-- | Timeline/Models/Http/Timeline.cs | 4 | ||||
-rw-r--r-- | Timeline/Models/Http/TimelineController.cs | 5 | ||||
-rw-r--r-- | Timeline/Models/Timeline.cs | 2 | ||||
-rw-r--r-- | Timeline/Services/TimelineService.cs | 11 |
4 files changed, 21 insertions, 1 deletions
diff --git a/Timeline/Models/Http/Timeline.cs b/Timeline/Models/Http/Timeline.cs index 6498fa74..3596af18 100644 --- a/Timeline/Models/Http/Timeline.cs +++ b/Timeline/Models/Http/Timeline.cs @@ -68,6 +68,10 @@ namespace Timeline.Models.Http /// </summary>
public string UniqueId { get; set; } = default!;
/// <summary>
+ /// Title.
+ /// </summary>
+ public string Title { get; set; } = default!;
+ /// <summary>
/// Name of timeline.
/// </summary>
public string Name { get; set; } = default!;
diff --git a/Timeline/Models/Http/TimelineController.cs b/Timeline/Models/Http/TimelineController.cs index aad361ee..95bae3e6 100644 --- a/Timeline/Models/Http/TimelineController.cs +++ b/Timeline/Models/Http/TimelineController.cs @@ -57,6 +57,11 @@ namespace Timeline.Models.Http public class TimelinePatchRequest
{
/// <summary>
+ /// New title. Null for not change.
+ /// </summary>
+ public string? Title { get; set; }
+
+ /// <summary>
/// New description. Null for not change.
/// </summary>
public string? Description { get; set; }
diff --git a/Timeline/Models/Timeline.cs b/Timeline/Models/Timeline.cs index 34c253a0..42906053 100644 --- a/Timeline/Models/Timeline.cs +++ b/Timeline/Models/Timeline.cs @@ -74,6 +74,7 @@ namespace Timeline.Models public string UniqueID { get; set; } = default!;
public string Name { get; set; } = default!;
public DateTime NameLastModified { get; set; } = default!;
+ public string Title { get; set; } = default!;
public string Description { get; set; } = default!;
public User Owner { get; set; } = default!;
public TimelineVisibility Visibility { get; set; }
@@ -86,6 +87,7 @@ namespace Timeline.Models public class TimelineChangePropertyRequest
{
+ public string? Title { get; set; }
public string? Description { get; set; }
public TimelineVisibility? Visibility { get; set; }
}
diff --git a/Timeline/Services/TimelineService.cs b/Timeline/Services/TimelineService.cs index 01f7f5fd..2f0bf2c5 100644 --- a/Timeline/Services/TimelineService.cs +++ b/Timeline/Services/TimelineService.cs @@ -405,11 +405,14 @@ namespace Timeline.Services members.Add(await _userService.GetUserById(memberEntity.UserId));
}
+ var name = entity.Name ?? ("@" + owner.Username);
+
return new Models.Timeline
{
UniqueID = entity.UniqueId,
- Name = entity.Name ?? ("@" + owner.Username),
+ Name = name,
NameLastModified = entity.NameLastModified,
+ Title = string.IsNullOrEmpty(entity.Title) ? name : entity.Title,
Description = entity.Description ?? "",
Owner = owner,
Visibility = entity.Visibility,
@@ -834,6 +837,12 @@ namespace Timeline.Services var changed = false;
+ if (newProperties.Title != null)
+ {
+ changed = true;
+ timelineEntity.Title = newProperties.Title;
+ }
+
if (newProperties.Description != null)
{
changed = true;
|