Add timestamp to comments

This commit is contained in:
jvyden 2021-10-26 22:54:06 -04:00
commit 73ad687874
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 11 additions and 0 deletions

View file

@ -3,6 +3,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Serialization; using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types; using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Profiles; using LBPUnion.ProjectLighthouse.Types.Profiles;
@ -50,6 +51,8 @@ namespace LBPUnion.ProjectLighthouse.Controllers {
comment.PosterUserId = poster.UserId; comment.PosterUserId = poster.UserId;
comment.TargetUserId = target.UserId; comment.TargetUserId = target.UserId;
comment.Timestamp = TimeHelper.UnixTimeMilliseconds();
this.database.Comments.Add(comment); this.database.Comments.Add(comment);
await this.database.SaveChangesAsync(); await this.database.SaveChangesAsync();
return this.Ok(); return this.Ok();

View file

@ -0,0 +1,8 @@
using System;
namespace LBPUnion.ProjectLighthouse.Helpers {
public static class TimeHelper {
public static long UnixTimeMilliseconds() => DateTimeOffset.Now.ToUnixTimeMilliseconds();
public static long UnixTimeSeconds() => DateTimeOffset.Now.ToUnixTimeSeconds();
}
}