mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-08 04:48:44 +00:00
Initial framework for recent activity
This commit is contained in:
parent
8ed755759f
commit
605f9e68c5
10 changed files with 151 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Activity;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Interaction;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Maintenance;
|
||||
|
@ -26,6 +27,10 @@ public partial class DatabaseContext : DbContext
|
|||
public DbSet<WebTokenEntity> WebTokens { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Activity
|
||||
public DbSet<ActivityEntity> Activities { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Users
|
||||
public DbSet<CommentEntity> Comments { get; set; }
|
||||
public DbSet<LastContactEntity> LastContacts { get; set; }
|
||||
|
@ -81,6 +86,16 @@ public partial class DatabaseContext : DbContext
|
|||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options)
|
||||
{ }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<LevelActivityEntity>().UseTpcMappingStrategy();
|
||||
modelBuilder.Entity<PhotoActivityEntity>().UseTpcMappingStrategy();
|
||||
modelBuilder.Entity<PlaylistActivityEntity>().UseTpcMappingStrategy();
|
||||
modelBuilder.Entity<ScoreActivityEntity>().UseTpcMappingStrategy();
|
||||
modelBuilder.Entity<UserActivityEntity>().UseTpcMappingStrategy();
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
public static DatabaseContext CreateNewInstance()
|
||||
{
|
||||
DbContextOptionsBuilder<DatabaseContext> builder = new();
|
||||
|
|
26
ProjectLighthouse/Types/Activity/EventType.cs
Normal file
26
ProjectLighthouse/Types/Activity/EventType.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
namespace LBPUnion.ProjectLighthouse.Types.Activity;
|
||||
|
||||
public enum EventType
|
||||
{
|
||||
HeartLevel,
|
||||
UnheartLevel,
|
||||
HeartUser,
|
||||
UnheartUser,
|
||||
PlayLevel,
|
||||
RateLevel,
|
||||
TagLevel,
|
||||
CommentOnLevel,
|
||||
DeleteLevelComment,
|
||||
UploadPhoto,
|
||||
PublishLevel,
|
||||
UnpublishLevel,
|
||||
Score,
|
||||
NewsPost,
|
||||
MMPickLevel,
|
||||
DpadRateLevel,
|
||||
ReviewLevel,
|
||||
CommentOnUser,
|
||||
CreatePlaylist,
|
||||
HeartPlaylist,
|
||||
AddLevelToPlaylist,
|
||||
}
|
21
ProjectLighthouse/Types/Entities/Activity/ActivityEntity.cs
Normal file
21
ProjectLighthouse/Types/Entities/Activity/ActivityEntity.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using LBPUnion.ProjectLighthouse.Types.Activity;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Types.Entities.Activity;
|
||||
|
||||
public class ActivityEntity
|
||||
{
|
||||
[Key]
|
||||
public int ActivityId { get; set; }
|
||||
|
||||
public long Timestamp { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public UserEntity User { get; set; }
|
||||
|
||||
public EventType Type { get; set; }
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace LBPUnion.ProjectLighthouse.Types.Entities.Activity;
|
||||
|
||||
/// <summary>
|
||||
/// Supported event types: CommentOnUser, CommentOnLevel, DeleteLevelComment
|
||||
/// </summary>
|
||||
public class CommentActivityEntry
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Types.Entities.Activity;
|
||||
|
||||
/// <summary>
|
||||
/// Supported event types: play_level, heart_level, publish_level,
|
||||
/// </summary>
|
||||
public class LevelActivityEntity : ActivityEntity
|
||||
{
|
||||
public int SlotId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(SlotId))]
|
||||
public SlotEntity Slot { get; set; }
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
namespace LBPUnion.ProjectLighthouse.Types.Entities.Activity;
|
||||
|
||||
/// <summary>
|
||||
/// Supported event types: NewsPost
|
||||
/// </summary>
|
||||
public class NewsActivityEntity : ActivityEntity
|
||||
{
|
||||
public string Title { get; set; } = "";
|
||||
|
||||
public string Body { get; set; } = "";
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Types.Entities.Activity;
|
||||
|
||||
/// <summary>
|
||||
/// Supported event types: UploadPhoto
|
||||
/// </summary>
|
||||
public class PhotoActivityEntity : ActivityEntity
|
||||
{
|
||||
public int PhotoId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(PhotoId))]
|
||||
public PhotoEntity Photo { get; set; }
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Types.Entities.Activity;
|
||||
|
||||
public class PlaylistActivityEntity : ActivityEntity
|
||||
{
|
||||
public int PlaylistId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(PlaylistId))]
|
||||
public PlaylistEntity Playlist { get; set; }
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Types.Entities.Activity;
|
||||
|
||||
/// <summary>
|
||||
/// Supported event types: Score
|
||||
/// </summary>
|
||||
public class ScoreActivityEntity : ActivityEntity
|
||||
{
|
||||
public int ScoreId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ScoreId))]
|
||||
public ScoreEntity Score { get; set; }
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace LBPUnion.ProjectLighthouse.Types.Entities.Activity;
|
||||
|
||||
/// <summary>
|
||||
/// Supported event types: HeartUser, UnheartUser
|
||||
/// </summary>
|
||||
public class UserActivityEntity : ActivityEntity
|
||||
{
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue