/**
* notification-without-required-constraint Model
* Generated: 2025-04-01T19:44:53.356Z
*/
/**
* notification-without-required-constraint model class
*/
export class NotificationWithoutRequiredConstraint {
/**
* Create a new notification-without-required-constraint instance
* @param {Object} data - Initial data
*/
constructor(data = {}) {
/**
* Note Sails special attributes: autoIncrement
* @type integer
*/
this.id = data.id !== undefined ? data.id : undefined;
/**
*
* @type number
*/
this.createdAt = data.createdAt !== undefined ? data.createdAt : undefined;
/**
*
* @type number
*/
this.updatedAt = data.updatedAt !== undefined ? data.updatedAt : undefined;
/**
* The user who created this record JSON dictionary representing the **person** instance or FK when creating / updating / not populated
* @type any
*/
this.createdBy = data.createdBy !== undefined ? data.createdBy : undefined;
/**
*
* @type string
*/
this.title = data.title !== undefined ? data.title : undefined;
/**
*
* @type string
*/
this.description = data.description !== undefined ? data.description : undefined;
/**
* Optional URL to navigate to when the notification is clicked
* @type string
*/
this.url = data.url !== undefined ? data.url : undefined;
/**
* Indicates if the page should refresh after clicking the notification
* @type boolean
*/
this.shouldRefresh = data.shouldRefresh !== undefined ? data.shouldRefresh : undefined;
/**
* Indicates if this notification should trigger an alert
* @type boolean
*/
this.notify = data.notify !== undefined ? data.notify : undefined;
/**
* The type/severity of the notification
* @type string
*/
this.type = data.type !== undefined ? data.type : undefined;
/**
* The delivery status of the notification
* @type string
*/
this.status = data.status !== undefined ? data.status : undefined;
/**
* The company this notification belongs to JSON dictionary representing the **company** instance or FK when creating / updating / not populated
* @type any
*/
this.company = data.company !== undefined ? data.company : undefined;
/**
* The specific user this notification is for (if applicable) JSON dictionary representing the **person** instance or FK when creating / updating / not populated
* @type any
*/
this.person = data.person !== undefined ? data.person : undefined;
/**
* The specific case this notification is for (if applicable) JSON dictionary representing the **case** instance or FK when creating / updating / not populated
* @type any
*/
this.case = data.case !== undefined ? data.case : undefined;
}
/**
* Validate the model
* @returns {Object} - Validation result {valid: boolean, errors: Object}
*/
validate() {
const errors = {};
return {
valid: Object.keys(errors).length === 0,
errors
};
}
/**
* Convert the model to a plain object
* @returns {Object} - Plain object representation
*/
toJSON() {
const data = {};
if (this.id !== undefined) {
data.id = this.id;
}
if (this.createdAt !== undefined) {
data.createdAt = this.createdAt;
}
if (this.updatedAt !== undefined) {
data.updatedAt = this.updatedAt;
}
if (this.createdBy !== undefined) {
data.createdBy = this.createdBy;
}
if (this.title !== undefined) {
data.title = this.title;
}
if (this.description !== undefined) {
data.description = this.description;
}
if (this.url !== undefined) {
data.url = this.url;
}
if (this.shouldRefresh !== undefined) {
data.shouldRefresh = this.shouldRefresh;
}
if (this.notify !== undefined) {
data.notify = this.notify;
}
if (this.type !== undefined) {
data.type = this.type;
}
if (this.status !== undefined) {
data.status = this.status;
}
if (this.company !== undefined) {
data.company = this.company;
}
if (this.person !== undefined) {
data.person = this.person;
}
if (this.case !== undefined) {
data.case = this.case;
}
return data;
}
/**
* Create a notification-without-required-constraint instance from JSON data
* @param {Object} data - JSON data
* @returns NotificationWithoutRequiredConstraint - New model instance
*/
static fromJSON(data) {
return new NotificationWithoutRequiredConstraint(data);
}
}
export default NotificationWithoutRequiredConstraint;