Skip to content

Commit

Permalink
(#401) users: add core domain objects:
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintAngeLs committed Sep 1, 2024
1 parent bad506d commit 6b3dc35
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;

namespace MiniSpace.Services.Students.Core.Entities
{
public class UserProfileViews
{
public Guid UserId { get; private set; }
public IEnumerable<View> Views { get; private set; }

public UserProfileViews(Guid userProfileId, IEnumerable<View> views)
{
UserId = userProfileId;
Views = views ?? new List<View>();
}

public void AddView(Guid userProfileId, DateTime date)
{
var viewList = new List<View>(Views)
{
new View(userProfileId, date)
};
Views = viewList;
}

public void RemoveView(Guid userProfileId)
{
var viewList = new List<View>(Views);
var viewToRemove = viewList.Find(view => view.UserProfileId == userProfileId);
if (viewToRemove != null)
{
viewList.Remove(viewToRemove);
Views = viewList;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MiniSpace.Services.Students.Core.Entities
{
public class View
{
public Guid UserProfileId { get; private set; }
public DateTime Date { get; private set; }

public View(Guid postId, DateTime date)
{
UserProfileId = postId;
Date = date;
}
}
}

0 comments on commit 6b3dc35

Please sign in to comment.