-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
97 additions
and
98 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import { Schema as _Schema, model } from 'mongoose' | ||
var Schema = _Schema | ||
import { Schema, model } from "mongoose"; | ||
import uniqueValidator from "mongoose-unique-validator"; | ||
|
||
var schema = new Schema({ | ||
name: { | ||
type: String, | ||
required: true, | ||
unique: true | ||
unique: true, | ||
}, | ||
color: { | ||
type: String, | ||
required: true | ||
required: true, | ||
}, | ||
disabled: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}) | ||
default: false, | ||
}, | ||
}); | ||
|
||
schema.plugin(uniqueValidator); | ||
|
||
export default model('Category', schema) | ||
export default model("Category", schema); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
import { Schema as _Schema, model } from 'mongoose' | ||
var Schema = _Schema | ||
import { Schema, model } from "mongoose"; | ||
|
||
var schema = new Schema({ | ||
supplierId: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'User', | ||
required: true | ||
ref: "User", | ||
required: true, | ||
}, | ||
productId: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'Product', | ||
required: true | ||
ref: "Product", | ||
required: true, | ||
}, | ||
created_on: { | ||
type: Date, | ||
default: Date.now | ||
default: Date.now, | ||
}, | ||
amount_supplied: { | ||
type: Number, | ||
required: true, | ||
min: 1 | ||
min: 1, | ||
}, | ||
amount_left: { | ||
type: Number, | ||
required: true, | ||
min: 0 | ||
min: 0, | ||
}, | ||
price: { | ||
type: Number, | ||
required: true, | ||
min: 1 | ||
} | ||
}) | ||
min: 1, | ||
}, | ||
}); | ||
|
||
export default model('Delivery', schema) | ||
export default model("Delivery", schema); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,46 @@ | ||
import { Schema as _Schema, model } from 'mongoose' | ||
var Schema = _Schema | ||
import { Schema, model } from "mongoose"; | ||
|
||
var schema = new Schema({ | ||
buyerId: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'User', | ||
required: true | ||
ref: "User", | ||
required: true, | ||
}, | ||
supplierId: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'User', | ||
required: true | ||
ref: "User", | ||
required: true, | ||
}, | ||
ordersId: [ | ||
{ | ||
type: Schema.Types.ObjectId, | ||
ref: 'Order' | ||
} | ||
ref: "Order", | ||
}, | ||
], | ||
totalCost: { | ||
type: Number, | ||
required: true | ||
required: true, | ||
}, | ||
invoiceDate: { | ||
type: Date, | ||
default: Date.now | ||
default: Date.now, | ||
}, | ||
paid: { | ||
type: Boolean, | ||
default: false | ||
default: false, | ||
}, | ||
requestPaid: { | ||
type: Boolean, | ||
default: false | ||
default: false, | ||
}, | ||
autoReminderCount: { | ||
type: Number, | ||
default: 0 | ||
default: 0, | ||
}, | ||
manualReminderCount: { | ||
type: Number, | ||
default: 0 | ||
} | ||
}) | ||
default: 0, | ||
}, | ||
}); | ||
|
||
export default model('Invoice', schema) | ||
export default model("Invoice", schema); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
import { Schema as _Schema, model } from 'mongoose' | ||
var Schema = _Schema | ||
import { Schema, model } from "mongoose"; | ||
|
||
var schema = new Schema({ | ||
name: { | ||
type: String, | ||
required: true | ||
required: true, | ||
}, | ||
type: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'TemplateType', | ||
required: true | ||
ref: "TemplateType", | ||
required: true, | ||
}, | ||
message: { | ||
type: String, | ||
required: true | ||
} | ||
}) | ||
required: true, | ||
}, | ||
}); | ||
|
||
export default model('MailTemplate', schema) | ||
export default model("MailTemplate", schema); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,33 @@ | ||
import { Schema as _Schema, model } from 'mongoose' | ||
var Schema = _Schema | ||
import { Schema, model } from "mongoose"; | ||
|
||
var schema = new Schema({ | ||
buyerId: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'User', | ||
required: true | ||
ref: "User", | ||
required: true, | ||
}, | ||
deliveryId: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'Stock', | ||
required: true | ||
ref: "Stock", | ||
required: true, | ||
}, | ||
order_date: { | ||
type: Date, | ||
default: Date.now | ||
default: Date.now, | ||
}, | ||
invoice: { | ||
type: Boolean, | ||
default: false | ||
default: false, | ||
}, | ||
invoiceId: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'Invoice', | ||
required: false | ||
ref: "Invoice", | ||
required: false, | ||
}, | ||
keypadOrder: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}) | ||
default: false, | ||
}, | ||
}); | ||
|
||
export default model('Order', schema) | ||
export default model("Order", schema); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,39 @@ | ||
import { Schema as _Schema, model } from 'mongoose' | ||
var Schema = _Schema | ||
import uniqueValidator from 'mongoose-unique-validator' | ||
import { Schema, model } from "mongoose"; | ||
import uniqueValidator from "mongoose-unique-validator"; | ||
|
||
var schema = new Schema({ | ||
keypadId: { | ||
type: Number, | ||
required: true, | ||
unique: true, | ||
min: 0 | ||
min: 0, | ||
}, | ||
displayName: { | ||
type: String, | ||
required: true | ||
required: true, | ||
}, | ||
description: { | ||
type: String, | ||
required: true | ||
required: true, | ||
}, | ||
imagePath: { | ||
type: String, | ||
required: true | ||
required: true, | ||
}, | ||
category: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'Category', | ||
required: false | ||
} | ||
}) | ||
ref: "Category", | ||
required: false, | ||
}, | ||
code: { | ||
type: String, | ||
required: false, | ||
index: true, | ||
unique: true, | ||
sparse: true, | ||
}, | ||
}); | ||
|
||
schema.plugin(uniqueValidator) | ||
schema.plugin(uniqueValidator); | ||
|
||
export default model('Product', schema) | ||
export default model("Product", schema); |
This file was deleted.
Oops, something went wrong.
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
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
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
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