Notification Entities
Entities for user notifications and alerts.
Notification
Purpose: User notifications for various activities (likes, comments, mentions, etc.).
Key Fields:
Id(Guid): Unique identifierUserId: Notification recipientType: Notification type (Like, Comment, Mention, FriendRequest, etc.)Title: Notification titleMessage: Notification messageRelatedEntityId: Related entity ID (PostId, CommentId, BookingId, etc.)RelatedEntityType: Entity type ("Post", "Comment", "Booking", etc.)ActorUserId: User who triggered the notificationIsRead: Whether notification is readReadAt: Read timestampCreatedAt: 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 likedComment: New comment on postMention: User mentioned in post/commentFriendRequest: Friend request receivedFriendAccepted: Friend request acceptedPostApproved: Post approved by moderationPostRejected: Post rejected by moderationTournamentRegistration: Tournament registration confirmationBookingConfirmed: Charter booking confirmedPaymentSuccess: Payment successfulPaymentFailed: Payment failedSubscriptionRenewed: Subscription renewedSubscriptionCancelled: Subscription cancelled
Related Documentation
- SignalR Hubs - See
FishingLog.API/Hubs/NotificationHub.csfor real-time notification delivery - Social Features - Social interactions