UNPKG

dt-common-device

Version:

A secure and robust device management library for IoT applications

29 lines (28 loc) 1.75 kB
import mongoose, { Model } from "mongoose"; import { AlertCategory, AlertSeverity, EntityType, AlertDocument as IAlertDocument, CreateAlertData, UpdateAlertData } from "./alert.types"; interface IAlertMethods { markAsRead(updatedBy: string): void; markAsUnread(updatedBy: string): void; activate(updatedBy: string): void; deactivate(updatedBy: string): void; snooze(until: Date, updatedBy: string): void; unsnooze(updatedBy: string): void; } interface IAlertModel extends Model<IAlertDocument, {}, IAlertMethods> { findByProperty(propertyId: string, includeDeleted?: boolean): Promise<IAlertDocument[]>; findByEntity(entityId: string, entityType: EntityType, includeDeleted?: boolean): Promise<IAlertDocument[]>; findByCategory(category: AlertCategory, includeDeleted?: boolean): Promise<IAlertDocument[]>; findBySeverity(severity: AlertSeverity, includeDeleted?: boolean): Promise<IAlertDocument[]>; findActive(includeDeleted?: boolean): Promise<IAlertDocument[]>; findUnread(includeDeleted?: boolean): Promise<IAlertDocument[]>; findSnoozed(includeDeleted?: boolean): Promise<IAlertDocument[]>; findExpiredSnooze(includeDeleted?: boolean): Promise<IAlertDocument[]>; } declare const AlertSchema: mongoose.Schema<IAlertDocument, IAlertModel, IAlertMethods, {}, {}, {}, mongoose.DefaultSchemaOptions, IAlertDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAlertDocument>, {}> & Omit<mongoose.FlatRecord<IAlertDocument> & Required<{ _id: string; }> & { __v: number; }, keyof IAlertMethods> & IAlertMethods>; export declare const AlertModel: IAlertModel; export { AlertSchema }; export type { IAlertDocument, CreateAlertData, UpdateAlertData, IAlertMethods, IAlertModel, };