<commit_before>"use strict";

const mongoose = require('mongoose');
mongoose.Promise = require('bluebird');
const statusPlugin = require('./plugins/status-plugin');

const AddressSchema = require('./Address');
const OrgSchema = require('./Organization');
const ContactSchema = require('./Contact');
const InvoiceItemSchema = require('./InvoiceItem');

const InvoiceSchema = new mongoose.Schema({
    number: { type: String, required: true },  // normally created as prefix+number
    type: {type: String, required: true},
    invoicingOrg: { type: mongoose.Schema.Types.ObjectId, ref: 'invoicingOrg' },
    issuingOrg: OrgSchema,
    issuingAdr: AddressSchema,
    issuingContact: ContactSchema,
    billOrg: OrgSchema,
    billAdr: AddressSchema,
    billContact: ContactSchema,
    issuedOn: {type: Date},
    dueOn: {type:Date},
    paidOn: {type: Date},
    team: { type: mongoose.Schema.Types.ObjectId, ref: 'Team' },
    items: [InvoiceItemSchema],
    total: {type: Number},
    currency: {type: String}
});

InvoiceSchema.statics.testData = function(rec, id){
    if (!id) id = 'FA12345';
    rec.billOrg = {};
    OrgSchema.testData(rec.billOrg, 'boT'+id);
    rec.issuingOrg = {};
    OrgSchema.testData(rec.issuingOrg, 'soT'+id);<commit_msg>removing unused require<commit_after>"use strict";

const mongoose = require('mongoose');
mongoose.Promise = require('bluebird');

const AddressSchema = require('./Address');
const OrgSchema = require('./Organization');
const ContactSchema = require('./Contact');
const InvoiceItemSchema = require('./InvoiceItem');

const InvoiceSchema = new mongoose.Schema({
    number: { type: String, required: true },  // normally created as prefix+number
    type: {type: String, required: true},
    invoicingOrg: { type: mongoose.Schema.Types.ObjectId, ref: 'invoicingOrg' },
    issuingOrg: OrgSchema,
    issuingAdr: AddressSchema,
    issuingContact: ContactSchema,
    billOrg: OrgSchema,
    billAdr: AddressSchema,
    billContact: ContactSchema,
    issuedOn: {type: Date},
    dueOn: {type:Date},
    paidOn: {type: Date},
    team: { type: mongoose.Schema.Types.ObjectId, ref: 'Team' },
    items: [InvoiceItemSchema],
    total: {type: Number},
    currency: {type: String}
});

InvoiceSchema.statics.testData = function(rec, id){
    if (!id) id = 'FA12345';
    rec.billOrg = {};
    OrgSchema.testData(rec.billOrg, 'boT'+id);
    rec.issuingOrg = {};
    OrgSchema.testData(rec.issuingOrg, 'soT'+id);
{'fraction_non_alphanumeric': 0.1514041514041514, 'fraction_numerical': 0.00407000407000407, 'mean_word_length': 4.378555798687089, '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': '870259', 'n_tokens_mistral': 801, 'n_tokens_neox': 776, 'n_words': 180}