<commit_before>var exports = module.exports = {};

var mongoose = require("mongoose"),
    autoIncrement = require('mongoose-auto-increment');

var Schema = mongoose.Schema;
var schema = {
    timespan: Schema({
        start:    Date,   
        end:      Date, 
        val:      Array,     //array of days 
    }),
    day: Schema({
        date:     Object,   //ISO timestamp
        sids:     Array,     //array of schedule data
    }),
    schedule: Schema({
        sid:      Number,    //primary key
        uid:      Number,    //foreign key
        date:     Object,    //{human, ISO, unix} timestamps

        time:     Array,     //array of clock ins and outs
        detail:   Array,     //string or array describing the role
        access:   String,    //Manager or Floor schedule
        tags:     Array,     //array of tags For Trade, For Sell, Just Traded, etc...
    }),
    trade: Schema({
        tid:      Number,   //primary key
        sid:      Number,   //foreign key
        uid:      Number,   //foreign key

        term:     Object,   //conditions of the trade
        status:   Number,   //is trade pending, complete, or failed
    }),
    user: Schema({
        uid:      Number,   //primary key
        name:     String,   //full name
        nick:     String,   //displayed name

        access:   Array,    //security clearance across shiftswap
        role:     Array,    //different jobs the user can do

        lastlog:  Date,   
        period:   Array,    //When the user began working and their termination.
    }),
    userPrivate: Schema({
        uid:      Number,   //primary key
        pass:     String,
        email:    String,
        phone:    String,
        ipHistory: Array,
    }),
    history: Schema({
        hid:      Number,   //primary key
        uid:      Number,   //foreign key
        time:     Date,
        
        weight:   String,   //system gen the impact of the change
        descr:    String,   //system gen description of the change
        comment:  String,   //user submitted description of the change

        change:   Object,   //the data after the change
        undo:     Object,   //the data before the change
    }),
    site: Schema({
        uidCount: Number,
        hidCount: Number,
        sidCount: Number,

        siteCount: Number,

        newsurl: String,      //the URL of a wordpress site to pull posts from
    }),
};

var model = {
    User:     mongoose.model('User'     , schema.user     ),
    History:  mongoose.model('History'  , schema.history  ),
    Site:     mongoose.model('Site'     , schema.site     ),
    Day:      mongoose.model('Day'      , schema.day      ),
    Trade:    mongoose.model('Trade'    , schema.trade    ),
    Schedule: mongoose.model('Schedule' , schema.schedule ),
}

schema.trade.plugin(autoIncrement.plugin, {model: 'Trade', field: 'tid'});
<commit_msg>Removed outdated types, added autoincrement<commit_after>var exports = module.exports = {};

var mongoose = require("mongoose"),
    autoIncrement = require('mongoose-auto-increment');

var Schema = mongoose.Schema;
var schema = {
    day: Schema({
        date:     Object,   //ISO timestamp
        sids:     Array,     //array of schedule data
    }),
    schedule: Schema({
        sid:      Number,    //primary key
        uid:      Number,    //foreign key
        date:     Object,    //{human, ISO, unix} timestamps

        time:     Array,     //array of clock ins and outs
        detail:   Array,     //string or array describing the role
        access:   String,    //"M"anager or "F"loor schedule
        tags:     Array,     //array of tags For Trade, For Sell, Just Traded, etc...
    }),
    trade: Schema({
        tid:      Number,   //primary key
        sid:      Number,   //foreign key
        uid:      Number,   //foreign key

        term:     Object,   //conditions of the trade
        status:   Number,   //is trade pending, complete, or failed
    }),
    user: Schema({
        uid:      Number,   //primary key
        name:     String,   //full name
        nick:     String,   //displayed name

        access:   Array,    //security clearance across shiftswap
        role:     Array,    //different jobs the user can do

        lastlog:  Date,   
        period:   Array,    //When the user began working and their termination.
    }),
    userPrivate: Schema({
        uid:      Number,   //primary key
        pass:     String,
        email:    String,
        phone:    String,
        ipHistory: Array,
    }),
    history: Schema({
        hid:      Number,   //primary key
        uid:      Number,   //foreign key
        time:     Date,
        
        weight:   String,   //system gen the impact of the change
        descr:    String,   //system gen description of the change
        comment:  String,   //user submitted description of the change

        change:   Object,   //the data after the change
        undo:     Object,   //the data before the change
    }),
    site: Schema({
        siteCount: Number,    //Number of times the site was visited

        newsurl: String,      //the URL of a wordpress site to pull posts from
    }),
};

var model = {
    User:     mongoose.model('User'     , schema.user     ),
    History:  mongoose.model('History'  , schema.history  ),
    Site:     mongoose.model('Site'     , schema.site     ),
    Day:      mongoose.model('Day'      , schema.day      ),
    Trade:    mongoose.model('Trade'    , schema.trade    ),
    Schedule: mongoose.model('Schedule' , schema.schedule ),
}

schema.trade.plugin(autoIncrement.plugin, {model: 'Trade',    field: 'tid'});
schema.trade.plugin(autoIncrement.plugin, {model: 'History',  field: 'hid'});
schema.trade.plugin(autoIncrement.plugin, {model: 'User',     field: 'uid'});
schema.trade.plugin(autoIncrement.plugin, {model: 'Schedule', field: 'sid'});

{'fraction_non_alphanumeric': 0.11062022090059473, 'fraction_numerical': 0.0, 'mean_word_length': 1.7402234636871508, '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': '5288706', 'n_tokens_mistral': 1666, 'n_tokens_neox': 1653, 'n_words': 541}