This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="circles"> | |
<div></div> | |
<div></div> | |
<div></div> | |
<span></span> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require("mongoose"); | |
const UserShema = mongoose.Schema({ | |
name: String, | |
lastname: String, | |
username: { | |
type: String, | |
unique: true | |
}, | |
password: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require("mongoose"); | |
const Plate = mongoose.model("Plate"); | |
const Schema = mongoose.Schema; | |
const OrderSchema = Schema({ | |
order_detail: [{ type: Schema.Types.ObjectId, ref: Plate }], | |
date: Date, | |
table: Number | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require("mongoose"); | |
const PlateSchema = mongoose.Schema({ | |
name: String, | |
price: Number, | |
category: { | |
type: String, | |
enum: ["fund", "entry"], | |
default: "fund" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── data // Root directory | |
│ ├── 1-users // `users` collection | |
│ │ └── users.json | |
│ ├── 2-plates // `plates` collection | |
│ │ └── plates.json | |
│ └── 3-orders // `orders` collection | |
│ └── orders.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"_id": { "$oid": "5e601e82b3f2a43b5477b647" }, | |
"name": "Dalthon", | |
"lastname": "Mamani", | |
"username": "D4ITON", | |
"password": "$2a$10$hhn8vSvl6rpv42undbkQ.O5XIdIJkujyqQWqKIxRJgLQYCGlM/6rW", | |
"role": "admin" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"_id": { "$oid": "5e606408dc8aec3040688a86" }, | |
"name": "Lomo saltado", | |
"price": 20.00, | |
"category": "fund" | |
}, | |
{ | |
"_id": { "$oid": "5e60650ea0403411bc4a332f" }, | |
"name": "Arroz con pollo", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"_id": { "$oid": "5e8186aa5d750a38e4260fcc" }, | |
"order_detail": [ | |
{ "$oid": "5e606408dc8aec3040688a86" }, | |
{ "$oid": "5e6066bea0403411bc4a3333" } | |
], | |
"date": { "$date": { "$numberLong": "1583902800000" } }, | |
"table": { "$numberInt": "1" }, | |
"__v": { "$numberInt": "0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Order = require("../models/order"); | |
const Plate = require("../models/plate"); | |
function getOrders(req, res) { | |
Order.find({}, (err, order) => { | |
if (err) { | |
throw err; | |
} else { | |
Plate.populate(order, { path: "order_detail" }, (err, order) => { | |
res.status(200).send(order); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"order-detail": [ | |
{ | |
"category": "fund", | |
"_id": "5e606408dc8aec3040688a86", | |
"name": "Lomo saltado", | |
"price": 20, | |
}, | |
{ |
OlderNewer