idea-toolbox
Version:
IDEA's utility functions
38 lines (37 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContactRequest = void 0;
const resource_model_1 = require("./resource.model");
const clientInfo_model_1 = require("./clientInfo.model");
/**
* Contact request from the Contacts Us box of the website or from specific campaigns.
*
* Table: `idea_contactRequests`.
*
* Indexes:
* - `campaign-timestamp-index` (GSI); includes: name, wantsDemo.
*/
class ContactRequest extends resource_model_1.Resource {
load(x) {
super.load(x);
this.email = this.clean(x.email, String);
this.timestamp = this.clean(x.timestamp, d => new Date(d).getTime(), Date.now());
if (x.name)
this.name = this.clean(x.name, String);
if (x.campaign)
this.campaign = this.clean(x.campaign, String);
if (x.wantsDemo !== undefined)
this.wantsDemo = this.clean(x.wantsDemo, Boolean);
if (x.client)
this.client = new clientInfo_model_1.ClientInfo(x.client);
if (x.notes)
this.notes = this.clean(x.notes, String);
}
validate() {
const e = super.validate();
if (this.iE(this.email, 'email'))
e.push('email');
return e;
}
}
exports.ContactRequest = ContactRequest;