Skip to main content

Notification Entities

Entities for user notifications and alerts.

Notification

Purpose: User notifications for various activities (likes, comments, mentions, etc.).

Key Fields:

  • Id (Guid): Unique identifier
  • UserId: Notification recipient
  • Type: Notification type (Like, Comment, Mention, FriendRequest, etc.)
  • Title: Notification title
  • Message: Notification message
  • RelatedEntityId: Related entity ID (PostId, CommentId, BookingId, etc.)
  • RelatedEntityType: Entity type ("Post", "Comment", "Booking", etc.)
  • ActorUserId: User who triggered the notification
  • IsRead: Whether notification is read
  • ReadAt: Read timestamp
  • CreatedAt: Notification timestamp

Relationships:

  • Many-to-one: User (recipient and actor)

Usage Patterns:

// Create notification
var notification = new Notification
{{
UserId = recipientId,
Type = NotificationType.Like,
Title = "New Like",
Message = "John liked your post",
RelatedEntityId = postId,
RelatedEntityType = "Post",
ActorUserId = actorId,
IsRead = false,
CreatedAt = DateTime.UtcNow
}};

// Get unread notifications
var notifications = context.Notifications
.Where(n => n.UserId == userId && !n.IsRead)
.Include(n => n.ActorUser)
.OrderByDescending(n => n.CreatedAt)
.ToList();

Notification Types

Common notification types include:

  • Like: Post or comment liked
  • Comment: New comment on post
  • Mention: User mentioned in post/comment
  • FriendRequest: Friend request received
  • FriendAccepted: Friend request accepted
  • PostApproved: Post approved by moderation
  • PostRejected: Post rejected by moderation
  • TournamentRegistration: Tournament registration confirmation
  • BookingConfirmed: Charter booking confirmed
  • PaymentSuccess: Payment successful
  • PaymentFailed: Payment failed
  • SubscriptionRenewed: Subscription renewed
  • SubscriptionCancelled: Subscription cancelled
  • SignalR Hubs - See FishingLog.API/Hubs/NotificationHub.cs for real-time notification delivery
  • Social Features - Social interactions