34 lines
945 B
JavaScript
34 lines
945 B
JavaScript
|
import mongoose, { Schema } from "mongoose";
|
||
|
|
||
|
// Define the KDSItem schema
|
||
|
const KDSItemSchema = new Schema(
|
||
|
{
|
||
|
ordered_prod_id: { type: Number },
|
||
|
product_id: { type: Number },
|
||
|
quantity: { type: Number },
|
||
|
order_id: { type: Number },
|
||
|
product_name: { type: String },
|
||
|
note: { type: String },
|
||
|
},
|
||
|
{ _id: false }
|
||
|
);
|
||
|
// Define the KDS schema
|
||
|
const KDSSchema = new Schema({
|
||
|
order_id: { type: Number, required: true, unique: true },
|
||
|
order_name: { type: String },
|
||
|
order_date: { type: String },
|
||
|
cancelled: { type: Boolean },
|
||
|
ref_ticket: { type: String },
|
||
|
take_away: { type: Boolean },
|
||
|
seat_id: { type: String },
|
||
|
customer_count: { type: Number },
|
||
|
row_pos: { type: Number },
|
||
|
ref_id: { type: String, required: true, unique: true },
|
||
|
items: { type: [KDSItemSchema] },
|
||
|
stage: { type: String },
|
||
|
duration: { type: Number },
|
||
|
});
|
||
|
const KDSGrouped = mongoose.model("KDS", KDSSchema);
|
||
|
|
||
|
export default KDSGrouped;
|