Skip to content

Commit

Permalink
(#433) users: udpate command and core objects
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintAngeLs committed Oct 11, 2024
1 parent 3c62da8 commit cf0198f
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ public async Task HandleAsync(UpdateUserNotificationPreferences command, Cancell
var commandJson = JsonSerializer.Serialize(command);
Console.WriteLine($"Received UpdateUserNotificationPreferences command: {commandJson}");

// Create the updated NotificationPreferences object
var notificationPreferences = new NotificationPreferences(
command.AccountChanges,
command.SystemLogin,
command.NewEvent,
command.InterestBasedEvents,
command.EventNotifications,
command.CommentsNotifications,
command.PostsNotifications,
command.FriendsNotifications
command.EventRecommendation,
command.FriendsRecommendation,
command.FriendsPosts,
command.PostsRecommendation,
command.EventsIAmInterestedInNotification,
command.EventsIAmSignedUpToNotification,
command.PostsOfPeopleIFollowNotification,
command.EventNotificationForPeopleIFollow
);

await _userNotificationPreferencesRepository.UpdateNotificationPreferencesAsync(command.StudentId, notificationPreferences);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,43 @@ public class UpdateUserNotificationPreferences : ICommand
{
public Guid StudentId { get; set; }
public bool EmailNotifications { get; set; }
public bool AccountChanges { get; set; }

public bool SystemLogin { get; set; }
public bool NewEvent { get; set; }
public bool InterestBasedEvents { get; set; }
public bool EventNotifications { get; set; }
public bool CommentsNotifications { get; set; }
public bool PostsNotifications { get; set; }
public bool FriendsNotifications { get; set; }
}

public bool EventRecommendation { get; set; }
public bool FriendsRecommendation { get; set; }
public bool FriendsPosts { get; set; }
public bool PostsRecommendation { get; set; }
public bool EventsIAmInterestedInNotification { get; set; }
public bool EventsIAmSignedUpToNotification { get; set; }
public bool PostsOfPeopleIFollowNotification { get; set; }
public bool EventNotificationForPeopleIFollow { get; set; }

public UpdateUserNotificationPreferences(Guid studentId, bool emailNotifications, bool systemLogin, bool interestBasedEvents,
bool eventNotifications, bool commentsNotifications, bool postsNotifications, bool eventRecommendation,
bool friendsRecommendation, bool friendsPosts, bool postsRecommendation, bool eventsIAmInterestedInNotification,
bool eventsIAmSignedUpToNotification, bool postsOfPeopleIFollowNotification, bool eventNotificationForPeopleIFollow)
{
StudentId = studentId;
EmailNotifications = emailNotifications;
SystemLogin = systemLogin;
InterestBasedEvents = interestBasedEvents;
EventNotifications = eventNotifications;
CommentsNotifications = commentsNotifications;
PostsNotifications = postsNotifications;

EventRecommendation = eventRecommendation;
FriendsRecommendation = friendsRecommendation;
FriendsPosts = friendsPosts;
PostsRecommendation = postsRecommendation;
EventsIAmInterestedInNotification = eventsIAmInterestedInNotification;
EventsIAmSignedUpToNotification = eventsIAmSignedUpToNotification;
PostsOfPeopleIFollowNotification = postsOfPeopleIFollowNotification;
EventNotificationForPeopleIFollow = eventNotificationForPeopleIFollow;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,81 @@ namespace MiniSpace.Services.Students.Core.Entities
{
public class NotificationPreferences
{
public bool AccountChanges { get; private set; }
public bool SystemLogin { get; private set; }
public bool NewEvent { get; private set; }
public bool InterestBasedEvents { get; private set; }
public bool EventNotifications { get; private set; }
public bool CommentsNotifications { get; private set; }
public bool PostsNotifications { get; private set; }
public bool FriendsNotifications { get; private set; }


public bool EventRecommendation { get; private set; }
public bool FriendsRecommendation { get; private set; }
public bool FriendsPosts { get; private set; }
public bool PostsRecommendation { get; private set; }
public bool EventsIAmInterestedInNotification { get; private set; }
public bool EventsIAmSignedUpToNotification { get; private set; }
public bool PostsOfPeopleIFollowNotification { get; private set; }
public bool EventNotificationForPeopleIFollow { get; private set; }

public NotificationPreferences()
{

AccountChanges = false;
SystemLogin = false;
NewEvent = false;
InterestBasedEvents = false;
EventNotifications = false;
CommentsNotifications = false;
PostsNotifications = false;
FriendsNotifications = false;
}

EventRecommendation = false;
FriendsRecommendation = false;
FriendsPosts = false;
PostsRecommendation = false;
EventsIAmInterestedInNotification = false;
EventsIAmSignedUpToNotification = false;
PostsOfPeopleIFollowNotification = false;
EventNotificationForPeopleIFollow = false;
}

public NotificationPreferences(bool accountChanges, bool systemLogin, bool newEvent, bool interestBasedEvents,
bool eventNotifications, bool commentsNotifications, bool postsNotifications,
bool friendsNotifications)
public NotificationPreferences(bool systemLogin, bool interestBasedEvents, bool eventNotifications,
bool commentsNotifications, bool postsNotifications, bool eventRecommendation,
bool friendsRecommendation, bool friendsPosts, bool postsRecommendation,
bool eventsIAmInterestedInNotification, bool eventsIAmSignedUpToNotification,
bool postsOfPeopleIFollowNotification, bool eventNotificationForPeopleIFollow)
{
AccountChanges = accountChanges;
SystemLogin = systemLogin;
NewEvent = newEvent;
InterestBasedEvents = interestBasedEvents;
EventNotifications = eventNotifications;
CommentsNotifications = commentsNotifications;
PostsNotifications = postsNotifications;
FriendsNotifications = friendsNotifications;

EventRecommendation = eventRecommendation;
FriendsRecommendation = friendsRecommendation;
FriendsPosts = friendsPosts;
PostsRecommendation = postsRecommendation;
EventsIAmInterestedInNotification = eventsIAmInterestedInNotification;
EventsIAmSignedUpToNotification = eventsIAmSignedUpToNotification;
PostsOfPeopleIFollowNotification = postsOfPeopleIFollowNotification;
EventNotificationForPeopleIFollow = eventNotificationForPeopleIFollow;
}

public void UpdatePreferences(bool accountChanges, bool systemLogin, bool newEvent, bool interestBasedEvents,
bool eventNotifications, bool commentsNotifications, bool postsNotifications,
bool friendsNotifications)
public void UpdatePreferences(bool systemLogin, bool interestBasedEvents, bool eventNotifications,
bool commentsNotifications, bool postsNotifications, bool eventRecommendation,
bool friendsRecommendation, bool friendsPosts, bool postsRecommendation,
bool eventsIAmInterestedInNotification, bool eventsIAmSignedUpToNotification,
bool postsOfPeopleIFollowNotification, bool eventNotificationForPeopleIFollow)
{
AccountChanges = accountChanges;
SystemLogin = systemLogin;
NewEvent = newEvent;
InterestBasedEvents = interestBasedEvents;
EventNotifications = eventNotifications;
CommentsNotifications = commentsNotifications;
PostsNotifications = postsNotifications;
FriendsNotifications = friendsNotifications;

EventRecommendation = eventRecommendation;
FriendsRecommendation = friendsRecommendation;
FriendsPosts = friendsPosts;
PostsRecommendation = postsRecommendation;
EventsIAmInterestedInNotification = eventsIAmInterestedInNotification;
EventsIAmSignedUpToNotification = eventsIAmSignedUpToNotification;
PostsOfPeopleIFollowNotification = postsOfPeopleIFollowNotification;
EventNotificationForPeopleIFollow = eventNotificationForPeopleIFollow;
}
}
}

0 comments on commit cf0198f

Please sign in to comment.