libflitter/templates/model.js

/**
 * @module libflitter/templates/model
 */

/**
 * Get the contents of a new Model definition file with the specified object name.
 * @param {string} name - the object name of the new model definition
 * @returns {string}
 */
module.exports = exports = (name) => {
    return `const Model = require('flitter-orm/src/model/Model')

/*
 * ${name} Model
 * -------------------------------------------------------------
 * Put some description here!
 */
class ${name} extends Model {
    static get schema() {
        // Return a flitter-orm schema here.
        return {
            some_field: String,
        }
    }
    
    // Static and instance methods can go here
}

module.exports = exports = ${name}`
}