Operational Endpoints for Admin, Products, Assignments, Location, Vendor, Venue completed. Geofence Testing PEnding
This commit is contained in:
Vendored
BIN
Binary file not shown.
@@ -36,6 +36,14 @@ const schema = new Schema({
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
city: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
state: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
export default model("access", schema);
|
||||
|
||||
@@ -25,6 +25,10 @@ const schema = new Schema({
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
hsn: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
stock: {
|
||||
type: Number,
|
||||
required: true,
|
||||
|
||||
@@ -17,7 +17,16 @@ export const getProductByQuery = async (query) => {
|
||||
|
||||
// Read (Get all)
|
||||
export const getAllProducts = async () => {
|
||||
return await Model.find();
|
||||
return await Model.aggregate([
|
||||
{
|
||||
$lookup: {
|
||||
from: "vendors",
|
||||
localField: "vendors",
|
||||
foreignField: "_id",
|
||||
as: "vendors"
|
||||
}
|
||||
}
|
||||
]);
|
||||
};
|
||||
|
||||
// Update
|
||||
|
||||
@@ -18,6 +18,8 @@ const moduleSchema = new Schema({
|
||||
"salary",
|
||||
"vendor",
|
||||
"expense",
|
||||
"venue",
|
||||
"metadata",
|
||||
"product",
|
||||
"invoice",
|
||||
"partner",
|
||||
@@ -28,6 +30,12 @@ const moduleSchema = new Schema({
|
||||
"inventoryLog",
|
||||
],
|
||||
},
|
||||
region: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: "CITY",
|
||||
enum: ["CITY", "STATE", "COUNTRY"],
|
||||
},
|
||||
permission: {
|
||||
type: String,
|
||||
required: true,
|
||||
|
||||
@@ -30,6 +30,10 @@ const schema = new Schema({
|
||||
required: true,
|
||||
ref: "user",
|
||||
},
|
||||
isActive: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
export default model("user", schema);
|
||||
|
||||
Vendored
+7
-2
@@ -10,10 +10,15 @@ export const getVendorById = async (id) => {
|
||||
return await Model.findById(id);
|
||||
};
|
||||
|
||||
// Read (Get by Query)
|
||||
// Read (Get One by Query)
|
||||
export const getVendorByQuery = async (query) => {
|
||||
return await Model.findOne(query);
|
||||
}
|
||||
};
|
||||
|
||||
// Read (Get All by Query)
|
||||
export const getVendorsByQuery = async (query) => {
|
||||
return await Model.find(query);
|
||||
};
|
||||
|
||||
// Read (Get all)
|
||||
export const getAllVendors = async () => {
|
||||
|
||||
Reference in New Issue
Block a user