<commit_before>module.exports = function initContentTypes(app){
    "use strict";

    var contentTypes = {},
        internal = {},
        _ = require("underscore"),
        async = require("async"),
        AVAILABLE_FIELD_TYPES = [
            'readonly',
            'textbox',
            'textarea',
            'richtext',
            'dropdown',
            'checkbox',
            'content-reference',
            'file-reference',
            'datetime',
            'code-editor'
        ],
        LOGGING_CATEGORY = "GRASSHOPPER-CONTENT-TYPES";

    internal.app = app;

    function validateContentType(contentTypeObject, callback){

    }

    function isFieldValid(fieldObj){

    }

    function isValidFieldObject(collection){

    }

    contentTypes.create = function(obj, callback){
        validateContentType(obj, function(err){
            if(err){
                callback.call(this, err);
            }


        });
    };

    contentTypes.delete = function(){

    };

    contentTypes.update = function(){

    };

    contentTypes.list = function(options, callback){

        async.parallel(
            [
                function(cb){
                    internal.app.db.contentTypes.list(options, function(err, list){
                        cb(err, list);
                    });
                },
                function(cb){
                    internal.app.db.contentTypes.describe(options, function(err, totals){
                        cb(err, totals);
                    });
                }
            ],function(err, results){
                if(err){
                    callback(err);
                }
                else {
                    callback(null, {
                        total: results[1][0].count,
                        results: results[0]
                    });
                }
            }
        );

    };

    contentTypes.getById = function(){

    };

    return contentTypes;
};
<commit_msg>Added  a method to get a content type by id to the system.<commit_after>module.exports = function initContentTypes(app){
    "use strict";

    var contentTypes = {},
        internal = {},
        _ = require("underscore"),
        async = require("async"),
        AVAILABLE_FIELD_TYPES = [
            'readonly',
            'textbox',
            'textarea',
            'richtext',
            'dropdown',
            'checkbox',
            'content-reference',
            'file-reference',
            'datetime',
            'code-editor'
        ],
        LOGGING_CATEGORY = "GRASSHOPPER-CONTENT-TYPES";

    internal.app = app;

    function validateContentType(contentTypeObject, callback){

    }

    function isFieldValid(fieldObj){

    }

    function isValidFieldObject(collection){

    }

    contentTypes.create = function(obj, callback){
        validateContentType(obj, function(err){
            if(err){
                callback.call(this, err);
            }


        });
    };

    contentTypes.delete = function(){

    };

    contentTypes.update = function(){

    };

    contentTypes.getById = function(id, callback){
        internal.app.db.contentTypes.getById(id, function(err, val){
            callback(err, val);
        });
    };

    contentTypes.list = function(options, callback){

        async.parallel(
            [
                function(cb){
                    internal.app.db.contentTypes.list(options, function(err, list){
                        cb(err, list);
                    });
                },
                function(cb){
                    internal.app.db.contentTypes.describe(options, function(err, totals){
                        cb(err, totals);
                    });
                }
            ],function(err, results){
                if(err){
                    callback(err);
                }
                else {
                    callback(null, {
                        total: results[1][0].count,
                        results: results[0]
                    });
                }
            }
        );

    };

    return contentTypes;
};

{'fraction_non_alphanumeric': 0.11445929526123937, 'fraction_numerical': 0.0014580801944106927, 'mean_word_length': 1.2702702702702702, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2857641', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1008, 'n_words': 168}