<commit_before>import { Mongo } from 'meteor/mongo';
import { Class, Enum } from 'meteor/jagi:astronomy';
import { Type } from 'meteor/jagi:astronomy';
import { MenuItem } from './menuItem.js';

export const Orders = new Mongo.Collection('orders');
export const Customers = new Mongo.Collection('customers');

var minID = [{
	type: 'gt',
	param: 0
}]

/*
 * Custom types
 */

Type.create({
	name: 'orderItem',
	class: 'orderItem'
})

/*
 * Class definitions
 */

export const orderItem = Class.create({
	name: 'orderItem',
	fields: {
		itemID: {
			type: Number,
			validators: minID
		},
		priority: {
			type: Number
		},
		menuItemID: {
			type: Number
		},
		specialRequests: {
			type: String
		}
	}
});

export const Order = Class.create({
	name: 'Order',
	collection: Orders,
	fields: {
		orderID: {
			type: Number,
			validators: minID
		},
		waiterID: {
			type: Number,
			validators: minID
		},
		orderItems: {
			type: [orderItem],
		},
		timePlaced: {
			type: Date
		}
	},
	indexes: {
		orderID: {
			fields: {
				orderID: 1
			},
			options: {
				unique: true
			}
		}
	}
});<commit_msg>Added save function to place an order from client side<commit_after>import { Mongo } from 'meteor/mongo';
import { Class, Enum } from 'meteor/jagi:astronomy';
import { Type } from 'meteor/jagi:astronomy';
import { MenuItem } from './menuItem.js';

export const Orders = new Mongo.Collection('orders');
export const Customers = new Mongo.Collection('customers');

var minID = [{
	type: 'gt',
	param: 0
}]

/*
 * Custom types
 */

Type.create({
	name: 'orderItem',
	class: 'orderItem'
})

/*
 * Class definitions
 */

export const orderItem = Class.create({
	name: 'orderItem',
	fields: {
		itemID: {
			type: Number,
			validators: minID
		},
		priority: {
			type: Number
		},
		menuItemID: {
			type: Number
		},
		specialRequests: {
			type: String
		}
	}
});

export const Order = Class.create({
	name: 'Order',
	collection: Orders,
	fields: {
		orderID: {
			type: Number,
			validators: minID
		},
		waiterID: {
			type: Number,
			validators: minID
		},
		orderItems: {
			type: [orderItem],
		},
		timePlaced: {
			type: Date
		}
	},
	indexes: {
		orderID: {
			fields: {
				orderID: 1
			},
			options: {
				unique: true
			}
		}
	},
	meteorMethods: {
		// Elementary function required for Demo 1 functionality.
		placeOrder() {
			this.save();
		}
	}
});
{'fraction_non_alphanumeric': 0.15063291139240506, 'fraction_numerical': 0.002109704641350211, 'mean_word_length': 3.01864406779661, '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': '5490168', 'n_tokens_mistral': 993, 'n_tokens_neox': 860, 'n_words': 211}