Merge branch 'develop'

This commit is contained in:
mamoss 2025-12-07 22:10:57 +07:00
commit a4d87d7051
19 changed files with 99675 additions and 171 deletions

593
package-lock.json generated
View file

@ -18,8 +18,10 @@
"cors": "^2.8.5",
"csv-parser": "^3.0.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express": "^4.21.2",
"fast-jwt": "^3.3.2",
"fast-levenshtein": "^3.0.0",
"fuse.js": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"moment": "^2.30.1",
"mysql2": "^3.9.1",
@ -308,6 +310,141 @@
"@nestjs/core": "^10.0.0"
}
},
"node_modules/@nestjs/platform-express/node_modules/cookie": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
"integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/@nestjs/platform-express/node_modules/encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/@nestjs/platform-express/node_modules/express": {
"version": "4.19.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
"integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==",
"license": "MIT",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
"body-parser": "1.20.2",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.6.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "1.2.0",
"fresh": "0.5.2",
"http-errors": "2.0.0",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.7",
"qs": "6.11.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "0.18.0",
"serve-static": "1.15.0",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.10.0"
}
},
"node_modules/@nestjs/platform-express/node_modules/finalhandler": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
"integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
"statuses": "2.0.1",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/@nestjs/platform-express/node_modules/merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==",
"license": "MIT"
},
"node_modules/@nestjs/platform-express/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/@nestjs/platform-express/node_modules/path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==",
"license": "MIT"
},
"node_modules/@nestjs/platform-express/node_modules/send": {
"version": "0.18.0",
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
"integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "2.0.0",
"mime": "1.6.0",
"ms": "2.1.3",
"on-finished": "2.4.1",
"range-parser": "~1.2.1",
"statuses": "2.0.1"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/@nestjs/platform-express/node_modules/serve-static": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
"integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
"license": "MIT",
"dependencies": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.18.0"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/@nuxtjs/opencollective": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/@nuxtjs/opencollective/-/opencollective-0.3.2.tgz",
@ -1024,6 +1161,35 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/call-bound": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"get-intrinsic": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/camelcase": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
@ -1391,9 +1557,10 @@
}
},
"node_modules/cookie": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
"integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz",
"integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
@ -1412,6 +1579,7 @@
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"license": "MIT",
"dependencies": {
"object-assign": "^4",
"vary": "^1"
@ -1563,6 +1731,20 @@
"url": "https://github.com/motdotla/dotenv?sponsor=1"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/eastasianwidth": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
@ -1634,9 +1816,10 @@
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="
},
"node_modules/encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
@ -1801,6 +1984,24 @@
"resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz",
"integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA=="
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-get-iterator": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz",
@ -1820,6 +2021,18 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-set-tostringtag": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz",
@ -1860,7 +2073,8 @@
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
"node_modules/escape-string-regexp": {
"version": "1.0.5",
@ -1874,41 +2088,43 @@
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
"version": "4.19.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
"integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==",
"version": "4.21.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz",
"integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==",
"license": "MIT",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
"body-parser": "1.20.2",
"body-parser": "1.20.3",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.6.0",
"cookie": "0.7.1",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
"encodeurl": "~1.0.2",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "1.2.0",
"finalhandler": "1.3.1",
"fresh": "0.5.2",
"http-errors": "2.0.0",
"merge-descriptors": "1.0.1",
"merge-descriptors": "1.0.3",
"methods": "~1.1.2",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"path-to-regexp": "0.1.12",
"proxy-addr": "~2.0.7",
"qs": "6.11.0",
"qs": "6.13.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "0.18.0",
"serve-static": "1.15.0",
"send": "0.19.0",
"serve-static": "1.16.2",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"type-is": "~1.6.18",
@ -1917,6 +2133,49 @@
},
"engines": {
"node": ">= 0.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/express/node_modules/body-parser": {
"version": "1.20.3",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz",
"integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==",
"license": "MIT",
"dependencies": {
"bytes": "3.1.2",
"content-type": "~1.0.5",
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
"qs": "6.13.0",
"raw-body": "2.5.2",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/express/node_modules/qs": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
"license": "BSD-3-Clause",
"dependencies": {
"side-channel": "^1.0.6"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/external-editor": {
@ -1946,12 +2205,30 @@
"node": ">=16 <22"
}
},
"node_modules/fast-levenshtein": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-3.0.0.tgz",
"integrity": "sha512-hKKNajm46uNmTlhHSyZkmToAc56uZJwYq7yrciZjqOxnlfQwERDQJmHPUp7m1m9wx8vgOe8IaCKZ5Kv2k1DdCQ==",
"license": "MIT",
"dependencies": {
"fastest-levenshtein": "^1.0.7"
}
},
"node_modules/fast-safe-stringify": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
"integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==",
"peer": true
},
"node_modules/fastest-levenshtein": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz",
"integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==",
"license": "MIT",
"engines": {
"node": ">= 4.9.1"
}
},
"node_modules/figures": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
@ -1976,12 +2253,13 @@
}
},
"node_modules/finalhandler": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
"integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz",
"integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
@ -2059,6 +2337,7 @@
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
@ -2128,6 +2407,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/fuse.js": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-7.1.0.tgz",
"integrity": "sha512-trLf4SzuuUxfusZADLINj+dE8clK1frKdmqiJNb1Es75fmI5oY6X2mxLVUciLLjxqw/xr72Dhy+lER6dGd02FQ==",
"license": "Apache-2.0",
"engines": {
"node": ">=10"
}
},
"node_modules/generate-function": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
@ -2145,19 +2433,42 @@
}
},
"node_modules/get-intrinsic": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz",
"integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"has-proto": "^1.0.1",
"has-symbols": "^1.0.3",
"hasown": "^2.0.0"
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/get-symbol-description": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz",
@ -2243,11 +2554,12 @@
}
},
"node_modules/gopd": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
"dependencies": {
"get-intrinsic": "^1.1.3"
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
@ -2317,9 +2629,10 @@
}
},
"node_modules/has-symbols": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
@ -2342,9 +2655,10 @@
}
},
"node_modules/hasown": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
"integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
@ -3133,6 +3447,15 @@
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@ -3156,9 +3479,13 @@
}
},
"node_modules/merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/methods": {
"version": "1.1.2",
@ -3172,6 +3499,7 @@
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"license": "MIT",
"bin": {
"mime": "cli.js"
},
@ -3541,9 +3869,13 @@
}
},
"node_modules/object-inspect": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@ -3660,6 +3992,7 @@
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
@ -3704,9 +4037,10 @@
}
},
"node_modules/path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
"license": "MIT"
},
"node_modules/picomatch": {
"version": "2.3.1",
@ -3820,6 +4154,7 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
@ -4104,9 +4439,10 @@
}
},
"node_modules/send": {
"version": "0.18.0",
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
"integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
"integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
@ -4126,10 +4462,20 @@
"node": ">= 0.8.0"
}
},
"node_modules/send/node_modules/encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/send/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/seq-queue": {
"version": "0.0.5",
@ -4137,14 +4483,15 @@
"integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q=="
},
"node_modules/serve-static": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
"integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
"version": "1.16.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
"integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
"license": "MIT",
"dependencies": {
"encodeurl": "~1.0.2",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.18.0"
"send": "0.19.0"
},
"engines": {
"node": ">= 0.8.0"
@ -4215,13 +4562,72 @@
}
},
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
"license": "MIT",
"dependencies": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3",
"side-channel-list": "^1.0.0",
"side-channel-map": "^1.0.1",
"side-channel-weakmap": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-list": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-map": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-weakmap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3",
"side-channel-map": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
@ -5072,6 +5478,42 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/typeorm-cli/node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/typeorm-cli/node_modules/long": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==",
"license": "Apache-2.0",
"optional": true,
"peer": true
},
"node_modules/typeorm-cli/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"license": "ISC",
"optional": true,
"peer": true,
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/typeorm-cli/node_modules/mkdirp": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
@ -5088,6 +5530,27 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/typeorm-cli/node_modules/mysql2": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-2.3.3.tgz",
"integrity": "sha512-wxJUev6LgMSgACDkb/InIFxDprRa6T95+VEoR+xPvtngtccNH2dGjEB/fVZ8yg1gWv1510c9CvXuJHi5zUm0ZA==",
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"denque": "^2.0.1",
"generate-function": "^2.3.1",
"iconv-lite": "^0.6.3",
"long": "^4.0.0",
"lru-cache": "^6.0.0",
"named-placeholders": "^1.1.2",
"seq-queue": "^0.0.5",
"sqlstring": "^2.3.2"
},
"engines": {
"node": ">= 8.0"
}
},
"node_modules/typeorm-cli/node_modules/reflect-metadata": {
"version": "0.1.14",
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.14.tgz",

View file

@ -38,8 +38,10 @@
"cors": "^2.8.5",
"csv-parser": "^3.0.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express": "^4.21.2",
"fast-jwt": "^3.3.2",
"fast-levenshtein": "^3.0.0",
"fuse.js": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"moment": "^2.30.1",
"mysql2": "^3.9.1",

View file

@ -1154,7 +1154,7 @@ export class EmployeePositionController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `posMaster.orgChild1Id IN (:...child1)`
: `posMaster.orgChild1Id is null`
: `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
child1: _data.child1,
@ -1381,24 +1381,22 @@ export class EmployeePositionController extends Controller {
};
}),
);
if(_data.privilege === 'NORMAL'|| _data.privilege === 'PARENT'|| _data.privilege === 'CHILD'){ //PARENT จะไม่มีทางเห็น ROOT , CHILD ยึดจาก CHILD ที่อยู่ลงไปข้างล่างและจะไม่เห็น CHILD ที่อยู่เหนือกว่า
const nextChildMap:any = { //เอาไวเช็ค CHILD ถัดไป
if (_data.privilege === "NORMAL" || _data.privilege === "CHILD") {
//PARENT จะไม่มีทางเห็น ROOT , CHILD ยึดจาก CHILD ที่อยู่ลงไปข้างล่างและจะไม่เห็น CHILD ที่อยู่เหนือกว่า
const nextChildMap: any = {
//เอาไวเช็ค CHILD ถัดไป
0: _data.child1,
1: _data.child2,
2: _data.child3,
3: _data.child4,
};
const childValue = nextChildMap[body.type];
if(_data.privilege === 'NORMAL'){
if (Array.isArray(childValue) && childValue.some(item => item != null)) {
if (_data.privilege === "NORMAL") {
if (Array.isArray(childValue) && childValue.some((item) => item != null)) {
return new HttpSuccess({ data: [], total: 0 });
}
}else if(_data.privilege === 'PARENT'){
if (body.type == 0){
return new HttpSuccess({ data: [], total: 0 });
}
} else if (_data.privilege === 'CHILD') {
} else if (_data.privilege === "CHILD") {
const higherChildChecks = [
{ type: [0], child: _data.child1, next: _data.child2 },
{ type: [0, 1], child: _data.child2, next: _data.child3 },

View file

@ -902,7 +902,7 @@ export class EmployeeTempPositionController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `posMaster.orgChild1Id IN (:...child1)`
: `posMaster.orgChild1Id is null`
: `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
child1: _data.child1,
@ -1129,23 +1129,21 @@ export class EmployeeTempPositionController extends Controller {
};
}),
);
if(_data.privilege === 'NORMAL'|| _data.privilege === 'PARENT'|| _data.privilege === 'CHILD'){ //PARENT จะไม่มีทางเห็น ROOT , CHILD ยึดจาก CHILD ที่อยู่ลงไปข้างล่างและจะไม่เห็น CHILD ที่อยู่เหนือกว่า
const nextChildMap:any = { //เอาไวเช็ค CHILD ถัดไป
if (_data.privilege === "NORMAL" || _data.privilege === "CHILD") {
//PARENT จะไม่มีทางเห็น ROOT , CHILD ยึดจาก CHILD ที่อยู่ลงไปข้างล่างและจะไม่เห็น CHILD ที่อยู่เหนือกว่า
const nextChildMap: any = {
//เอาไวเช็ค CHILD ถัดไป
0: _data.child1,
1: _data.child2,
2: _data.child3,
3: _data.child4,
};
const childValue = nextChildMap[body.type];
if(_data.privilege === 'NORMAL'){
if (Array.isArray(childValue) && childValue.some(item => item != null)) {
if (_data.privilege === "NORMAL") {
if (Array.isArray(childValue) && childValue.some((item) => item != null)) {
return new HttpSuccess({ data: [], total: 0 });
}
}else if(_data.privilege === 'PARENT'){
if (body.type == 0){
return new HttpSuccess({ data: [], total: 0 });
}
} else if (_data.privilege === 'CHILD') {
} else if (_data.privilege === "CHILD") {
const higherChildChecks = [
{ type: [0], child: _data.child1, next: _data.child2 },
{ type: [0, 1], child: _data.child2, next: _data.child3 },

View file

@ -102,6 +102,9 @@ import { HR_PERSONAL_EMPTEMP_ADDRESS } from "../entities/mis/HR_PERSONAL_EMPTEMP
import { HR_PERSONAL_EMPTEMP_FAMILY } from "../entities/mis/HR_PERSONAL_EMPTEMP_FAMILY";
import { HR_POSITION_EMPLOYEETEMP } from "../entities/mis/HR_POSITION_EMPLOYEETEMP";
import { positionOfficer } from "../entities/mis/positionOfficer";
import { ProvinceMaster } from "../entities/ProvinceMaster";
import { SubDistrictMaster } from "../entities/SubDistrictMaster";
import { DistrictMaster } from "../entities/DistrictMaster";
@Route("api/v1/org/upload")
@Tags("UPLOAD")
@Security("bearerAuth")
@ -6362,4 +6365,448 @@ export class ImportDataController extends Controller {
}
return new HttpSuccess();
}
// /**
// * @summary Update importUpdate for provinces matching JSON
// */
// @Post("updateProvinceImportOld")
// async updateProvinceImportOld() {
// const fs = require("fs");
// const path = require("path");
// const filePath = path.join(__dirname, "../data/provinces.json");
// const provinceJson = JSON.parse(fs.readFileSync(filePath, "utf8"));
// let num = 0;
// const Fuse = require("fuse.js");
// const fuse = new Fuse(
// provinceJson.map((x: any) => x.name_th),
// {
// includeScore: true,
// threshold: 0.2, // ยิ่งต่ำยิ่งเข้มงวด
// },
// );
// const provinces = await this.provinceIdRepo.find({ where: { importUpdate: IsNull() } });
// for (const prov of provinces) {
// console.log("11");
// const result = fuse.search(prov.name);
// const repoProvince = AppDataSource.getRepository(ProvinceMaster);
// console.log("1221");
// if (result.length > 0) {
// let foundItem = result[0];
// if (result.length > 1) {
// foundItem = result.filter((x: any) => x.score == 0)[0];
// if (foundItem == null) {
// continue;
// }
// }
// const province = await repoProvince.findOne({
// where: { name_th: foundItem.item },
// });
// if (province == null) {
// console.log(foundItem.item);
// num += 1;
// continue;
// }
// console.log("1441");
// prov.importUpdate = 1;
// prov.refId = province.id;
// prov.name = province.name_th;
// await this.provinceIdRepo.save(prov);
// } else {
// console.log("qqqqq");
// console.log(prov.name);
// console.log(result);
// num += 1;
// }
// }
// console.log("not found province count:", num);
// return new HttpSuccess();
// }
// /**
// * @summary Update importUpdate for districts matching JSON
// */
// @Post("updateDistrictImportOld")
// async updateDistrictImportOld() {
// const fs = require("fs");
// const path = require("path");
// const filePath = path.join(__dirname, "../data/tambons.json");
// const districtJson = JSON.parse(fs.readFileSync(filePath, "utf8"));
// let num = 0;
// const Fuse = require("fuse.js");
// const districts = await this.districtIdRepo.find({
// relations: ["province"],
// where: { province: { refId: Not(IsNull()) }, importUpdate: IsNull() },
// });
// for (const prov of districts) {
// const fuse = new Fuse(
// districtJson
// .filter((x: any) => x.province_id === prov.province?.refId)
// .map((x: any) => x.name_th),
// {
// includeScore: true,
// threshold: 0.2, // ยิ่งต่ำยิ่งเข้มงวด
// },
// );
// const result = fuse.search(prov.name);
// const repoDistrict = AppDataSource.getRepository(DistrictMaster);
// if (result.length > 0) {
// let foundItem = result[0];
// if (result.length > 1) {
// foundItem = result.filter((x: any) => x.score == 0)[0];
// if (foundItem == null) {
// continue;
// }
// }
// const district = await repoDistrict.findOne({
// where: { name_th: foundItem.item, province_id: prov.province?.refId },
// });
// if (district == null) {
// num += 1;
// continue;
// }
// prov.importUpdate = 1;
// prov.refId = district.id;
// prov.name = district.name_th;
// await this.districtIdRepo.save(prov);
// } else {
// num += 1;
// }
// }
// console.log("not found district count:", num);
// return new HttpSuccess();
// }
// /**
// * @summary Update importUpdate for subdistricts matching JSON
// */
// @Post("updateSubDistrictImportOld")
// async updateSubDistrictImportOld() {
// const fs = require("fs");
// const path = require("path");
// const filePath = path.join(__dirname, "../data/amphures.json");
// const subDistrictJson = JSON.parse(fs.readFileSync(filePath, "utf8"));
// let num = 0;
// const Fuse = require("fuse.js");
// const subDistricts = await this.subDistrictIdRepo.find({
// relations: ["district"],
// where: { district: { refId: Not(IsNull()) }, importUpdate: IsNull() },
// });
// for (const prov of subDistricts) {
// const fuse = new Fuse(
// subDistrictJson
// .filter((x: any) => x.district_id === prov.district?.refId)
// .map((x: any) => x.name_th),
// {
// includeScore: true,
// threshold: 0.2, // ยิ่งต่ำยิ่งเข้มงวด
// },
// );
// const result = fuse.search(prov.name);
// const repoSubDistrict = AppDataSource.getRepository(SubDistrictMaster);
// if (result.length > 0) {
// let foundItem = result[0];
// if (result.length > 1) {
// foundItem = result.filter((x: any) => x.score == 0)[0];
// if (foundItem == null) {
// continue;
// }
// }
// const subdistrict = await repoSubDistrict.findOne({
// where: { name_th: foundItem.item, district_id: prov.district?.refId },
// });
// if (subdistrict == null) {
// num += 1;
// continue;
// }
// prov.importUpdate = 1;
// prov.refId = subdistrict.id;
// prov.name = subdistrict.name_th;
// prov.zipCode = subdistrict.zip_code.toString();
// await this.subDistrictIdRepo.save(prov);
// } else {
// num += 1;
// }
// }
// console.log("not found subdistrict count:", num);
// return new HttpSuccess();
// }
// /**
// * @summary Update importUpdate for provinces matching JSON
// */
// @Post("updateProvinceImportFlag")
// async updateProvinceImportFlag() {
// const fs = require("fs");
// const path = require("path");
// const filePath = path.join(__dirname, "../data/provinces.json");
// const provinceJson = JSON.parse(fs.readFileSync(filePath, "utf8"));
// let num = 0;
// for (const province of provinceJson) {
// const dbProvince = await this.provinceIdRepo.findOne({
// where: {
// name: province.name_th,
// importUpdate: IsNull(),
// },
// });
// if (dbProvince) {
// dbProvince.importUpdate = 1;
// dbProvince.refId = province.id;
// await this.provinceIdRepo.save(dbProvince);
// } else {
// num += 1;
// }
// }
// console.log("not found province count:", num);
// return new HttpSuccess();
// }
// /**
// * @summary Update importUpdate for districts matching JSON
// */
// @Post("updateDistrictImportFlag")
// async updateDistrictImportFlag() {
// const meta = {
// createdUserId: "",
// createdFullName: "system",
// lastUpdateUserId: "",
// lastUpdateFullName: "system",
// createdAt: new Date(),
// lastUpdatedAt: new Date(),
// };
// const fs = require("fs");
// const path = require("path");
// const filePath = path.join(__dirname, "../data/tambons.json");
// const tambonJson = JSON.parse(fs.readFileSync(filePath, "utf8"));
// let num = 0;
// for (const tambon of tambonJson) {
// const dbDistrict = await this.districtIdRepo.findOne({
// where: {
// name: tambon.name_th,
// province: { refId: Not(tambon.province_id) },
// importUpdate: IsNull(),
// },
// });
// if (dbDistrict) {
// const dbProvince = await this.provinceIdRepo.findOne({
// where: {
// refId: tambon.province_id,
// importUpdate: Not(IsNull()),
// },
// });
// if (dbProvince) {
// const checkOld = await this.districtIdRepo.findOne({
// where: {
// name: tambon.name_th,
// provinceId: dbProvince.id,
// },
// });
// if (!checkOld) {
// let districtId = new District();
// Object.assign(districtId, {
// ...meta,
// name: tambon.name_th,
// provinceId: dbProvince.id,
// importUpdate: 2,
// refId: tambon.id,
// });
// await this.districtIdRepo.save(districtId);
// num += 1;
// }
// }
// }
// }
// console.log("not found province count:", num);
// return new HttpSuccess();
// }
// /**
// * @summary Update importUpdate for subdistricts matching JSON
// */
// @Post("updateSubDistrictImportFlag")
// async updateSubDistrictImportFlag() {
// const meta = {
// createdUserId: "",
// createdFullName: "system",
// lastUpdateUserId: "",
// lastUpdateFullName: "system",
// createdAt: new Date(),
// lastUpdatedAt: new Date(),
// };
// const fs = require("fs");
// const path = require("path");
// const filePath = path.join(__dirname, "../data/amphures.json");
// const amphureJson = JSON.parse(fs.readFileSync(filePath, "utf8"));
// let num = 0;
// for (const amphure of amphureJson) {
// const dbSubDistrict = await this.subDistrictIdRepo.findOne({
// where: {
// name: amphure.name_th,
// district: { refId: Not(amphure.district_id) },
// importUpdate: IsNull(),
// },
// });
// if (dbSubDistrict) {
// const dbDistrict = await this.districtIdRepo.findOne({
// where: {
// refId: amphure.district_id,
// importUpdate: Not(IsNull()),
// },
// });
// if (dbDistrict) {
// const checkOld = await this.subDistrictIdRepo.findOne({
// where: {
// name: amphure.name_th,
// districtId: dbDistrict.id,
// },
// });
// if (!checkOld) {
// let districtId = new District();
// Object.assign(districtId, {
// ...meta,
// name: amphure.name_th,
// districtId: dbDistrict.id,
// zipCode: amphure.zip_code,
// importUpdate: 2,
// refId: amphure.id,
// });
// await this.subDistrictIdRepo.save(districtId);
// num += 1;
// }
// }
// }
// }
// console.log("not found province count:", num);
// return new HttpSuccess();
// }
// /**
// * @summary ตรวจสอบ district ใน profile ว่าตรงกับ tambons.json หรือไม่
// */
// @Post("checkProfileDistrictMismatch")
// async checkProfileDistrictMismatch() {
// const mismatches = [];
// const profiles = await this.profileRepo.find({
// relations: ["registrationProvince", "registrationDistrict", "registrationSubDistrict"],
// where: {
// registrationProvince: Not(IsNull()),
// },
// });
// for (const profile of profiles) {
// console.log("profile count:", profiles.indexOf(profile) + 1);
// console.log("mismatches count:", mismatches.length);
// // if (mismatches.length >= 10) {
// // break;
// // }
// const repoProvince = AppDataSource.getRepository(ProvinceMaster);
// const repoDistrict = AppDataSource.getRepository(DistrictMaster);
// const repoSubDistrict = AppDataSource.getRepository(SubDistrictMaster);
// const registrationProvince = profile.registrationProvince?.name;
// const registrationDistrict = profile.registrationDistrict?.name;
// const registrationSubDistrict = profile.registrationSubDistrict?.name;
// const province = await repoProvince.findOne({
// where: { name_th: registrationProvince },
// });
// if (province == null) {
// mismatches.push({ profileId: profile.id });
// continue;
// }
// const district = await repoDistrict.findOne({
// where: { name_th: registrationDistrict, province_id: province.id },
// });
// if (district == null) {
// mismatches.push({ profileId: profile.id });
// continue;
// }
// const subdistrict = await repoSubDistrict.findOne({
// where: { name_th: registrationSubDistrict, district_id: district.id },
// });
// if (subdistrict == null) {
// mismatches.push({ profileId: profile.id });
// continue;
// }
// }
// return mismatches.map((x) => x.profileId);
// }
// /**
// * @summary Import provinces.json into ProvinceMaster table
// */
// @Post("importProvinceMaster")
// async importProvinceMaster() {
// const fs = require("fs");
// const path = require("path");
// const filePath = path.join(__dirname, "../data/provinces.json");
// const provinceJson = JSON.parse(fs.readFileSync(filePath, "utf8"));
// const repo = AppDataSource.getRepository(ProvinceMaster);
// let imported = [];
// for (const prov of provinceJson) {
// const newProv = repo.create({
// id: prov.id,
// name_th: prov.name_th,
// name_en: prov.name_en,
// geography_id: prov.geography_id,
// created_at: prov.created_at,
// updated_at: prov.updated_at,
// });
// await repo.save(newProv);
// imported.push(newProv);
// }
// return imported;
// }
// /**
// * @summary Import tambons.json into DistrictMaster table
// */
// @Post("importDistrictMaster")
// async importDistrictMaster() {
// const fs = require("fs");
// const path = require("path");
// const filePath = path.join(__dirname, "../data/tambons.json");
// const tambonJson = JSON.parse(fs.readFileSync(filePath, "utf8"));
// const repo = AppDataSource.getRepository(DistrictMaster);
// let imported = [];
// for (const tambon of tambonJson) {
// const newSub = repo.create({
// id: tambon.id,
// name_th: tambon.name_th,
// name_en: tambon.name_en,
// province_id: tambon.province_id,
// created_at: tambon.created_at,
// updated_at: tambon.updated_at,
// });
// await repo.save(newSub);
// imported.push(newSub);
// }
// return imported;
// }
// /**
// * @summary Import amphures.json into SubDistrictMaster table
// */
// @Post("importSubDistrictMaster")
// async importSubDistrictMaster() {
// const fs = require("fs");
// const path = require("path");
// const filePath = path.join(__dirname, "../data/amphures.json");
// const amphureJson = JSON.parse(fs.readFileSync(filePath, "utf8"));
// const repo = AppDataSource.getRepository(SubDistrictMaster);
// // Prepare all entities first
// const entities = amphureJson.map((amphure: any) =>
// repo.create({
// id: amphure.id,
// zip_code: amphure.zip_code,
// name_th: amphure.name_th,
// name_en: amphure.name_en,
// district_id: amphure.district_id,
// lat: amphure.lat,
// long: amphure.long,
// created_at: amphure.created_at,
// updated_at: amphure.updated_at,
// }),
// );
// // Bulk insert for performance
// await repo.save(entities);
// return entities;
// }
}

View file

@ -6128,7 +6128,7 @@ export class OrganizationController extends Controller {
if (!orgRevision) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
let _data:any = {
let _data: any = {
root: null,
child1: null,
child2: null,
@ -6141,7 +6141,7 @@ export class OrganizationController extends Controller {
) {
_data = await new permission().PermissionOrgList(request, system.trim().toUpperCase());
}
const profile = await this.profileRepo.findOne({
where: { keycloak: request.user.sub },
relations: ["permissionProfiles", "current_holders"],
@ -6150,32 +6150,32 @@ export class OrganizationController extends Controller {
if (!profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งานในทะเบียนประวัติ");
}
let _privilege = await new permission().PermissionOrgList(request, system);
const attrOwnership = _privilege.root === null ? true : false;
if (orgRevision.orgRevisionIsDraft && !orgRevision.orgRevisionIsCurrent && !attrOwnership) {
if(Array.isArray(profile.permissionProfiles) && profile.permissionProfiles.length > 0){
if (Array.isArray(profile.permissionProfiles) && profile.permissionProfiles.length > 0) {
_data.root = profile.permissionProfiles.map((x) => x.orgRootId);
}else{
} else {
return new HttpSuccess({ remark: "", data: [] });
}
}
}
// กำหนดการเข้าถึงข้อมูลตามสถานะและสิทธิ์
const isCurrentActive = !orgRevision.orgRevisionIsDraft && orgRevision.orgRevisionIsCurrent;
if (isCurrentActive) {
if(_privilege.privilege !== "OWNER"){
if(_privilege.privilege == "NORMAL"){
const holder = profile.current_holders.find(x => x.orgRevisionId === id);
if (_privilege.privilege !== "OWNER") {
if (_privilege.privilege == "NORMAL") {
const holder = profile.current_holders.find((x) => x.orgRevisionId === id);
if (!holder) return;
_data.root = [holder.orgRootId];
_data.child1 = [holder.orgChild1Id];
_data.child2 = [holder.orgChild2Id];
_data.child3 = [holder.orgChild3Id];
_data.child4 = [holder.orgChild4Id];
}else if(_privilege.privilege == "CHILD"){
const holder = profile.current_holders.find(x => x.orgRevisionId === id);
} else if (_privilege.privilege == "CHILD") {
const holder = profile.current_holders.find((x) => x.orgRevisionId === id);
if (!holder) return;
_data.root = [holder.orgRootId];
if (_privilege.root && _privilege.child1 === null) {
@ -6190,7 +6190,7 @@ export class OrganizationController extends Controller {
_data.child3 = [holder.orgChild3Id];
_data.child4 = [holder.orgChild4Id];
}
}else{
} else {
_data.root = [profile.current_holders.find((x) => x.orgRevisionId === id)?.orgRootId];
}
} else {
@ -6242,7 +6242,7 @@ export class OrganizationController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `orgChild1.id IN (:...node)`
: `orgChild1.id is null`
: `orgChild1.id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
node: _data.child1,

View file

@ -735,7 +735,7 @@ export class PermissionController extends Controller {
} else if (privilege == "PARENT") {
data = {
root: [x.orgRootId],
child1: null,
child1: [null],
child2: null,
child3: null,
child4: null,

View file

@ -963,40 +963,40 @@ export class PositionController extends Controller {
}
let orgRoot: any = null;
let SName: any = null;
let revisionId:any = null;
let revisionId: any = null;
if (requestBody.orgRootId != null)
orgRoot = await this.orgRootRepository.findOne({
where: { id: requestBody.orgRootId },
});
revisionId = orgRoot?.orgRevisionId;
revisionId = orgRoot?.orgRevisionId;
if (!orgRoot) {
let orgChild1: any = null;
if (requestBody.orgChild1Id != null)
orgChild1 = await this.child1Repository.findOne({
where: { id: requestBody.orgChild1Id },
});
revisionId = orgChild1?.orgRevisionId;
revisionId = orgChild1?.orgRevisionId;
if (!orgChild1) {
let orgChild2: any = null;
if (requestBody.orgChild2Id != null)
orgChild2 = await this.child2Repository.findOne({
where: { id: requestBody.orgChild2Id },
});
revisionId = orgChild2?.orgRevisionId;
revisionId = orgChild2?.orgRevisionId;
if (!orgChild2) {
let orgChild3: any = null;
if (requestBody.orgChild3Id != null)
orgChild3 = await this.child3Repository.findOne({
where: { id: requestBody.orgChild3Id },
});
revisionId = orgChild3?.orgRevisionId;
revisionId = orgChild3?.orgRevisionId;
if (!orgChild3) {
let orgChild4: any = null;
if (requestBody.orgChild4Id != null)
orgChild4 = await this.child4Repository.findOne({
where: { id: requestBody.orgChild4Id },
});
revisionId = orgChild4?.orgRevisionId;
revisionId = orgChild4?.orgRevisionId;
if (!orgChild4) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
} else {
@ -1169,9 +1169,9 @@ export class PositionController extends Controller {
);
}
const before = null;
let chkRevision:any = null;
if(revisionId){
chkRevision = await this.orgRevisionRepository.findOne({
let chkRevision: any = null;
if (revisionId) {
chkRevision = await this.orgRevisionRepository.findOne({
where: { id: revisionId },
});
}
@ -2265,7 +2265,7 @@ export class PositionController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `posMaster.orgChild1Id IN (:...child1)`
: `posMaster.orgChild1Id is null`
: `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
child1: _data.child1,
@ -2301,48 +2301,52 @@ export class PositionController extends Controller {
child4: _data.child4,
},
)
.orWhere(
.andWhere(
new Brackets((qb) => {
qb.andWhere(
body.keyword != null && body.keyword != ""
? body.isAll == false
? searchShortName
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
: "1=1",
qb.orWhere(
new Brackets((qb) => {
qb.andWhere(
body.keyword != null && body.keyword != ""
? body.isAll == false
? searchShortName
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
: "1=1",
)
.andWhere(checkChildConditions)
.andWhere(typeCondition)
.andWhere(revisionCondition);
}),
)
.andWhere(checkChildConditions)
.andWhere(typeCondition)
.andWhere(revisionCondition);
}),
)
.orWhere(
new Brackets((qb) => {
qb.andWhere(
body.keyword != null && body.keyword != ""
? `CONCAT(current_holder.prefix, current_holder.firstName," ",current_holder.lastName) like '%${body.keyword}%'`
: "1=1",
{
keyword: `%${body.keyword}%`,
},
)
.andWhere(checkChildConditions)
.andWhere(typeCondition)
.andWhere(revisionCondition);
}),
)
.orWhere(
new Brackets((qb) => {
qb.andWhere(
body.keyword != null && body.keyword != ""
? `CASE WHEN orgRevision.orgRevisionIsDraft = true THEN CONCAT(next_holder.prefix, next_holder.firstName,' ', next_holder.lastName) ELSE CONCAT(current_holder.prefix, current_holder.firstName,' ' , current_holder.lastName) END LIKE '%${body.keyword}%'`
: "1=1",
{
keyword: `%${body.keyword}%`,
},
)
.andWhere(checkChildConditions)
.andWhere(typeCondition)
.andWhere(revisionCondition);
.orWhere(
new Brackets((qb) => {
qb.andWhere(
body.keyword != null && body.keyword != ""
? `CONCAT(current_holder.prefix, current_holder.firstName," ",current_holder.lastName) like '%${body.keyword}%'`
: "1=1",
{
keyword: `%${body.keyword}%`,
},
)
.andWhere(checkChildConditions)
.andWhere(typeCondition)
.andWhere(revisionCondition);
}),
)
.orWhere(
new Brackets((qb) => {
qb.andWhere(
body.keyword != null && body.keyword != ""
? `CASE WHEN orgRevision.orgRevisionIsDraft = true THEN CONCAT(next_holder.prefix, next_holder.firstName,' ', next_holder.lastName) ELSE CONCAT(current_holder.prefix, current_holder.firstName,' ' , current_holder.lastName) END LIKE '%${body.keyword}%'`
: "1=1",
{
keyword: `%${body.keyword}%`,
},
)
.andWhere(checkChildConditions)
.andWhere(typeCondition)
.andWhere(revisionCondition);
}),
);
}),
)
.orderBy("orgRoot.orgRootOrder", "ASC")
@ -2520,24 +2524,22 @@ export class PositionController extends Controller {
};
}),
);
if(_data.privilege === 'NORMAL'|| _data.privilege === 'PARENT'|| _data.privilege === 'CHILD'){ //PARENT จะไม่มีทางเห็น ROOT , CHILD ยึดจาก CHILD ที่อยู่ลงไปข้างล่างและจะไม่เห็น CHILD ที่อยู่เหนือกว่า
const nextChildMap:any = { //เอาไวเช็ค CHILD ถัดไป
if (_data.privilege === "NORMAL" || _data.privilege === "CHILD") {
//PARENT จะไม่มีทางเห็น ROOT , CHILD ยึดจาก CHILD ที่อยู่ลงไปข้างล่างและจะไม่เห็น CHILD ที่อยู่เหนือกว่า
const nextChildMap: any = {
//เอาไวเช็ค CHILD ถัดไป
0: _data.child1,
1: _data.child2,
2: _data.child3,
3: _data.child4,
};
const childValue = nextChildMap[body.type];
if(_data.privilege === 'NORMAL'){
if (Array.isArray(childValue) && childValue.some(item => item != null)) {
if (_data.privilege === "NORMAL") {
if (Array.isArray(childValue) && childValue.some((item) => item != null)) {
return new HttpSuccess({ data: [], total: 0 });
}
}else if(_data.privilege === 'PARENT'){
if (body.type == 0){
return new HttpSuccess({ data: [], total: 0 });
}
} else if (_data.privilege === 'CHILD') {
} else if (_data.privilege === "CHILD") {
const higherChildChecks = [
{ type: [0], child: _data.child1, next: _data.child2 },
{ type: [0, 1], child: _data.child2, next: _data.child3 },
@ -3751,7 +3753,6 @@ export class PositionController extends Controller {
});
});
// //เช็คถ้า revision ปัจจุบันให้ปั๊มที่ profile
// const chkRevision = await this.orgRevisionRepository.findOne({
// where: { id: dataMaster.orgRevisionId },
@ -5290,7 +5291,7 @@ export class PositionController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `posMaster.orgChild1Id IN (:...child1)`
: `posMaster.orgChild1Id is null`
: `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
child1: _data.child1,

View file

@ -1028,12 +1028,15 @@ export class ProfileEmployeeTempController extends Controller {
if (!result) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
try{
try {
await this.informationHistoryRepository.delete({ profileEmployeeId: id });
await this.profileRepo.remove(result);
} catch {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถลบข้อมูลได้ เนื่องจากข้อมูลนี้ถูกใช้งานในระบบอื่น");
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่สามารถลบข้อมูลได้ เนื่องจากข้อมูลนี้ถูกใช้งานในระบบอื่น",
);
}
return new HttpSuccess();
}
@ -1106,7 +1109,7 @@ export class ProfileEmployeeTempController extends Controller {
_dataOrg.child1 != undefined && _dataOrg.child1 != null
? _dataOrg.child1[0] != null
? `current_holderTemps.orgChild1Id IN (:...child1)`
: `current_holderTemps.orgChild1Id is null`
: `current_holderTemps.orgChild1Id is ${_dataOrg.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
child1: _dataOrg.child1,
@ -1561,7 +1564,7 @@ export class ProfileEmployeeTempController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holderTemps.orgChild1Id IN (:...child1)`
: `current_holderTemps.orgChild1Id is null`
: `current_holderTemps.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
child1: _data.child1,
@ -2270,7 +2273,7 @@ export class ProfileEmployeeTempController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holderTemps.orgChild1Id IN (:...child1)`
: `current_holderTemps.orgChild1Id is null`
: `current_holderTemps.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{ child1: _data.child1 },
)

89414
src/data/amphures.json Normal file

File diff suppressed because it is too large Load diff

695
src/data/provinces.json Normal file
View file

@ -0,0 +1,695 @@
[
{
"id": 1,
"name_th": "กรุงเทพมหานคร",
"name_en": "Bangkok",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 2,
"name_th": "สมุทรปราการ",
"name_en": "Samut Prakan",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 3,
"name_th": "นนทบุรี",
"name_en": "Nonthaburi",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 4,
"name_th": "ปทุมธานี",
"name_en": "Pathum Thani",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 5,
"name_th": "พระนครศรีอยุธยา",
"name_en": "Phra Nakhon Si Ayutthaya",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 6,
"name_th": "อ่างทอง",
"name_en": "Ang Thong",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 7,
"name_th": "ลพบุรี",
"name_en": "Lopburi",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 8,
"name_th": "สิงห์บุรี",
"name_en": "Sing Buri",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 9,
"name_th": "ชัยนาท",
"name_en": "Chai Nat",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 10,
"name_th": "สระบุรี",
"name_en": "Saraburi",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 11,
"name_th": "ชลบุรี",
"name_en": "Chon Buri",
"geography_id": 5,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 12,
"name_th": "ระยอง",
"name_en": "Rayong",
"geography_id": 5,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 13,
"name_th": "จันทบุรี",
"name_en": "Chanthaburi",
"geography_id": 5,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 14,
"name_th": "ตราด",
"name_en": "Trat",
"geography_id": 5,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 15,
"name_th": "ฉะเชิงเทรา",
"name_en": "Chachoengsao",
"geography_id": 5,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 16,
"name_th": "ปราจีนบุรี",
"name_en": "Prachin Buri",
"geography_id": 5,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 17,
"name_th": "นครนายก",
"name_en": "Nakhon Nayok",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 18,
"name_th": "สระแก้ว",
"name_en": "Sa Kaeo",
"geography_id": 5,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 19,
"name_th": "นครราชสีมา",
"name_en": "Nakhon Ratchasima",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 20,
"name_th": "บุรีรัมย์",
"name_en": "Buri Ram",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 21,
"name_th": "สุรินทร์",
"name_en": "Surin",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 22,
"name_th": "ศรีสะเกษ",
"name_en": "Si Sa Ket",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 23,
"name_th": "อุบลราชธานี",
"name_en": "Ubon Ratchathani",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 24,
"name_th": "ยโสธร",
"name_en": "Yasothon",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 25,
"name_th": "ชัยภูมิ",
"name_en": "Chaiyaphum",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 26,
"name_th": "อำนาจเจริญ",
"name_en": "Amnat Charoen",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 27,
"name_th": "หนองบัวลำภู",
"name_en": "Nong Bua Lam Phu",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 28,
"name_th": "ขอนแก่น",
"name_en": "Khon Kaen",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 29,
"name_th": "อุดรธานี",
"name_en": "Udon Thani",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 30,
"name_th": "เลย",
"name_en": "Loei",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 31,
"name_th": "หนองคาย",
"name_en": "Nong Khai",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 32,
"name_th": "มหาสารคาม",
"name_en": "Maha Sarakham",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 33,
"name_th": "ร้อยเอ็ด",
"name_en": "Roi Et",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 34,
"name_th": "กาฬสินธุ์",
"name_en": "Kalasin",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 35,
"name_th": "สกลนคร",
"name_en": "Sakon Nakhon",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 36,
"name_th": "นครพนม",
"name_en": "Nakhon Phanom",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 37,
"name_th": "มุกดาหาร",
"name_en": "Mukdahan",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 38,
"name_th": "เชียงใหม่",
"name_en": "Chiang Mai",
"geography_id": 1,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 39,
"name_th": "ลำพูน",
"name_en": "Lamphun",
"geography_id": 1,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 40,
"name_th": "ลำปาง",
"name_en": "Lampang",
"geography_id": 1,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 41,
"name_th": "อุตรดิตถ์",
"name_en": "Uttaradit",
"geography_id": 1,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 42,
"name_th": "แพร่",
"name_en": "Phrae",
"geography_id": 1,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 43,
"name_th": "น่าน",
"name_en": "Nan",
"geography_id": 1,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 44,
"name_th": "พะเยา",
"name_en": "Phayao",
"geography_id": 1,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 45,
"name_th": "เชียงราย",
"name_en": "Chiang Rai",
"geography_id": 1,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 46,
"name_th": "แม่ฮ่องสอน",
"name_en": "Mae Hong Son",
"geography_id": 1,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 47,
"name_th": "นครสวรรค์",
"name_en": "Nakhon Sawan",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 48,
"name_th": "อุทัยธานี",
"name_en": "Uthai Thani",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 49,
"name_th": "กำแพงเพชร",
"name_en": "Kamphaeng Phet",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 50,
"name_th": "ตาก",
"name_en": "Tak",
"geography_id": 4,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 51,
"name_th": "สุโขทัย",
"name_en": "Sukhothai",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 52,
"name_th": "พิษณุโลก",
"name_en": "Phitsanulok",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 53,
"name_th": "พิจิตร",
"name_en": "Phichit",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 54,
"name_th": "เพชรบูรณ์",
"name_en": "Phetchabun",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 55,
"name_th": "ราชบุรี",
"name_en": "Ratchaburi",
"geography_id": 4,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 56,
"name_th": "กาญจนบุรี",
"name_en": "Kanchanaburi",
"geography_id": 4,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 57,
"name_th": "สุพรรณบุรี",
"name_en": "Suphan Buri",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 58,
"name_th": "นครปฐม",
"name_en": "Nakhon Pathom",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 59,
"name_th": "สมุทรสาคร",
"name_en": "Samut Sakhon",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 60,
"name_th": "สมุทรสงคราม",
"name_en": "Samut Songkhram",
"geography_id": 2,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 61,
"name_th": "เพชรบุรี",
"name_en": "Phetchaburi",
"geography_id": 4,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 62,
"name_th": "ประจวบคีรีขันธ์",
"name_en": "Prachuap Khiri Khan",
"geography_id": 4,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 63,
"name_th": "นครศรีธรรมราช",
"name_en": "Nakhon Si Thammarat",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 64,
"name_th": "กระบี่",
"name_en": "Krabi",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 65,
"name_th": "พังงา",
"name_en": "Phangnga",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 66,
"name_th": "ภูเก็ต",
"name_en": "Phuket",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 67,
"name_th": "สุราษฎร์ธานี",
"name_en": "Surat Thani",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 68,
"name_th": "ระนอง",
"name_en": "Ranong",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 69,
"name_th": "ชุมพร",
"name_en": "Chumphon",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 70,
"name_th": "สงขลา",
"name_en": "Songkhla",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 71,
"name_th": "สตูล",
"name_en": "Satun",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 72,
"name_th": "ตรัง",
"name_en": "Trang",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 73,
"name_th": "พัทลุง",
"name_en": "Phatthalung",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 74,
"name_th": "ปัตตานี",
"name_en": "Pattani",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 75,
"name_th": "ยะลา",
"name_en": "Yala",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 76,
"name_th": "นราธิวาส",
"name_en": "Narathiwat",
"geography_id": 6,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
},
{
"id": 77,
"name_th": "บึงกาฬ",
"name_en": "Bueng Kan",
"geography_id": 3,
"created_at": "2019-08-09T03:33:09.000+07:00",
"updated_at": "2025-09-20T06:31:26.000+07:00",
"deleted_at": null
}
]

8372
src/data/tambons.json Normal file

File diff suppressed because it is too large Load diff

View file

@ -19,6 +19,18 @@ export class District extends EntityBase {
})
provinceId: string;
// @Column({
// comment: "mark",
// default: null,
// })
// importUpdate: number;
// @Column({
// comment: "refId",
// default: null,
// })
// refId: number;
@ManyToOne(() => Province, (province) => province.districts)
@JoinColumn({ name: "provinceId" })
province: Province;

View file

@ -0,0 +1,22 @@
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("district_master")
export class DistrictMaster {
@PrimaryGeneratedColumn()
id: number;
@Column({ length: 255 })
name_th: string;
@Column({ length: 255 })
name_en: string;
@Column()
province_id: number;
@Column({ nullable: true })
created_at: string;
@Column({ nullable: true })
updated_at: string;
}

View file

@ -12,6 +12,18 @@ export class Province extends EntityBase {
})
name: string;
// @Column({
// comment: "mark",
// default: null,
// })
// importUpdate: number;
// @Column({
// comment: "refId",
// default: null,
// })
// refId: number;
@OneToMany(() => District, (district) => district.province)
districts: District[];

View file

@ -0,0 +1,22 @@
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("province_master")
export class ProvinceMaster {
@PrimaryGeneratedColumn()
id: number;
@Column({ length: 255 })
name_th: string;
@Column({ length: 255 })
name_en: string;
@Column()
geography_id: number;
@Column({ nullable: true })
created_at: string;
@Column({ nullable: true })
updated_at: string;
}

View file

@ -26,6 +26,18 @@ export class SubDistrict extends EntityBase {
})
districtId: string;
// @Column({
// comment: "mark",
// default: null,
// })
// importUpdate: number;
// @Column({
// comment: "refId",
// default: null,
// })
// refId: number;
@ManyToOne(() => District, (district) => district.subDistricts)
@JoinColumn({ name: "districtId" })
district: District;

View file

@ -0,0 +1,31 @@
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("subdistrict_master")
export class SubDistrictMaster {
@PrimaryGeneratedColumn()
id: number;
@Column()
zip_code: number;
@Column({ length: 255 })
name_th: string;
@Column({ length: 255 })
name_en: string;
@Column()
district_id: number;
@Column({ type: "float", nullable: true })
lat: number | null;
@Column({ type: "float", nullable: true })
long: number | null;
@Column({ type: "timestamp", nullable: true })
created_at: string;
@Column({ type: "timestamp", nullable: true })
updated_at: string;
}

View file

@ -97,7 +97,7 @@ class CheckAuth {
} else if (privilege == "PARENT") {
data = {
root: [x.orgRootId],
child1: null,
child1: [null],
child2: null,
child3: null,
child4: null,