UNPKG

@replyke/express

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

127 lines (126 loc) 4.61 kB
import { Model, Optional } from "sequelize"; export interface IAppNotificationAttributes { id: string; projectId: string; userId: string; type: string; action: string; isRead: boolean; metadata: Record<string, any>; createdAt: Date; updatedAt: Date; } export interface IAppNotificationCreationAttributes extends Optional<IAppNotificationAttributes, "id" | "createdAt" | "updatedAt" | "isRead"> { } export default interface IAppNotification extends Model<IAppNotificationAttributes, IAppNotificationCreationAttributes>, IAppNotificationAttributes { } interface BaseNotificationParams { projectId: string; userId: string; } interface EntityCommentNotificationParams extends BaseNotificationParams { type: "entity-comment"; action: "open-comment"; metadata: { entityId: string; entityShortId: string; entityTitle: string | null | undefined; entityContent: string | null | undefined; commentId: string; commentContent: string | null | undefined; initiatorId: string; initiatorName: string | null | undefined; initiatorUsername: string | null | undefined; initiatorAvatar: string | null | undefined; }; } interface CommentReplyNotificationParams extends BaseNotificationParams { type: "comment-reply"; action: "open-comment"; metadata: { entityId: string; entityShortId: string; entityTitle: string | null | undefined; entityContent: string | null | undefined; commentId: string; commentContent: string | null | undefined; replyId: string; replyContent: string | null | undefined; initiatorId: string; initiatorName: string | null | undefined; initiatorUsername: string | null | undefined; initiatorAvatar: string | null | undefined; }; } export interface EntityMentionNotification extends BaseNotificationParams { type: "entity-mention"; action: "open-entity"; metadata: { entityId: string; entityShortId: string; entityTitle: string | null | undefined; entityContent: string | null | undefined; initiatorId: string; initiatorName: string | null | undefined; initiatorUsername: string | null | undefined; initiatorAvatar: string | null | undefined; }; } export interface CommentMentionNotification extends BaseNotificationParams { type: "comment-mention"; action: "open-comment"; metadata: { entityId: string; entityShortId: string; entityTitle: string | null | undefined; entityContent: string | null | undefined; commentId: string; commentContent: string | null | undefined; initiatorId: string; initiatorName: string | null | undefined; initiatorUsername: string | null | undefined; initiatorAvatar: string | null | undefined; }; } export interface EntityUpvoteNotification extends BaseNotificationParams { type: "entity-upvote"; action: "open-entity"; metadata: { entityId: string; entityShortId: string; entityTitle: string | null | undefined; entityContent: string | null | undefined; initiatorId: string; initiatorName: string | null | undefined; initiatorUsername: string | null | undefined; initiatorAvatar: string | null | undefined; }; } export interface CommentUpvoteNotification extends BaseNotificationParams { type: "comment-upvote"; action: "open-comment"; metadata: { entityId: string; entityShortId: string; entityTitle: string | null | undefined; entityContent: string | null | undefined; commentId: string; commentContent: string | null | undefined; initiatorId: string; initiatorName: string | null | undefined; initiatorUsername: string | null | undefined; initiatorAvatar: string | null | undefined; }; } export interface NewFollowNotification extends BaseNotificationParams { type: "new-follow"; action: "open-profile"; metadata: { initiatorId: string; initiatorName: string | null | undefined; initiatorUsername: string | null | undefined; initiatorAvatar: string | null | undefined; }; } export type NotificationParams = EntityCommentNotificationParams | CommentReplyNotificationParams | EntityMentionNotification | CommentMentionNotification | EntityUpvoteNotification | CommentUpvoteNotification | NewFollowNotification; export {};