Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

vscode
.vscode/launch.json
20 changes: 20 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ module.exports = {
MasterPlanComodityManager: require('./src/managers/garment-master-plan/master-plan-comodity-manager'),
SewingBlockingPlanManager: require('./src/managers/garment-master-plan/sewing-blocking-plan-manager'),
GarmentSectionManager: require('./src/managers/garment-master-plan/garment-section-manager'),
},
spMasterPlan: {
// WeeklyPlanManager: require("./src/managers/garment-master-plan/weekly-plan-manager"),
// WorkingHoursStandardManager: require('./src/managers/garment-master-plan/working-hours-standard-manager'),
// StyleManager: require('./src/managers/garment-master-plan/style-manager'),
StandardCapacityManager: require('./src/managers/sp-master-plan/standard-capacity-manager'),
// BookingOrderManager: require('./src/managers/garment-master-plan/booking-order-manager'),
// MasterPlanComodityManager: require('./src/managers/garment-master-plan/master-plan-comodity-manager'),
// SewingBlockingPlanManager: require('./src/managers/garment-master-plan/sewing-blocking-plan-manager'),
// GarmentSectionManager: require('./src/managers/garment-master-plan/garment-section-manager'),
}
},
test: {
Expand Down Expand Up @@ -246,6 +256,16 @@ module.exports = {
masterPlanComodity: require("./test/data-util/garment-master-plan/master-plan-comodity-data-util"),
sewingBlockingPlan: require("./test/data-util/garment-master-plan/sewing-blocking-plan-data-util"),
garmentSection: require("./test/data-util/garment-master-plan/garment-section-data-util")
},
spMasterPlan: {
// weeklyPlan: require("./test/data-util/garment-master-plan/weekly-plan-data-util"),
// workingHoursStandard: require("./test/data-util/garment-master-plan/working-hours-standard-data-util"),
// style: require("./test/data-util/garment-master-plan/style-data-util"),
standardCapacity: require("./test/data-util/sp-master-plan/standard-capacity-data-util")
// bookingOrder: require("./test/data-util/garment-master-plan/booking-order-data-util"),
// masterPlanComodity: require("./test/data-util/garment-master-plan/master-plan-comodity-data-util"),
// sewingBlockingPlan: require("./test/data-util/garment-master-plan/sewing-blocking-plan-data-util"),
// garmentSection: require("./test/data-util/garment-master-plan/garment-section-data-util")
}
}
},
Expand Down
96 changes: 78 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,68 @@
{
"name": "dl-module",
"version": "1.1.0",
"description": "Dan Liris Modules",
"main": "index.js",
"scripts": {
"test": "mocha test/index.js",
"cover": "istanbul cover _mocha",
"coveralls": "npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls",
"codeclimate": "codeclimate-test-reporter < ./coverage/lcov.info"
"_args": [
[
{
"raw": "dl-module@git+https://github.com/danliris/dl-module.git#dev",
"scope": null,
"escapedName": "dl-module",
"name": "dl-module",
"rawSpec": "git+https://github.com/danliris/dl-module.git#dev",
"spec": "git+https://github.com/danliris/dl-module.git#dev",
"type": "hosted",
"hosted": {
"type": "github",
"ssh": "git@github.com:danliris/dl-module.git#dev",
"sshUrl": "git+ssh://git@github.com/danliris/dl-module.git#dev",
"httpsUrl": "git+https://github.com/danliris/dl-module.git#dev",
"gitUrl": "git://github.com/danliris/dl-module.git#dev",
"shortcut": "github:danliris/dl-module#dev",
"directUrl": "https://raw.githubusercontent.com/danliris/dl-module/dev/package.json"
}
},
"E:\\GITHUB\\MasterPlanGmt\\dl-sp-master-plan-webapi"
]
],
"_from": "git+https://github.com/danliris/dl-module.git#dev",
"_id": "dl-module@1.1.0",
"_inCache": true,
"_location": "/dl-module",
"_phantomChildren": {},
"_requested": {
"raw": "dl-module@git+https://github.com/danliris/dl-module.git#dev",
"scope": null,
"escapedName": "dl-module",
"name": "dl-module",
"rawSpec": "git+https://github.com/danliris/dl-module.git#dev",
"spec": "git+https://github.com/danliris/dl-module.git#dev",
"type": "hosted",
"hosted": {
"type": "github",
"ssh": "git@github.com:danliris/dl-module.git#dev",
"sshUrl": "git+ssh://git@github.com/danliris/dl-module.git#dev",
"httpsUrl": "git+https://github.com/danliris/dl-module.git#dev",
"gitUrl": "git://github.com/danliris/dl-module.git#dev",
"shortcut": "github:danliris/dl-module#dev",
"directUrl": "https://raw.githubusercontent.com/danliris/dl-module/dev/package.json"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/danliris/dl-module.git"
"_requiredBy": [
"/"
],
"_resolved": "git+https://github.com/danliris/dl-module.git#17cdc5019802066513635682259a656bc230f8f6",
"_shasum": "bfe14358c481d6e0a0b7755278d277fe76c62de7",
"_shrinkwrap": null,
"_spec": "dl-module@git+https://github.com/danliris/dl-module.git#dev",
"_where": "E:\\GITHUB\\MasterPlanGmt\\dl-sp-master-plan-webapi",
"author": {
"name": "Moonlay"
},
"author": "Moonlay",
"license": "MIT",
"bugs": {
"url": "https://github.com/danliris/dl-module/issues"
},
"homepage": "https://github.com/danliris/dl-module#readme",
"dependencies": {
"assert": "^1.4.1",
"dl-i18n": "git+https://github.com/danliris/dl-i18n.git",
"dl-models": "https://github.com/danliris/dl-models#dev",
"dl-models": "git+https://github.com/danliris/dl-models.git#dev",
"hashids": "^1.1.0",
"module-toolkit": "git+https://github.com/pinkgorilla/module-toolkit.git",
"moment": "2.17.1",
Expand All @@ -33,15 +73,35 @@
"pdfmake": "^0.1.18",
"sha1": "^1.1.1"
},
"description": "Dan Liris Modules",
"devDependencies": {
"coveralls": "^2.11.15",
"codeclimate-test-reporter": "^0.4.0",
"coveralls": "^2.11.15",
"istanbul": "^0.4.5",
"mocha": "^3.0.0",
"mocha-lcov-reporter": "^1.2.0",
"should": "^10.0.0"
},
"directories": {
"test": "test"
}
},
"gitHead": "17cdc5019802066513635682259a656bc230f8f6",
"homepage": "https://github.com/danliris/dl-module#readme",
"license": "MIT",
"main": "index.js",
"name": "dl-module",
"optionalDependencies": {},
"readme": "\r\n[![Build Status](https://travis-ci.org/danliris/dl-module.svg?branch=uat)](https://travis-ci.org/danliris/dl-module)\r\n[![Code Climate](https://codeclimate.com/github/danliris/dl-module/badges/gpa.svg)](https://codeclimate.com/github/danliris/dl-module)\r\n[![Issue Count](https://codeclimate.com/github/danliris/dl-module/badges/issue_count.svg)](https://codeclimate.com/github/danliris/dl-module) \r\n[![Coverage Status](https://coveralls.io/repos/github/danliris/dl-module/badge.svg?branch=uat)](https://coveralls.io/github/danliris/dl-module?branch=uat)\r\n\r\n# dl-module\r\nDan Liris Modules\r\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/danliris/dl-module.git"
},
"scripts": {
"codeclimate": "codeclimate-test-reporter < ./coverage/lcov.info",
"cover": "istanbul cover _mocha",
"coveralls": "npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls",
"test": "mocha test/index.js"
},
"version": "1.1.0"
}
42 changes: 1 addition & 41 deletions src/managers/master/garment-product-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = class GarmentProductManager extends BaseManager {
this.uomManager = new UomManager(db, user);
this.currencyManager = new CurrencyManager(db, user);
}

_getQuery(paging) {
var _default = {
_deleted: false,
Expand Down Expand Up @@ -138,46 +138,6 @@ module.exports = class GarmentProductManager extends BaseManager {
});
}

getDistinctProductDescription(paging) {
var _paging = Object.assign({
size: 20,
order: {},
filter: {},
select: []
}, paging);

return this._createIndexes()
.then(() => {
var query = this._getQuery(_paging);
return this.collection
.aggregate([
{
"$match": query
},
{
"$group": {
"_id": "$description", // the grouping key
"document": { "$first": "$$ROOT" }
}
},
{ "$limit": 25 }
])
.toArray()
.then((result) => {
result = result.map((data) => data.document);
return result;
})
});
}

getSingleProductByName(query) {
let nameFilter = {
"name": query.name
}
return this.collection.findOne(nameFilter)
.then((result) => result)
}

getProduct() {
return new Promise((resolve, reject) => {
var query = {
Expand Down
Loading