We have improved Total.js Schemas by adding enhanced and powerful functionality that accelerates web development on the server-side. This update is a key feature of the Total.js framework.
NEWSCHEMA('Users', function(schema) {
    schema.action('create', {
        name: 'Create a user',
        input: '*name:String, *email:Email',
        user: true,                           // Checks if the user instance exists
        permissions: 'editor, admin',         // Performs UNAUTHORIZED($, 'editor', 'admin') automatically
        action: async function($, model) {
            model.id = UID();
            model.dtcreated = NOW;
            await DB().insert('tbl_user', model).promise($);
            $.success(model.id);
        }
    });
    schema.action('update', {
        name: 'Update a user',
        input: '*name:String, *email:Email',
        params: '*id:UID',
        permissions: 'admin',
        action: async function($, model) {
            var params = $.params;
            model.dtcreated = NOW;
            await DB().modify('tbl_user', model).id(params.id).error('User not found').promise($);
            $.success(params.id);
        }
    });
    schema.action('remove', {
        name: 'Remove a user',
        params: '*id:UID',
        permissions: 'admin',
        action: async function($, model) {
            var params = $.params;
            await DB().remove('tbl_user').id(params.id).error('User not found').promise($);
            $.success(params.id);
        }
    });
});
 
The old declaration will be removed in Total.js v5. The plan is to release a new version of Total.js in 2024.