const BaseModel = require("./base_model.js");
class CustomerModel extends BaseModel {
static get tableName() {
return "customers";
}
static get jsonSchema() {
return {
type: "object", required: ['name','phone_number','email'],
properties: {
id: { type: "string" },
name: { type: ["string", "null"], maxLength: 150 },
phone_number: { type: ["string", "null"] },
email: { type: ["string", "null"], maxLength: 150 },
website: { type: ["string", "null"], maxLength: 150 },
address: { type: ["string", "null"], maxLength: 150 },
customer_type: { "type": "string" },
version: { type: ["integer"] },
synced_at: { "type": ["string", "null"] },
created_at: { "type": "string" },
updated_at: { "type": "string" }
}
};
}
get itemVersion() {
return false;
}
}
module.exports = CustomerModel;
I prefer to disable validation during model updates.