POS_node/models/KDS.js

39 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-09-24 09:03:35 +08:00
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 },
state: { type: String },
duration: { type: Number },
},
{ timestamps: true }
);
const KDSModel = mongoose.model("KDS", KDSSchema);
export default KDSModel;