Compare commits
169 Commits
0ddf67d815
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| dcfa56bdb9 | |||
| ea92422bb1 | |||
| 2111a5fdc9 | |||
| 6edd20585f | |||
| a9759795c4 | |||
| 32f26a1725 | |||
| 60533beed5 | |||
| 24ced97b6d | |||
| dc1d342799 | |||
| 44d0cb63cf | |||
| ace73fa919 | |||
| 316af4233f | |||
| 36a805c652 | |||
| 460bc3d24a | |||
| ec201fcfb5 | |||
| 914ad46c43 | |||
| b96c546ed3 | |||
| 29b3be41a1 | |||
| 16edf58025 | |||
| 775627f215 | |||
| 4e70fae69b | |||
| 24dd109a21 | |||
| 38b57a00cc | |||
| f8070db95f | |||
| 10e9dc430c | |||
| 6b669ccd9c | |||
| d9a10d98a1 | |||
| e64dc7c013 | |||
| d63138d746 | |||
| 84a28f2d01 | |||
| 9be6614972 | |||
| 9d0db71f6a | |||
| 3cc55436f3 | |||
| 124fde07e0 | |||
| b15d0d7322 | |||
| 0680f332fb | |||
| 46bf310dce | |||
| 0dda6ae744 | |||
| 1b59cdd3a4 | |||
| 56934216f7 | |||
| e8a2ef8b85 | |||
| 6cbffa4ac5 | |||
| 09f16f4e62 | |||
| 461acb2b16 | |||
| 0d05c66a2b | |||
| 096cc18477 | |||
| f3333ce020 | |||
| 8e3d2b3d95 | |||
| 501709546d | |||
| 2b5e77993b | |||
| 6efaffbb17 | |||
| 90ddbca2e7 | |||
| 7a9ea16f48 | |||
| 420826de9b | |||
| dc2d3718fa | |||
| 5013228384 | |||
| 4459742cf0 | |||
| 070c3ee975 | |||
| 8ac92888ad | |||
| 567579ef35 | |||
| 8d90f27514 | |||
| 722b23a321 | |||
| ba48c5307f | |||
| 30d2ec0477 | |||
| d3c6444491 | |||
| 12345c0b64 | |||
| 6833dfc992 | |||
| ac27a286c0 | |||
| a3dba6cc9d | |||
| 320dd47aea | |||
| 712a6eebdf | |||
| f226c5644c | |||
| d605225e48 | |||
| 8e7f1eb098 | |||
| 59c6fd0117 | |||
| 2607fd3026 | |||
| bdb4bfc53d | |||
| c1816c07ff | |||
| 7311372ba8 | |||
| cd53460bec | |||
| 7e15e5d7bc | |||
| 3193e07e47 | |||
| 40bc19aa6f | |||
| 90920e8fba | |||
| f8cf0851a8 | |||
| efdab5bafc | |||
| 700346d809 | |||
| a96b85bc53 | |||
| b23bb0db31 | |||
| 8c0f67ca35 | |||
| 7b6c9bdfbf | |||
| 7b28f4e9ef | |||
| a30eebf5d3 | |||
| 9aa0b31278 | |||
| 33cbb17a0e | |||
| 242ff6277a | |||
| 566754bf2e | |||
| 50b7c9cac5 | |||
| b0ac326752 | |||
| 9572b71592 | |||
| 96c3e4c24a | |||
| aba1668d2c | |||
| 20fc286069 | |||
| 75c0659658 | |||
| 564f0b5add | |||
| 7b630d5c0b | |||
| eb6b9ce388 | |||
| c777395b03 | |||
| c509c7fe28 | |||
| 6f632ecd68 | |||
| fef0303cd6 | |||
| 314ab049bb | |||
| 5277ddfc51 | |||
| b6030de4f4 | |||
| 1084cede04 | |||
| ca866bf8c6 | |||
| 9d793d2205 | |||
| 247010d48f | |||
| 7c40f028c8 | |||
| 65304f61ce | |||
| 6ce4d84fd0 | |||
| 2e05f6eeee | |||
| 577584ef4d | |||
| 360c0163f1 | |||
| bd7bea8db6 | |||
| b1c56ee4bb | |||
| 79f4121311 | |||
| d17edb1f9c | |||
| 8fca201e04 | |||
| b4064e8769 | |||
| 8996da7eb4 | |||
| 5023d4d129 | |||
| 0b0298423e | |||
| a7bde5e4eb | |||
| 50cde2d8d2 | |||
| a6cc17ccb1 | |||
| ebe5c0bd5a | |||
| b8a9aa5132 | |||
| 52089ecdf0 | |||
| d406a92f3d | |||
| 2a6eafa19a | |||
| 00ef72de90 | |||
| 9d9ca63d7c | |||
| f9cfada840 | |||
| c2ae445ea4 | |||
| 2ed6bf4d1f | |||
| 6d27a7aa63 | |||
| 92af7262f6 | |||
| 2133b94a1d | |||
| a7a9aa2874 | |||
| 1283a63b5f | |||
| 25a958d592 | |||
| e1e659f9b1 | |||
| d60c08a281 | |||
| d3e8e94110 | |||
| 2a83f92850 | |||
| dd6c2971f8 | |||
| a19b03b8bf | |||
| c552b9eb1c | |||
| 99b2d762d6 | |||
| 6493e0398a | |||
| be6510f912 | |||
| 006ec1bfc0 | |||
| c6f766089b | |||
| 6c27fa10a6 | |||
| 8198c7a478 | |||
| 45dda3c40a | |||
| 56d21fec84 | |||
| 721813dc29 |
33
.gitea/ISSUE_TEMPLATE.md
Normal file
33
.gitea/ISSUE_TEMPLATE.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
name: Bug Report
|
||||||
|
about: Report a bug to help us improve.
|
||||||
|
title: "[BUG] "
|
||||||
|
labels: ["bug", "needs-triage"]
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
### Screenshots
|
||||||
|
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
### Gitea Version
|
||||||
|
|
||||||
|
e.g., 1.25.0
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
|
||||||
|
Add any other context about the problem here.
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,6 +13,7 @@ controllerBuilds
|
|||||||
# ignoring the old app that will be built into this one to make deploying faster and more easy as we do the migration
|
# ignoring the old app that will be built into this one to make deploying faster and more easy as we do the migration
|
||||||
lstV2/frontend/.tanstack
|
lstV2/frontend/.tanstack
|
||||||
|
|
||||||
|
keys
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
|
|||||||
1
.include
1
.include
@@ -1,5 +1,6 @@
|
|||||||
dist
|
dist
|
||||||
frontend/dist
|
frontend/dist
|
||||||
|
mobileLst/dist
|
||||||
lstDocs/build
|
lstDocs/build
|
||||||
migrations
|
migrations
|
||||||
Dockerfile
|
Dockerfile
|
||||||
|
|||||||
48
.vscode/settings copy.json.bak
vendored
48
.vscode/settings copy.json.bak
vendored
@@ -1,48 +0,0 @@
|
|||||||
{
|
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
||||||
"workbench.colorTheme": "Default Dark+",
|
|
||||||
"prettier.tabWidth": 4,
|
|
||||||
"terminal.integrated.env.windows": {},
|
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"[javascript]": {
|
|
||||||
"editor.formatOnSave": true
|
|
||||||
},
|
|
||||||
"[javascriptreact]": {
|
|
||||||
"editor.formatOnSave": true
|
|
||||||
},
|
|
||||||
"[typescript]": {
|
|
||||||
"editor.formatOnSave": true
|
|
||||||
},
|
|
||||||
"[typescriptreact]": {
|
|
||||||
"editor.formatOnSave": true
|
|
||||||
},
|
|
||||||
"[json]": {
|
|
||||||
"editor.formatOnSave": true
|
|
||||||
},
|
|
||||||
"[graphql]": {
|
|
||||||
"editor.formatOnSave": true
|
|
||||||
},
|
|
||||||
"[handlebars]": {
|
|
||||||
"editor.formatOnSave": true
|
|
||||||
},
|
|
||||||
"[go]": {
|
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"editor.defaultFormatter": "golang.go"
|
|
||||||
},
|
|
||||||
"[powershell]": {
|
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"editor.defaultFormatter": "ms-vscode.powershell" // requires PowerShell extension
|
|
||||||
},
|
|
||||||
"[bat]": {
|
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"editor.defaultFormatter": "foxundermoon.shell-format" // supports .sh, .bat, .cmd
|
|
||||||
},
|
|
||||||
"[cmd]": {
|
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
||||||
},
|
|
||||||
|
|
||||||
// Optional: Configure goimports instead of gofmt
|
|
||||||
"go.formatTool": "goimports",
|
|
||||||
"cSpell.words": ["alpla", "alplamart", "alplaprod", "ppoo"]
|
|
||||||
}
|
|
||||||
52
.vscode/settings.json
vendored
52
.vscode/settings.json
vendored
@@ -7,12 +7,60 @@
|
|||||||
"source.fixAll.biome": "explicit",
|
"source.fixAll.biome": "explicit",
|
||||||
"source.organizeImports.biome": "explicit"
|
"source.organizeImports.biome": "explicit"
|
||||||
},
|
},
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[javascriptreact]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[typescriptreact]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[json]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[graphql]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[handlebars]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[go]": {
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "golang.go"
|
||||||
|
},
|
||||||
|
"[powershell]": {
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "ms-vscode.powershell" // requires PowerShell extension
|
||||||
|
},
|
||||||
|
"[bat]": {
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "foxundermoon.shell-format" // supports .sh, .bat, .cmd
|
||||||
|
},
|
||||||
|
"[cmd]": {
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "foxundermoon.shell-format"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Optional: Configure goimports instead of gofmt
|
||||||
|
"go.formatTool": "goimports",
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
|
"acitve",
|
||||||
|
"actaully",
|
||||||
"alpla",
|
"alpla",
|
||||||
"alplamart",
|
"alplamart",
|
||||||
"alplaprod",
|
"alplaprod",
|
||||||
|
"autoconsume",
|
||||||
"intiallally",
|
"intiallally",
|
||||||
"ppoo",
|
"ppoo",
|
||||||
"prodlabels"
|
"prodlabels",
|
||||||
]
|
"rfid"
|
||||||
|
],
|
||||||
|
"gitea.token": "8456def90e1c651a761a8711763d6ef225d6b2db",
|
||||||
|
"gitea.instanceURL": "https://git.tuffraid.net",
|
||||||
|
"gitea.owner": "cowch",
|
||||||
|
"gitea.repo": "lst"
|
||||||
}
|
}
|
||||||
|
|||||||
176
CHANGELOG.md
176
CHANGELOG.md
@@ -1,5 +1,181 @@
|
|||||||
# All Changes to LST can be found below.
|
# All Changes to LST can be found below.
|
||||||
|
|
||||||
|
## [1.9.0](https://git.tuffraid.net/cowch/lst/compare/v1.8.0...v1.9.0) (2025-12-03)
|
||||||
|
|
||||||
|
|
||||||
|
### 📝 Chore
|
||||||
|
|
||||||
|
* **module updates:** just updated all the modules ([bdb4bfc](https://git.tuffraid.net/cowch/lst/commits/bdb4bfc53d24f37f0e7098ea828cf418d58d5224))
|
||||||
|
|
||||||
|
|
||||||
|
### 🌟 Enhancements
|
||||||
|
|
||||||
|
* **datamart:** active article moved over to the new version ([8e7f1eb](https://git.tuffraid.net/cowch/lst/commits/8e7f1eb09811fcf3ea49b95b0ba9a8f55b9c4184))
|
||||||
|
* **dm:** added article description into the historical data ([7311372](https://git.tuffraid.net/cowch/lst/commits/7311372ba8eb901b51972ca216152bcfc2b009af))
|
||||||
|
* **swagger:** added in the start of swagger where all the common and useable endpoints will be ([2607fd3](https://git.tuffraid.net/cowch/lst/commits/2607fd3026ed0b5777a5598aa3498ffc67baa012))
|
||||||
|
|
||||||
|
|
||||||
|
### 🛠️ Code Refactor
|
||||||
|
|
||||||
|
* **contorller:** only install npm production modules dont install everything ([c1816c0](https://git.tuffraid.net/cowch/lst/commits/c1816c07ff5ac939b0997d314a9da624a4a66b7a))
|
||||||
|
* **helpercommands:** removed the remove as reusabele ([a3dba6c](https://git.tuffraid.net/cowch/lst/commits/a3dba6cc9db147ff4765fef648867e50878a6ac8))
|
||||||
|
* **quality:** added a check to monior [#7](https://git.tuffraid.net/cowch/lst/issues/7) as well ([6833dfc](https://git.tuffraid.net/cowch/lst/commits/6833dfc9929741203083b01726b83a6c8d61d308))
|
||||||
|
* **sql:** some changes to help with sql connection on random disconnect ([320dd47](https://git.tuffraid.net/cowch/lst/commits/320dd47aea017b4ff219b07e363ef87ec8523b82))
|
||||||
|
* **swagger:** corrected the name displaced ([d605225](https://git.tuffraid.net/cowch/lst/commits/d605225e48bca66f915ce0db448aa61933891986))
|
||||||
|
|
||||||
|
|
||||||
|
### 🐛 Bug fixes
|
||||||
|
|
||||||
|
* **commands:** corrections to allow external labels to be consumed and transfered ([12345c0](https://git.tuffraid.net/cowch/lst/commits/12345c0b6442c3abd309f660bb43216def9abb89))
|
||||||
|
* **dm:** type in customer article number ([f226c56](https://git.tuffraid.net/cowch/lst/commits/f226c5644cc2b93b9d967962bd6f82b3e506c8c0))
|
||||||
|
* **labeling:** added in a catch to avoid rouge lots ([59c6fd0](https://git.tuffraid.net/cowch/lst/commits/59c6fd011728dff50bfa3233d6095c396d0b1999))
|
||||||
|
* **lot transfer:** changes to make it so the reprint and return do not happen instantly ([ac27a28](https://git.tuffraid.net/cowch/lst/commits/ac27a286c07733333703d8421cfa525691363e54))
|
||||||
|
* **lstv2:** added in a close function to stop crashing the server ([712a6ee](https://git.tuffraid.net/cowch/lst/commits/712a6eebdfef0ce2b99155d23422ddc7e5e0daad))
|
||||||
|
|
||||||
|
## [1.8.0](https://git.tuffraid.net/cowch/lst/compare/v1.7.0...v1.8.0) (2025-11-25)
|
||||||
|
|
||||||
|
|
||||||
|
### 📝 Chore
|
||||||
|
|
||||||
|
* **misc:** api doc dates and db changes ([52089ec](https://git.tuffraid.net/cowch/lst/commits/52089ecdf06d9e5983afb6a24953d066a0456949))
|
||||||
|
|
||||||
|
|
||||||
|
### 📈 Project changes
|
||||||
|
|
||||||
|
* **settings:** changes to vs code as it was being way to slow ([5277ddf](https://git.tuffraid.net/cowch/lst/commits/5277ddfc51632651059e35b799ddf2a63d70cb70))
|
||||||
|
|
||||||
|
|
||||||
|
### 📝 Testing Code
|
||||||
|
|
||||||
|
* **android app:** this is the start to the android app ([7b630d5](https://git.tuffraid.net/cowch/lst/commits/7b630d5c0b1175f06c866b1238754e455d3a27c9))
|
||||||
|
* **controller:** added in server port that might night be needed but oh well ([efdab5b](https://git.tuffraid.net/cowch/lst/commits/efdab5bafca2a46d73de7ab1d776d283d5294aa3))
|
||||||
|
* **materials per day:** work on getting this running better ([a30eebf](https://git.tuffraid.net/cowch/lst/commits/a30eebf5d34c77c6c7118faf01776651f8888547))
|
||||||
|
* **mobile:** more testing on ota ([75c0659](https://git.tuffraid.net/cowch/lst/commits/75c0659658cbbb7e983df5538538d6429a325379))
|
||||||
|
* **mobile:** stallion intergration starts ([20fc286](https://git.tuffraid.net/cowch/lst/commits/20fc2860690f59851ca1e0251df84854c9d2ba01))
|
||||||
|
* **mobile:** testing for ota updated on android scanner ([314ab04](https://git.tuffraid.net/cowch/lst/commits/314ab049bb650120489259e920e52fd530f0ce41))
|
||||||
|
* **ti intergration:** added the place holder for intergration of comments for customer ([f8cf085](https://git.tuffraid.net/cowch/lst/commits/f8cf0851a86a6923a8941774efe17f93cb92e984))
|
||||||
|
|
||||||
|
|
||||||
|
### 🛠️ Code Refactor
|
||||||
|
|
||||||
|
* **all server stats:** added a 5 second time out if it dose not reach it just stops ([2133b94](https://git.tuffraid.net/cowch/lst/commits/2133b94a1dd84e16bb5a4b8fe215739a4b355223))
|
||||||
|
* **app:** refactored how we have the pkg.json so we can reduce on size of the app ([90920e8](https://git.tuffraid.net/cowch/lst/commits/90920e8fba4757297e0e42e86f80d5f14434a48e))
|
||||||
|
* **base modules:** removed the log spam ([6d27a7a](https://git.tuffraid.net/cowch/lst/commits/6d27a7aa6395a094d8763ba3fde0bdb81a7e3082))
|
||||||
|
* **cards:** trying to make the cards fit the odd shaped screens better ([33cbb17](https://git.tuffraid.net/cowch/lst/commits/33cbb17a0ede136a9be96e47ba0a7a66468b1ebc))
|
||||||
|
* **forklifts:** more refactoring to improve during production ([8c0f67c](https://git.tuffraid.net/cowch/lst/commits/8c0f67ca351778405279f7e225ee8dae654033f9))
|
||||||
|
* **inv with rn:** now includes batch number for tetra ([1084ced](https://git.tuffraid.net/cowch/lst/commits/1084cede04d43ec2b2c22c43c6e701bad4701981))
|
||||||
|
* **leases:** removed main server until i have a better way to sync them ([6ce4d84](https://git.tuffraid.net/cowch/lst/commits/6ce4d84fd00fa446ccb7d1bbad28680f045fae52))
|
||||||
|
* **ocp page:** using the name of the url now vs the settings ([d406a92](https://git.tuffraid.net/cowch/lst/commits/d406a92f3d5d6a8902164e9182717912debae804))
|
||||||
|
* **ocp:** work around for zechetti 2 until we can monitor more closing ([700346d](https://git.tuffraid.net/cowch/lst/commits/700346d80972e464d0a9ba62bba4dc0ed949cdee))
|
||||||
|
* **quality:** added some new options plus cancel button ([242ff62](https://git.tuffraid.net/cowch/lst/commits/242ff6277a1f407fbed2951d30dd6cf1ee32dd60))
|
||||||
|
* **quality:** more changes to the system to perfect it ([7b28f4e](https://git.tuffraid.net/cowch/lst/commits/7b28f4e9ef32a4fc90a0b4b16953b6cead096cac))
|
||||||
|
* **serverlist:** refactored to also show uptime and other info about the server ([e1e659f](https://git.tuffraid.net/cowch/lst/commits/e1e659f9b14f22474f919350f07b02b45141aa63))
|
||||||
|
* **types:** moved the item type to the sidebar to keep it more clean ([5023d4d](https://git.tuffraid.net/cowch/lst/commits/5023d4d129737cf6e0609592e5606a20a0f3728b))
|
||||||
|
* **wrapper:** removed the logs so its not spamming the server ([b8a9aa5](https://git.tuffraid.net/cowch/lst/commits/b8a9aa5132c7606fcccae8f058a77a11a8ed552a))
|
||||||
|
|
||||||
|
|
||||||
|
### 🐛 Bug fixes
|
||||||
|
|
||||||
|
* **comments:** added new role to put comments in ([1283a63](https://git.tuffraid.net/cowch/lst/commits/1283a63b5fd71fb44f7ec7789f670f8af7eafbb8))
|
||||||
|
* **correction:** the name needed to be correct to have a proper tempalte ([b1c56ee](https://git.tuffraid.net/cowch/lst/commits/b1c56ee4bb32c0dbf86e0164614fb3f1ecaf262d))
|
||||||
|
* **dm:** correction to passing the username over for the importing of the file ([a7a9aa2](https://git.tuffraid.net/cowch/lst/commits/a7a9aa2874ddd1391b56983db51cfabd8e789213))
|
||||||
|
* **dm:** fixes to validate auth before submiting incase someone stays on the page to long ([fef0303](https://git.tuffraid.net/cowch/lst/commits/fef0303cd6fdc9cc8cf9f9f4ad674a8b725691f3))
|
||||||
|
* **file name wrong:** fixed the name of the file for getCompanies ([8996da7](https://git.tuffraid.net/cowch/lst/commits/8996da7eb46a8b5bdfe44ee74a676e701d64fdbf))
|
||||||
|
* **forecast table:** correction to the customer article number ([ebe5c0b](https://git.tuffraid.net/cowch/lst/commits/ebe5c0bd5a883b1cbe87f7f9932fd803e80e7fae))
|
||||||
|
* **historical date:** added so we can have all dates ([9d793d2](https://git.tuffraid.net/cowch/lst/commits/9d793d22051c585ed224bfaf16e2a9b60bb02635))
|
||||||
|
* **historical inv:** corrected the way the date can come over to allow for yyyy-mm-dd or with / ([7c40f02](https://git.tuffraid.net/cowch/lst/commits/7c40f028c88d7fd78ac8ab75c172d808783fc641)), closes [#1](https://git.tuffraid.net/cowch/lst/issues/1)
|
||||||
|
* **historicalinv:** removed the second running one that caused duplicates ([a6cc17c](https://git.tuffraid.net/cowch/lst/commits/a6cc17ccb12b0d99ffdb1d371c5daf3bbb91f7ba))
|
||||||
|
* **label ratio:** correction to the endpoint ([50b7c9c](https://git.tuffraid.net/cowch/lst/commits/50b7c9cac5cd6923b08a8705fc8cb41530ec5b02))
|
||||||
|
* **manual print:** fixed so the print disables ([d3e8e94](https://git.tuffraid.net/cowch/lst/commits/d3e8e941103dc0118066e8790e7c27e5f035a6c5))
|
||||||
|
* **nav:** added missing add card button ([8fca201](https://git.tuffraid.net/cowch/lst/commits/8fca201e0463aba7ecace61f8dfb737e2acf4140))
|
||||||
|
* **ocp:** made corrections to the ocp page in dayton ([92af726](https://git.tuffraid.net/cowch/lst/commits/92af7262f60514501b903f5307d34e9154cc9034))
|
||||||
|
* **plc zeccetti:** changes to improve the timing on the zecetti more to be done ([247010d](https://git.tuffraid.net/cowch/lst/commits/247010d48f10ebb02a1b98c5df101134e8dab250))
|
||||||
|
* **preprint:** added the correct to string for the preprint stuff ([360c016](https://git.tuffraid.net/cowch/lst/commits/360c0163f1d3135d9c1c3788ac53dc8e0757c441))
|
||||||
|
* **prodendpoint:** if we have a real error just report it dont actually crash ([3193e07](https://git.tuffraid.net/cowch/lst/commits/3193e07e4707d055517b15f77ac117fefe07de12))
|
||||||
|
* **quality request:** bug fixes ([6f632ec](https://git.tuffraid.net/cowch/lst/commits/6f632ecd6831456c6e3c9973bc0ce7feb229aeec))
|
||||||
|
* **quality:** corrected url and perms for quality link ([eb6b9ce](https://git.tuffraid.net/cowch/lst/commits/eb6b9ce388c5dea35f95a9403765e7d330b664f9))
|
||||||
|
* **quality:** request was missing the forced selection ([96c3e4c](https://git.tuffraid.net/cowch/lst/commits/96c3e4c24adbdc59d11f7ea43888e1c47d061f90))
|
||||||
|
* **register:** added the ability to put in _ for user name ([aba1668](https://git.tuffraid.net/cowch/lst/commits/aba1668d2cab63a031657fb7c9f2bfb9777fa72a))
|
||||||
|
* **servers:** changed the server name to be unique ([a7bde5e](https://git.tuffraid.net/cowch/lst/commits/a7bde5e4eb41c597f94302dd2d119f7048c18a6f))
|
||||||
|
* **silo adjustments:** added supervisor to see the actual page so it matches the sidbard ([9aa0b31](https://git.tuffraid.net/cowch/lst/commits/9aa0b31278e5f8201acd21774f19ba69709a654d))
|
||||||
|
* **silo commits:** added in email that was now missing due to new authj ([25a958d](https://git.tuffraid.net/cowch/lst/commits/25a958d592d189f896ae0b5f7608d80a6ee2b1e7))
|
||||||
|
* **uom:** correction to how we do the uom check so we dont just look for the space ([ca866bf](https://git.tuffraid.net/cowch/lst/commits/ca866bf8c63e0576e890367d24a47c7ab46cc864))
|
||||||
|
|
||||||
|
|
||||||
|
### 🌟 Enhancements
|
||||||
|
|
||||||
|
* **added in swagger:** added the base for swagger to implement fully later ([9d9ca63](https://git.tuffraid.net/cowch/lst/commits/9d9ca63d7c9ab3e3ea168cf2add9c7baf2b9ed15))
|
||||||
|
* **articles:** moved articles over to the main server ([2a6eafa](https://git.tuffraid.net/cowch/lst/commits/2a6eafa19a97f0be01f63c68b63b4abfc4de1409))
|
||||||
|
* **barcode gen:** added the missing link ([b4064e8](https://git.tuffraid.net/cowch/lst/commits/b4064e87691937ad9f99441767b556a167b91055))
|
||||||
|
* **db manual fixes:** added a way to fix manual db changes as needed ([0b02984](https://git.tuffraid.net/cowch/lst/commits/0b0298423ed75eed6d112a04dda998b8a23b20ea))
|
||||||
|
* **dm:** new endpoint to get the forecast data ([a96b85b](https://git.tuffraid.net/cowch/lst/commits/a96b85bc536809d223dd7a29150d1a4d632e80da))
|
||||||
|
* **forecast data:** added in a historical forecast data set ([c2ae445](https://git.tuffraid.net/cowch/lst/commits/c2ae445ea4d26b047a2ee5d16041ed230f7b2061))
|
||||||
|
* **forklifts:** added backend forklift stuff and frontend companies ([50cde2d](https://git.tuffraid.net/cowch/lst/commits/50cde2d8d2aa24796db1f1c0126ef8c373614d5d))
|
||||||
|
* **forklifts:** added the ability to add new forklifts in ([7b6c9bd](https://git.tuffraid.net/cowch/lst/commits/7b6c9bdfbf2cf9d97c8e23d8ebd6523e32284963))
|
||||||
|
* **forklifts:** added the crud ([577584e](https://git.tuffraid.net/cowch/lst/commits/577584ef4dd10ee7f57ab0ad0d6261adddaf8966))
|
||||||
|
* **form stuff:** added in a searchable dropdown and added to new forklifts ([b23bb0d](https://git.tuffraid.net/cowch/lst/commits/b23bb0db31f78f46ffc556577cadb62e0bfa3b83))
|
||||||
|
* **invoice form:** added new invoice form ([65304f6](https://git.tuffraid.net/cowch/lst/commits/65304f61ceb3ad4655757aa5c291ac4ed77db048))
|
||||||
|
* **invoices:** added invoice + linking to forklift ([2e05f6e](https://git.tuffraid.net/cowch/lst/commits/2e05f6eeee052a92095098c73ace0bd331c43b22))
|
||||||
|
* **leases:** added in leases and move table to reuseable component ([bd7bea8](https://git.tuffraid.net/cowch/lst/commits/bd7bea8db697f5b025b8d93f86677a9a69cdf2b4))
|
||||||
|
* **listeners:** added in a new feature to auto add new listeners ([f9cfada](https://git.tuffraid.net/cowch/lst/commits/f9cfada8409b3a88323dafa80730c5565c067da8))
|
||||||
|
* **materials per day:** more work on materials per day ([564f0b5](https://git.tuffraid.net/cowch/lst/commits/564f0b5addd109018a806edd6a1fed4399ea63aa))
|
||||||
|
* **migration:** settings migration from old app all is now in the new app ([40bc19a](https://git.tuffraid.net/cowch/lst/commits/40bc19aa6f952a7a60b5ee8281fa159ca114161f))
|
||||||
|
* **missing inv:** adding a way to check for missing data in case it dose pull on the correct days ([d17edb1](https://git.tuffraid.net/cowch/lst/commits/d17edb1f9c830a2c17d28bd9180d264607d66fa2))
|
||||||
|
* **mobile:** ota updates added ([b6030de](https://git.tuffraid.net/cowch/lst/commits/b6030de4f44e73ce8bb9152886d384b9d7f2edff))
|
||||||
|
* **notify:** material per day for the next 90 days ([c509c7f](https://git.tuffraid.net/cowch/lst/commits/c509c7fe286a43ab0ffbf86635631477237632b5))
|
||||||
|
* **quality:** added in comments ([566754b](https://git.tuffraid.net/cowch/lst/commits/566754bf2ecfc390bc927b48aadb2fa934353769))
|
||||||
|
* **quality:** added location moved to to the table ([9572b71](https://git.tuffraid.net/cowch/lst/commits/9572b7159235c18617ff46058c94dfd9cfab8abc))
|
||||||
|
* **quality:** priority ranking added ([c777395](https://git.tuffraid.net/cowch/lst/commits/c777395b0350f60bd457c3164ed1ae478249df3a))
|
||||||
|
* **scroll view:** added in a scroll view to for quality so it dose not go over the end of the page ([b0ac326](https://git.tuffraid.net/cowch/lst/commits/b0ac326752331ab01ad981fa7b1022e82beab143))
|
||||||
|
* **servers:** added a link to the server by clicking on the name and the gp code ([00ef72d](https://git.tuffraid.net/cowch/lst/commits/00ef72de90e43c12bd3fecdc08dfa1e3a4f881fb))
|
||||||
|
* **settings:** added in dyco printing settings ([2ed6bf4](https://git.tuffraid.net/cowch/lst/commits/2ed6bf4d1f32f9a92712ccb36d4a4146ca112e85))
|
||||||
|
* **settings:** final migration of settings and edits added ([7e15e5d](https://git.tuffraid.net/cowch/lst/commits/7e15e5d7bcdf58f31bd96564be1f213d01d37cda))
|
||||||
|
* **start of server:** added the start of server data ([d60c08a](https://git.tuffraid.net/cowch/lst/commits/d60c08a281cd63f2183381a1a19c5e196b41fbc5))
|
||||||
|
* **templates:** added bug repot template ([79f4121](https://git.tuffraid.net/cowch/lst/commits/79f4121311df733f5dc59b32a6b32c1b4a32f97b))
|
||||||
|
|
||||||
|
## [1.7.0](https://git.tuffraid.net/cowch/lst/compare/v1.6.0...v1.7.0) (2025-10-30)
|
||||||
|
|
||||||
|
|
||||||
|
### 📚 Documentation
|
||||||
|
|
||||||
|
* **api:** more old version stuff ([78a5a4a](https://git.tuffraid.net/cowch/lst/commits/78a5a4a398f8c0840e4aaffe62383d2d2fa0908a))
|
||||||
|
|
||||||
|
|
||||||
|
### 🐛 Bug fixes
|
||||||
|
|
||||||
|
* **dm:** corrected the permissions needed to view this page ([8198c7a](https://git.tuffraid.net/cowch/lst/commits/8198c7a47834466515b9446eaca105f37346a4a3))
|
||||||
|
* **export inv:** added the button to exprot data ([6392441](https://git.tuffraid.net/cowch/lst/commits/6392441f1b8330c33b0126942ab6bf21a8bb7bdc))
|
||||||
|
* **login:** redirect back to profile is ignored so it will not cause confusion ([56d21fe](https://git.tuffraid.net/cowch/lst/commits/56d21fec8439c038cb3625c8537cf4f5b2912ef6))
|
||||||
|
* **proxy:** changes to allow multiple onsite instances ([cc3657f](https://git.tuffraid.net/cowch/lst/commits/cc3657f66fcc07785e786fb16dec9009a8e9a103))
|
||||||
|
* **sidebar:** changed from module to name to have tighter control ([6c27fa1](https://git.tuffraid.net/cowch/lst/commits/6c27fa10a68e624033a0e80a33305844f007793d))
|
||||||
|
* **silo adjustment:** change the module to name for checking access ([c6f7660](https://git.tuffraid.net/cowch/lst/commits/c6f766089bd1b1a13bd8d92fa31e149ea4a7ec72))
|
||||||
|
* **siloadjustmnets:** corrected the silo adjustments to account for removed middleware ([e9ff8bb](https://git.tuffraid.net/cowch/lst/commits/e9ff8bb4cb11381aaa86f20d5882ce90f28d4783))
|
||||||
|
|
||||||
|
|
||||||
|
### 📈 Project changes
|
||||||
|
|
||||||
|
* **ts query:** added in the debugger for this ([6493e03](https://git.tuffraid.net/cowch/lst/commits/6493e0398ace860990d675aa42664cd172849a96))
|
||||||
|
|
||||||
|
|
||||||
|
### 🌟 Enhancements
|
||||||
|
|
||||||
|
* **dashboard:** added notification on use of old version ([721813d](https://git.tuffraid.net/cowch/lst/commits/721813dc299aeef651e3f46487b94fc1c59019e9))
|
||||||
|
* **modules:** modules added to frontend ([c552b9e](https://git.tuffraid.net/cowch/lst/commits/c552b9eb1c23074fcb73970acb192c8a58b9f423))
|
||||||
|
* **user migration:** user migration to the new app with a default password that will force reset ([006ec1b](https://git.tuffraid.net/cowch/lst/commits/006ec1bfc03733a14512eed5344b352ed503a99e))
|
||||||
|
* **user stuff:** added in all the user stuff ([0ddf67d](https://git.tuffraid.net/cowch/lst/commits/0ddf67d815dd8a0a87661acb9cdbfb9442bc9672))
|
||||||
|
|
||||||
|
|
||||||
|
### 🛠️ Code Refactor
|
||||||
|
|
||||||
|
* **datamart:** added in av and alias to the query ([dd6c297](https://git.tuffraid.net/cowch/lst/commits/dd6c2971f8d4ab05e9bcafc53e491ee893cb2717))
|
||||||
|
* **invhist:** reformated file ([be6510f](https://git.tuffraid.net/cowch/lst/commits/be6510f91207e913e15a60d59401fcfc21e918f8))
|
||||||
|
* **logins:** added a proper redirect to the last place you were ([45dda3c](https://git.tuffraid.net/cowch/lst/commits/45dda3c40a97a51fb8620fa2081d99989e95475c))
|
||||||
|
* **lottransfer:** formatting changes ([a19b03b](https://git.tuffraid.net/cowch/lst/commits/a19b03b8bfdac7114e61c8590e446d290f87e365))
|
||||||
|
* **materials:** added in if staged just pass the check ([147d189](https://git.tuffraid.net/cowch/lst/commits/147d189a81682b4832cbf802b79fed26576e405f))
|
||||||
|
* **modules:** moved modules to app to control everything based on there active setting ([99b2d76](https://git.tuffraid.net/cowch/lst/commits/99b2d762d6b14aadec3c280f3415b5a196b11c50))
|
||||||
|
* **printers:** allowed for more logging to come over ([66ae443](https://git.tuffraid.net/cowch/lst/commits/66ae443fb8c920d83fb58aab52ef1c8f7071749b))
|
||||||
|
* **v1 middle ware:** removed the need for this and just let it all pass ([8f22165](https://git.tuffraid.net/cowch/lst/commits/8f221659514644fd571108e0ec1233dbecb6e52a))
|
||||||
|
|
||||||
## [1.6.0](https://git.tuffraid.net/cowch/lst/compare/v1.5.0...v1.6.0) (2025-10-26)
|
## [1.6.0](https://git.tuffraid.net/cowch/lst/compare/v1.5.0...v1.6.0) (2025-10-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
meta {
|
meta {
|
||||||
name: Controller
|
name: Controller
|
||||||
seq: 1
|
seq: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
auth {
|
auth {
|
||||||
|
|||||||
20
LogisticsSupportTool_API_DOCS/LstV2/EOM/Get Inv.bru
Normal file
20
LogisticsSupportTool_API_DOCS/LstV2/EOM/Get Inv.bru
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
meta {
|
||||||
|
name: Get Inv
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/old/api/eom/histinv?month=2025/11/1
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
month: 2025/11/1
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: Error logging
|
||||||
|
type: http
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{urlv2}}/api/notify/toomanyerrors
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: materialPerDay
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{urlv2}}/api/notify/materialperday
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: ti Intergration
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{urlv2}}/api/notify/tiTrigger
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
25
LogisticsSupportTool_API_DOCS/LstV2/Quality/Add pallet.bru
Normal file
25
LogisticsSupportTool_API_DOCS/LstV2/Quality/Add pallet.bru
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
meta {
|
||||||
|
name: Add pallet
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/old/api/quality/newrequest
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"username": "matthes01",
|
||||||
|
"runningNr": 618302,
|
||||||
|
"palletStatusText":"return" // returned will be the only allowed key
|
||||||
|
//"moveTo": "hold area" //hold area, rework, inspection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
16
LogisticsSupportTool_API_DOCS/LstV2/Quality/Get Pallets.bru
Normal file
16
LogisticsSupportTool_API_DOCS/LstV2/Quality/Get Pallets.bru
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: Get Pallets
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/old/api/quality/getrequest
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
8
LogisticsSupportTool_API_DOCS/LstV2/Quality/folder.bru
Normal file
8
LogisticsSupportTool_API_DOCS/LstV2/Quality/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: Quality
|
||||||
|
seq: 7
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
22
LogisticsSupportTool_API_DOCS/LstV2/Warehouse/sscc.bru
Normal file
22
LogisticsSupportTool_API_DOCS/LstV2/Warehouse/sscc.bru
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
meta {
|
||||||
|
name: sscc
|
||||||
|
type: http
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/old/api/logistics/getsscc
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"runningNr": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
meta {
|
||||||
|
name: PSI - Forecast data
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/old/api/datamart/psiforecastdata?customer=8
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
customer: 8
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
meta {
|
||||||
|
name: PSI -planning data
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/old/api/datamart/psiplanningdata?avs=118,120&startDate=12/1/2025&endDate=12/31/2026
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
avs: 118,120
|
||||||
|
startDate: 12/1/2025
|
||||||
|
endDate: 12/31/2026
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
8
LogisticsSupportTool_API_DOCS/LstV2/datamart/folder.bru
Normal file
8
LogisticsSupportTool_API_DOCS/LstV2/datamart/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: datamart
|
||||||
|
seq: 8
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
meta {
|
meta {
|
||||||
name: LstV2
|
name: LstV2
|
||||||
seq: 3
|
seq: 4
|
||||||
}
|
}
|
||||||
|
|
||||||
auth {
|
auth {
|
||||||
|
|||||||
26
LogisticsSupportTool_API_DOCS/LstV2/ocp/Logs.bru
Normal file
26
LogisticsSupportTool_API_DOCS/LstV2/ocp/Logs.bru
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
meta {
|
||||||
|
name: Logs
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/old/api/logger/logs?service=ocp&service=rfid&service=dyco&level=error&level=info&level=warn&hours=12
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
service: ocp
|
||||||
|
service: rfid
|
||||||
|
service: dyco
|
||||||
|
level: error
|
||||||
|
level: info
|
||||||
|
level: warn
|
||||||
|
hours: 12
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -5,17 +5,16 @@ meta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
url: {{url}}/lst/api/admin/users
|
url: {{url}}/lst/api/admin/users/new
|
||||||
body: none
|
body: json
|
||||||
auth: inherit
|
auth: inherit
|
||||||
}
|
}
|
||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
{
|
{
|
||||||
"username":"matthes01",
|
"username":"hardin001",
|
||||||
"name":"blake",
|
"email":"ryan.hardin@alpla.com",
|
||||||
"email":"blake.matthes@alpla.com",
|
"password":"Alpla2025!"
|
||||||
"password":"nova0511"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
LogisticsSupportTool_API_DOCS/app/admin/User/Get roles.bru
Normal file
23
LogisticsSupportTool_API_DOCS/app/admin/User/Get roles.bru
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
meta {
|
||||||
|
name: Get roles
|
||||||
|
type: http
|
||||||
|
seq: 7
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/user/roles
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"module":"siloAdjustments",
|
||||||
|
"role":"viewer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -16,16 +16,17 @@ headers {
|
|||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
{
|
{
|
||||||
"name": "Bowling Green 2",
|
"name": "St Peters",
|
||||||
"serverDNS": "USBOW2VMS006",
|
"serverDNS": "USSTP1VMS006",
|
||||||
"plantToken": "usbow2",
|
"plantToken": "usstp1",
|
||||||
"ipAddress": "10.30.0.26",
|
"ipAddress": "10.37.0.26",
|
||||||
"greatPlainsPlantCode": 0,
|
"greatPlainsPlantCode": 45,
|
||||||
"lstServerPort": 4000,
|
"lstServerPort": 4000,
|
||||||
"serverLoc": "E$\\LST"
|
"serverLoc": "E:\\LST"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
settings {
|
settings {
|
||||||
encodeUrl: true
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ post {
|
|||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
{
|
{
|
||||||
"username": "cowch",
|
"username": "matthes01",
|
||||||
"password": "Alpla2025!"
|
"password": "nova0511"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
meta {
|
meta {
|
||||||
name: app
|
name: app
|
||||||
seq: 2
|
seq: 3
|
||||||
}
|
}
|
||||||
|
|
||||||
auth {
|
auth {
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
meta {
|
||||||
|
name: Get Invoices
|
||||||
|
type: http
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/forklifts/invoices
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"name":"Delage DLL"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
meta {
|
||||||
|
name: Update lease
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
patch {
|
||||||
|
url: {{url}}/lst/api/forklifts/invoices/:id
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:path {
|
||||||
|
id: de10c8ee-5756-4efb-9664-3c55338b2b60
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
|
||||||
|
"companyId": "b34c6684-ec35-4364-acef-0c1570faf123"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
meta {
|
||||||
|
name: add lease
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/api/forklifts/invoices
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"leaseId": "0147d082-aee0-4594-b0f4-c6f4ee777e92",
|
||||||
|
"invoiceNumber": "592596987",
|
||||||
|
"invoiceDate": "10/12/2025",
|
||||||
|
"uploadedBy": "matthes01",
|
||||||
|
"totalAmount": "1820.88",
|
||||||
|
"forklifts": [
|
||||||
|
{ "forklift_Id": "ec2f3759-1580-4c1b-8fbf-8a4b0b506758", "amount": 909.91 }
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: Invoices
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
meta {
|
||||||
|
name: Get Companies
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/forklifts/companies
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"name":"Delage DLL"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
meta {
|
||||||
|
name: Update Company
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
patch {
|
||||||
|
url: {{url}}/lst/api/forklifts/companies/:id
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:path {
|
||||||
|
id: fbfba3df-8c0f-4994-adae-c03808cbccdc
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"name":"Delage DLL",
|
||||||
|
"active": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
meta {
|
||||||
|
name: add company
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/api/forklifts/companies
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"name":"Delage DLL"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: companies
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
8
LogisticsSupportTool_API_DOCS/app/forklifts/folder.bru
Normal file
8
LogisticsSupportTool_API_DOCS/app/forklifts/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: forklifts
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
meta {
|
||||||
|
name: Get forklift
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/forklifts
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"name":"Delage DLL"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
meta {
|
||||||
|
name: Update forklfit
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
patch {
|
||||||
|
url: {{url}}/lst/api/forklifts/:id
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:path {
|
||||||
|
id: ec2f3759-1580-4c1b-8fbf-8a4b0b506758
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
|
||||||
|
"glCode": 31
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
meta {
|
||||||
|
name: add forklift
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/api/forklifts
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"serialNumber":"FN682004",
|
||||||
|
"model": "EFG220",
|
||||||
|
"plant": "Iowa City ISBM",
|
||||||
|
"glCode": 31,
|
||||||
|
"profitCenter": 30,
|
||||||
|
"manufacturer":"Jungheinrich",
|
||||||
|
"manufacturerYear":"2022",
|
||||||
|
"engine":"electric",
|
||||||
|
"batteryType":"lead acid",
|
||||||
|
"leaseId":"0147d082-aee0-4594-b0f4-c6f4ee777e92"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: forklifts
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
meta {
|
||||||
|
name: Get lease
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/forklifts/leases?companyId=b34c6684-ec35-4364-acef-0c1570faf123
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
companyId: b34c6684-ec35-4364-acef-0c1570faf123
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"name":"Delage DLL"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
meta {
|
||||||
|
name: Update lease
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
patch {
|
||||||
|
url: {{url}}/lst/api/forklifts/leases/:id
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:path {
|
||||||
|
id: de10c8ee-5756-4efb-9664-3c55338b2b60
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
|
||||||
|
"companyId": "b34c6684-ec35-4364-acef-0c1570faf123"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
meta {
|
||||||
|
name: add lease
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/api/forklifts/leases
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"leaseNumber":"40829107-1",
|
||||||
|
"startDate": "11/08/2023",
|
||||||
|
"endDate": "11/12/2025",
|
||||||
|
"companyId": "59c4eaa3-55db-4348-a033-f2fcd91a91d1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: lease
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
meta {
|
||||||
|
name: Consume
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/old/api/logistics/consume
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"lotNum":283559,
|
||||||
|
"runningNr":19302907
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: Consume
|
||||||
|
seq: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
meta {
|
||||||
|
name: RFID Trigger
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/old/api/rfid/manualtrigger/wrapper1
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: RFID
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: demandmgt
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: get forecast data
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/logistics/dm/forecastData
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -13,12 +13,12 @@ post {
|
|||||||
body:json {
|
body:json {
|
||||||
{
|
{
|
||||||
"scannerId": 999,
|
"scannerId": 999,
|
||||||
"lotNr": 3314,
|
"lotNr": 26656,
|
||||||
"machineId": 22, // 457=22, 458=23
|
"machineId": 5, // 457=22, 458=23
|
||||||
"printerId": 22, // 457=22, 458=23
|
"printerId": 7, // 457=22, 458=23
|
||||||
"layoutId": 7,
|
"layoutId": 22,
|
||||||
"numberOfCopies": 0,
|
"numberOfCopies": 1,
|
||||||
"qtyToPrint": 1
|
"qtyToPrint":0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: SSCC
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/logistics/getsscc
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: ForecastData
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/api/logistics/dm/forecastData
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: All Server Stats
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/system/allservers/stats
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
20
LogisticsSupportTool_API_DOCS/app/system/Update Setting.bru
Normal file
20
LogisticsSupportTool_API_DOCS/app/system/Update Setting.bru
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
meta {
|
||||||
|
name: Update Setting
|
||||||
|
type: http
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/api/system/settings/:token
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:path {
|
||||||
|
token: test3
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: GetModules
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/system/modules
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
meta {
|
||||||
|
name: Update Modules
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
patch {
|
||||||
|
url: {{url}}/lst/api/system/modules/update/:module
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:path {
|
||||||
|
module: materialHelper
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"active": true,
|
||||||
|
"updateAll": true
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: modules
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "1",
|
"version": "1",
|
||||||
"name": "LogisticsSupportTool_API_DOCS",
|
"name": "lstv2",
|
||||||
"type": "collection",
|
"type": "collection",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
vars {
|
vars {
|
||||||
url: http://localhost:4200
|
url: http://localhost:5500
|
||||||
session_cookie:
|
session_cookie:
|
||||||
urlv2: http://localhost:3000
|
urlv2: http://usbow1vms006:3000
|
||||||
jwtV2:
|
jwtV2:
|
||||||
userID:
|
userID:
|
||||||
}
|
}
|
||||||
|
|||||||
24
LogisticsSupportTool_API_DOCS/logistics/bookout.bru
Normal file
24
LogisticsSupportTool_API_DOCS/logistics/bookout.bru
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
meta {
|
||||||
|
name: bookout
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/old/api/logistics/bookout
|
||||||
|
body: json
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
|
||||||
|
"runningNr": "1865027",
|
||||||
|
"reason": "packer printed premature"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
8
LogisticsSupportTool_API_DOCS/logistics/folder.bru
Normal file
8
LogisticsSupportTool_API_DOCS/logistics/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: logistics
|
||||||
|
seq: 7
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
24
LogisticsSupportTool_API_DOCS/logistics/relocate.bru
Normal file
24
LogisticsSupportTool_API_DOCS/logistics/relocate.bru
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
meta {
|
||||||
|
name: relocate
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/old/api/logistics/relocate
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
|
||||||
|
"runningNr": "56121541",
|
||||||
|
"laneID": "30006"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
24
LogisticsSupportTool_API_DOCS/logistics/removeAsWaste.bru
Normal file
24
LogisticsSupportTool_API_DOCS/logistics/removeAsWaste.bru
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
meta {
|
||||||
|
name: removeAsWaste
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/lst/old/api/logistics/removeasreusable
|
||||||
|
body: json
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
|
||||||
|
"runningNr": "1865018",
|
||||||
|
"reason": "validating stockout"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
8
LogisticsSupportTool_API_DOCS/mobile/folder.bru
Normal file
8
LogisticsSupportTool_API_DOCS/mobile/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: mobile
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
20
LogisticsSupportTool_API_DOCS/mobile/getsession.bru
Normal file
20
LogisticsSupportTool_API_DOCS/mobile/getsession.bru
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
meta {
|
||||||
|
name: getsession
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/user/me
|
||||||
|
body: none
|
||||||
|
auth: bearer
|
||||||
|
}
|
||||||
|
|
||||||
|
auth:bearer {
|
||||||
|
token: jpHHbLNGJRpUMvfrVOYmhbJL2Ux0arse
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
15
LogisticsSupportTool_API_DOCS/mobile/ota system check.bru
Normal file
15
LogisticsSupportTool_API_DOCS/mobile/ota system check.bru
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
meta {
|
||||||
|
name: ota system check
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/lst/api/mobile
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
}
|
||||||
20
LogisticsSupportTool_API_DOCS/mobile/otacheck.bru
Normal file
20
LogisticsSupportTool_API_DOCS/mobile/otacheck.bru
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
meta {
|
||||||
|
name: otacheck
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: http://10.193.0.56:4000/api/mobile/updates
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
expo-runtime-version: 1.0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
8
LogisticsSupportTool_API_DOCS/v3endpoints/folder.bru
Normal file
8
LogisticsSupportTool_API_DOCS/v3endpoints/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: v3endpoints
|
||||||
|
seq: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
16
LogisticsSupportTool_API_DOCS/v3endpoints/tester.bru
Normal file
16
LogisticsSupportTool_API_DOCS/v3endpoints/tester.bru
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: tester
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: http://localhost:3000/lst/api/system/prodsql/start
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
50
app/main.ts
50
app/main.ts
@@ -4,15 +4,23 @@ import { toNodeHandler } from "better-auth/node";
|
|||||||
import cors from "cors";
|
import cors from "cors";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import { createServer } from "http";
|
import { createServer } from "http";
|
||||||
import { createProxyMiddleware, fixRequestBody } from "http-proxy-middleware";
|
import { createProxyMiddleware } from "http-proxy-middleware";
|
||||||
import morgan from "morgan";
|
import morgan from "morgan";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import { dirname, join } from "path";
|
import { dirname, join } from "path";
|
||||||
|
import swaggerJsdoc from "swagger-jsdoc";
|
||||||
|
import swaggerUi from "swagger-ui-express";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import { schedulerManager } from "./src/internal/logistics/controller/schedulerManager.js";
|
import { schedulerManager } from "./src/internal/logistics/controller/schedulerManager.js";
|
||||||
|
import { setupMobileRoutes } from "./src/internal/mobile/route.js";
|
||||||
import { printers } from "./src/internal/ocp/printers/printers.js";
|
import { printers } from "./src/internal/ocp/printers/printers.js";
|
||||||
import { setupRoutes } from "./src/internal/routerHandler/routeHandler.js";
|
import { setupRoutes } from "./src/internal/routerHandler/routeHandler.js";
|
||||||
|
import { baseModules } from "./src/internal/system/controller/modules/baseModules.js";
|
||||||
import { baseSettings } from "./src/internal/system/controller/settings/baseSettings.js";
|
import { baseSettings } from "./src/internal/system/controller/settings/baseSettings.js";
|
||||||
|
import {
|
||||||
|
addListeners,
|
||||||
|
manualFixes,
|
||||||
|
} from "./src/internal/system/utlis/addListeners.js";
|
||||||
import { auth } from "./src/pkg/auth/auth.js";
|
import { auth } from "./src/pkg/auth/auth.js";
|
||||||
import { db } from "./src/pkg/db/db.js";
|
import { db } from "./src/pkg/db/db.js";
|
||||||
import { settings } from "./src/pkg/db/schema/settings.js";
|
import { settings } from "./src/pkg/db/schema/settings.js";
|
||||||
@@ -25,10 +33,13 @@ import { sendNotify } from "./src/pkg/utils/notify.js";
|
|||||||
import { returnFunc } from "./src/pkg/utils/return.js";
|
import { returnFunc } from "./src/pkg/utils/return.js";
|
||||||
import { tryCatch } from "./src/pkg/utils/tryCatch.js";
|
import { tryCatch } from "./src/pkg/utils/tryCatch.js";
|
||||||
import { setupIoServer } from "./src/ws/server.js";
|
import { setupIoServer } from "./src/ws/server.js";
|
||||||
|
import { swaggerConfig, swaggerUiOptions } from "./src/internal/swagger/config.js";
|
||||||
|
import { setupSwagger } from "./src/internal/swagger/swagger.js";
|
||||||
|
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
const env = validateEnv(process.env);
|
const env = validateEnv(process.env);
|
||||||
const PORT = Number(env.VITE_PORT) || 4200;
|
const PORT = Number(process.env.VITE_PORT) || 4200;
|
||||||
|
|
||||||
//create the logger
|
//create the logger
|
||||||
const log = createLogger({ module: "system", subModule: "main start" });
|
const log = createLogger({ module: "system", subModule: "main start" });
|
||||||
@@ -66,7 +77,8 @@ const main = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// connect to the prod sql
|
// connect to the prod sql
|
||||||
await initializeProdPool();
|
console.log("Connecting to the sql server");
|
||||||
|
|
||||||
|
|
||||||
// express app
|
// express app
|
||||||
const app = express();
|
const app = express();
|
||||||
@@ -116,6 +128,7 @@ const main = async () => {
|
|||||||
"http://localhost:3001",
|
"http://localhost:3001",
|
||||||
"http://localhost:4000",
|
"http://localhost:4000",
|
||||||
"http://localhost:4001",
|
"http://localhost:4001",
|
||||||
|
"http://localhost:5500",
|
||||||
env.BETTER_AUTH_URL, // prod
|
env.BETTER_AUTH_URL, // prod
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -146,17 +159,33 @@ const main = async () => {
|
|||||||
},
|
},
|
||||||
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
|
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
|
||||||
credentials: true,
|
credentials: true,
|
||||||
exposedHeaders: ["set-cookie"],
|
exposedHeaders: [
|
||||||
|
"set-cookie",
|
||||||
|
"expo-protocol-version",
|
||||||
|
"expo-sfv-version",
|
||||||
|
],
|
||||||
allowedHeaders: [
|
allowedHeaders: [
|
||||||
"Content-Type",
|
"Content-Type",
|
||||||
"Authorization",
|
"Authorization",
|
||||||
"X-Requested-With",
|
"X-Requested-With",
|
||||||
"XMLHttpRequest",
|
"XMLHttpRequest",
|
||||||
|
"expo-runtime-version",
|
||||||
|
"expo-platform",
|
||||||
|
"expo-channel-name",
|
||||||
|
"*",
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// docs and api stuff
|
// docs and routes
|
||||||
|
// const openapiSpec: any = swaggerJsdoc(swaggerConfig);
|
||||||
|
// app.use(
|
||||||
|
// basePath + "/api/docs",
|
||||||
|
// swaggerUi.serve,
|
||||||
|
// swaggerUi.setup(openapiSpec, swaggerUiOptions),
|
||||||
|
// );
|
||||||
|
initializeProdPool();
|
||||||
|
setupSwagger(app, basePath)
|
||||||
app.use(basePath + "/d", express.static(join(__dirname, "../lstDocs/build")));
|
app.use(basePath + "/d", express.static(join(__dirname, "../lstDocs/build")));
|
||||||
app.use(
|
app.use(
|
||||||
basePath + "/app",
|
basePath + "/app",
|
||||||
@@ -183,13 +212,24 @@ const main = async () => {
|
|||||||
// start all systems after we are intiallally up and running
|
// start all systems after we are intiallally up and running
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
baseSettings();
|
baseSettings();
|
||||||
|
baseModules();
|
||||||
printers();
|
printers();
|
||||||
schedulerManager();
|
schedulerManager();
|
||||||
|
|
||||||
// start up the v1listener
|
// start up the v1listener
|
||||||
v1Listener();
|
v1Listener();
|
||||||
|
addListeners();
|
||||||
|
//userMigrate();
|
||||||
|
// some temp fixes
|
||||||
|
// above 235 remove these
|
||||||
|
manualFixes();
|
||||||
|
//settingsMigrate();
|
||||||
}, 5 * 1000);
|
}, 5 * 1000);
|
||||||
|
|
||||||
|
// setTimeout(() => {
|
||||||
|
// startHonoServer();
|
||||||
|
// }, 8 * 1000);
|
||||||
|
|
||||||
// start the server up
|
// start the server up
|
||||||
server.listen(PORT, "0.0.0.0", () =>
|
server.listen(PORT, "0.0.0.0", () =>
|
||||||
log.info(
|
log.info(
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
|
import { requireAuth } from "../../../../pkg/middleware/authMiddleware.js";
|
||||||
|
import { restrictToHosts } from "../../../../pkg/middleware/restrictToHosts.js";
|
||||||
import addServer from "./addServer.js";
|
import addServer from "./addServer.js";
|
||||||
import getServers from "./getServers.js";
|
import getServers from "./getServers.js";
|
||||||
import updateServer from "./updateServer.js";
|
import updateServer from "./updateServer.js";
|
||||||
import { restrictToHosts } from "../../../../pkg/middleware/restrictToHosts.js";
|
|
||||||
import { requireAuth } from "../../../../pkg/middleware/authMiddleware.js";
|
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
@@ -12,21 +12,23 @@ router.use(
|
|||||||
"/",
|
"/",
|
||||||
requireAuth("user", ["systemAdmin", "admin"]),
|
requireAuth("user", ["systemAdmin", "admin"]),
|
||||||
restrictToHosts([
|
restrictToHosts([
|
||||||
|
"localhost:5500",
|
||||||
"usmcd1vms036.alpla.net",
|
"usmcd1vms036.alpla.net",
|
||||||
"USMCD1VMS036.alpla.net",
|
"USMCD1VMS036.alpla.net",
|
||||||
"https://usmcd1vms036.alpla.net",
|
"https://usmcd1vms036.alpla.net",
|
||||||
]),
|
]),
|
||||||
addServer
|
addServer,
|
||||||
);
|
);
|
||||||
router.use(
|
router.use(
|
||||||
"/",
|
"/",
|
||||||
requireAuth("user", ["systemAdmin", "admin"]),
|
requireAuth("user", ["systemAdmin", "admin"]),
|
||||||
restrictToHosts([
|
restrictToHosts([
|
||||||
|
"localhost:5500",
|
||||||
"usmcd1vms036.alpla.net",
|
"usmcd1vms036.alpla.net",
|
||||||
"USMCD1VMS036.alpla.net",
|
"USMCD1VMS036.alpla.net",
|
||||||
"https://usmcd1vms036.alpla.net",
|
"https://usmcd1vms036.alpla.net",
|
||||||
]),
|
]),
|
||||||
updateServer
|
updateServer,
|
||||||
);
|
);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
@@ -3,22 +3,12 @@ import { auth } from "../../../../pkg/auth/auth.js";
|
|||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.patch("/:userId", async (req: Request, res: Response) => {
|
router.get("/:userId", async (req: Request, res: Response) => {
|
||||||
const userId = req.params.userId;
|
const userId = req.params.userId;
|
||||||
const cookieHeader = req.headers.cookie ?? "";
|
const cookieHeader = req.headers.cookie ?? "";
|
||||||
const authorization = req.headers.authorization ?? "";
|
const authorization = req.headers.authorization ?? "";
|
||||||
|
|
||||||
const data = await auth.api.setUserPassword({
|
//session stuff
|
||||||
body: {
|
|
||||||
newPassword: req.body.password, // required
|
|
||||||
userId: userId, // required
|
|
||||||
},
|
|
||||||
// This endpoint requires session cookies.
|
|
||||||
headers: {
|
|
||||||
cookie: cookieHeader,
|
|
||||||
authorization,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return res.status(200).json({ message: "Password was just changed." });
|
return res.status(200).json({ message: "Password was just changed." });
|
||||||
});
|
});
|
||||||
|
|||||||
34
app/src/internal/auth/controller/userMigrate.ts
Normal file
34
app/src/internal/auth/controller/userMigrate.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import { Client } from "pg";
|
||||||
|
import { auth } from "../../../pkg/auth/auth.js";
|
||||||
|
import { createLogger } from "../../../pkg/logger/logger.js";
|
||||||
|
|
||||||
|
export const userMigrate = async () => {
|
||||||
|
const log = createLogger({ module: "admin", subModule: "migrate users" });
|
||||||
|
const client = new Client({
|
||||||
|
connectionString: process.env.DATABASE_URL_V1,
|
||||||
|
});
|
||||||
|
|
||||||
|
await client.connect();
|
||||||
|
|
||||||
|
const res = await client.query(`
|
||||||
|
SELECT username, email
|
||||||
|
FROM users
|
||||||
|
`);
|
||||||
|
|
||||||
|
for (const u of res.rows) {
|
||||||
|
log.info({}, `${u.username}, being transferred`);
|
||||||
|
try {
|
||||||
|
await auth.api.signUpEmail({
|
||||||
|
body: {
|
||||||
|
username: u.username,
|
||||||
|
name: u.username,
|
||||||
|
email: u.email,
|
||||||
|
password: "Alpla2025!",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
log.info({}, `${u.username}, transferred`);
|
||||||
|
} catch (e) {
|
||||||
|
log.info({}, `${u.username}, already existed`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -24,6 +24,13 @@ router.post("/", async (req: Request, res: Response) => {
|
|||||||
.from(user)
|
.from(user)
|
||||||
.where(eq(user.username, validated.username));
|
.where(eq(user.username, validated.username));
|
||||||
|
|
||||||
|
if(userLogin.length === 0 ){
|
||||||
|
return res.status(200).json({
|
||||||
|
success: false,
|
||||||
|
message: `It appears you do not have a user yet please head over to the register page and create a user then try again.`,
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
!userLogin[0].lastLogin ||
|
!userLogin[0].lastLogin ||
|
||||||
differenceInDays(userLogin[0].lastLogin, new Date(Date.now())) > 120
|
differenceInDays(userLogin[0].lastLogin, new Date(Date.now())) > 120
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const registerSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.min(3)
|
.min(3)
|
||||||
.max(32)
|
.max(32)
|
||||||
.regex(/^[a-zA-Z0-9_]+$/, "Only alphanumeric + underscores"),
|
.regex(/^[a-zA-Z0-9._]+$/, "Only alphanumeric + dots allowed"),
|
||||||
displayUsername: z.string().min(2).max(100).optional(), // optional in your API, but supported
|
displayUsername: z.string().min(2).max(100).optional(), // optional in your API, but supported
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -42,8 +42,12 @@ router.post("/", async (req: Request, res: Response) => {
|
|||||||
.update(user)
|
.update(user)
|
||||||
.set({ lastLogin: sql`NOW()` })
|
.set({ lastLogin: sql`NOW()` })
|
||||||
.where(eq(user.id, newUser.user.id));
|
.where(eq(user.id, newUser.user.id));
|
||||||
return res.status(201).json(user);
|
|
||||||
|
return res
|
||||||
|
.status(201)
|
||||||
|
.json({ success: true, message: "User created", data: newUser });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
if (err instanceof z.ZodError) {
|
if (err instanceof z.ZodError) {
|
||||||
const flattened = z.flattenError(err);
|
const flattened = z.flattenError(err);
|
||||||
return res.status(400).json({
|
return res.status(400).json({
|
||||||
@@ -53,12 +57,18 @@ router.post("/", async (req: Request, res: Response) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (err instanceof APIError) {
|
if (err instanceof APIError) {
|
||||||
return res.status(400).json({
|
return res.status(200).json({
|
||||||
success: false,
|
success: false,
|
||||||
message: err.message,
|
message: err.message,
|
||||||
error: err.status,
|
error: err.status,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return res.status(200).json({
|
||||||
|
success: false,
|
||||||
|
message: "There was an error creating your user.",
|
||||||
|
error: err,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
89
app/src/internal/datamart/routes/getActiveAv.ts
Normal file
89
app/src/internal/datamart/routes/getActiveAv.ts
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import { Router, type Request, type Response } from "express";
|
||||||
|
import { prodQuery } from "../../../pkg/prodSql/prodQuery.js";
|
||||||
|
import { tryCatch } from "../../../pkg/utils/tryCatch.js";
|
||||||
|
import { db } from "../../../pkg/db/db.js";
|
||||||
|
import { settings } from "../../../pkg/db/schema/settings.js";
|
||||||
|
import { eq } from "drizzle-orm";
|
||||||
|
import { activeArticle } from "../../../pkg/prodSql/querys/datamart/article.js";
|
||||||
|
|
||||||
|
type Articles = {
|
||||||
|
article: string
|
||||||
|
description: string
|
||||||
|
articleType: string
|
||||||
|
pricePoint:string
|
||||||
|
salesPrice:string
|
||||||
|
typeOfMaterial:string
|
||||||
|
articleIdType:string
|
||||||
|
articleWeight:string
|
||||||
|
idAddress:string
|
||||||
|
addressDescription:string
|
||||||
|
addressType:string
|
||||||
|
profitCenter:String
|
||||||
|
fg: string
|
||||||
|
num_of_cycles:string
|
||||||
|
costsCenterId:string
|
||||||
|
costCenterDescription:string
|
||||||
|
customerArticleNumber:string
|
||||||
|
customerArticleDescription:String
|
||||||
|
cycleTime:string
|
||||||
|
salesAgreement:string
|
||||||
|
productFamily:string
|
||||||
|
uom:string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
// GET /health
|
||||||
|
router.get("/", async (req: Request, res: Response) => {
|
||||||
|
|
||||||
|
const includePlantToken = req.params.includePlantToken
|
||||||
|
|
||||||
|
let articles:Articles[] = [];
|
||||||
|
try {
|
||||||
|
const res = await prodQuery(activeArticle, "Get active articles");
|
||||||
|
articles = res?.data;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message:"Error getting articles",
|
||||||
|
error: error
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (includePlantToken) {
|
||||||
|
const { data, error } = await tryCatch(db.select().from(settings).where(eq(settings.name, "plantToken")))
|
||||||
|
if (error) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message:"Error getting settings",
|
||||||
|
error: error
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// return articles.map((n) => {
|
||||||
|
// return {
|
||||||
|
// success: true,
|
||||||
|
// message: "Active articles including plant token",
|
||||||
|
// data:{ plantToken: data[0].value, ...n }};
|
||||||
|
// });
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
message: "Active articles including plant token",
|
||||||
|
data: articles.map((n) => {
|
||||||
|
return { plantToken: data[0].value, ...n }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
message: "Active articles including plant token",
|
||||||
|
data:articles};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
10
app/src/internal/datamart/routes/routes.ts
Normal file
10
app/src/internal/datamart/routes/routes.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import type { Express, Request, Response } from "express";
|
||||||
|
|
||||||
|
//datamart Routes
|
||||||
|
import getActiveAv from './getActiveAv.js'
|
||||||
|
export const setupDataMartRoutes = (app: Express, basePath: string) => {
|
||||||
|
const route = basePath + "/api/datamart"
|
||||||
|
app.use(route + '/activeArticle', getActiveAv);
|
||||||
|
//app.use(basePath + "/api/user/me", requireAuth(), me);
|
||||||
|
|
||||||
|
};
|
||||||
114
app/src/internal/forklifts/routes/companies/addCompany.ts
Normal file
114
app/src/internal/forklifts/routes/companies/addCompany.ts
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { type DrizzleError, sql } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import https from "https";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import {
|
||||||
|
forkliftCompanies,
|
||||||
|
insertForkliftCompanySchema,
|
||||||
|
} from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { createLogger } from "../../../../pkg/logger/logger.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.post("/", async (req: Request, res: Response) => {
|
||||||
|
// when a new server is posted from localhost or 127.0.0.1 we also want to post it to the test server so we can see it from there
|
||||||
|
//res.status(200).json({ message: "Server added", ip: req.hostname });
|
||||||
|
const log = createLogger({ module: "forklift", subModule: "add company" });
|
||||||
|
const parsed = insertForkliftCompanySchema.safeParse(req.body);
|
||||||
|
|
||||||
|
if (!parsed.success) {
|
||||||
|
return res.status(400).json({ errors: parsed.error.flatten() });
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
db
|
||||||
|
.insert(forkliftCompanies)
|
||||||
|
.values({
|
||||||
|
...parsed.data,
|
||||||
|
add_user: req.user?.username,
|
||||||
|
add_date: sql`NOW()`,
|
||||||
|
upd_user: req.user?.username,
|
||||||
|
upd_date: sql`NOW()`,
|
||||||
|
})
|
||||||
|
.onConflictDoUpdate({
|
||||||
|
target: forkliftCompanies.name,
|
||||||
|
set: {
|
||||||
|
...parsed.data,
|
||||||
|
add_user: req.user?.username,
|
||||||
|
add_date: sql`NOW()`,
|
||||||
|
upd_user: req.user?.username,
|
||||||
|
upd_date: sql`NOW()`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.returning({
|
||||||
|
name: forkliftCompanies.name,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
const err: DrizzleError = error;
|
||||||
|
return res.status(400).json({
|
||||||
|
message: `Error adding the server`,
|
||||||
|
error: err.cause,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.hostname === "localhost" && process.env.MAIN_SERVER) {
|
||||||
|
log.info({}, "Running in dev server about to add in a new server");
|
||||||
|
const axiosInstance = axios.create({
|
||||||
|
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
baseURL: process.env.MAIN_SERVER, // e.g. "https://example.com"
|
||||||
|
withCredentials: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const loginRes = (await axiosInstance.post(
|
||||||
|
`${process.env.MAIN_SERVER}/lst/api/auth/sign-in/username`,
|
||||||
|
{
|
||||||
|
username: process.env.MAIN_SERVER_USERNAME,
|
||||||
|
password: process.env.MAIN_SERVER_PASSWORD,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
},
|
||||||
|
)) as any;
|
||||||
|
const setCookie = loginRes.headers["set-cookie"][0];
|
||||||
|
|
||||||
|
if (!setCookie) {
|
||||||
|
throw new Error("Did not receive a Set-Cookie header from login");
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
axios.post(
|
||||||
|
`${process.env.MAIN_SERVER}/lst/api/forklifts/companies`,
|
||||||
|
parsed.data,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Cookie: setCookie.split(";")[0],
|
||||||
|
},
|
||||||
|
withCredentials: true,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
log.error(
|
||||||
|
{ stack: error },
|
||||||
|
"There was an error adding the company to Main Server",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
log.info(
|
||||||
|
{ stack: data?.data },
|
||||||
|
"A new Company was just added to the server.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
.status(201)
|
||||||
|
.json({ message: `Server ${data[0]?.name} added`, data: data });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import { requireAuth } from "../../../../pkg/middleware/authMiddleware.js";
|
||||||
|
import { restrictToHosts } from "../../../../pkg/middleware/restrictToHosts.js";
|
||||||
|
import addCompany from "./addCompany.js";
|
||||||
|
import getCompanies from "./getCompanies.js";
|
||||||
|
import updateCompany from "./updateServer.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin"]),
|
||||||
|
getCompanies,
|
||||||
|
);
|
||||||
|
router.use("/", requireAuth("forklifts", ["systemAdmin", "admin"]), addCompany);
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin"]),
|
||||||
|
updateCompany,
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
||||||
35
app/src/internal/forklifts/routes/companies/getCompanies.ts
Normal file
35
app/src/internal/forklifts/routes/companies/getCompanies.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { and, asc, eq } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import { forkliftCompanies } from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get("/", async (req: Request, res: Response) => {
|
||||||
|
const name = req.query.name;
|
||||||
|
|
||||||
|
const conditions = [];
|
||||||
|
|
||||||
|
if (name !== undefined) {
|
||||||
|
conditions.push(eq(forkliftCompanies.name, `${name}`));
|
||||||
|
}
|
||||||
|
|
||||||
|
//conditions.push(eq(forkliftCompanies.active, true));
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
db
|
||||||
|
.select()
|
||||||
|
.from(forkliftCompanies)
|
||||||
|
.where(and(...conditions))
|
||||||
|
.orderBy(asc(forkliftCompanies.name)),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return res.status(400).json({ error: error });
|
||||||
|
}
|
||||||
|
res.status(200).json({ message: "Current Active Companies", data: data });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
103
app/src/internal/forklifts/routes/companies/updateServer.ts
Normal file
103
app/src/internal/forklifts/routes/companies/updateServer.ts
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { eq, sql } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import https from "https";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import { forkliftCompanies } from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { serverData } from "../../../../pkg/db/schema/servers.js";
|
||||||
|
import { createLogger } from "../../../../pkg/logger/logger.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.patch("/:id", async (req: Request, res: Response) => {
|
||||||
|
const log = createLogger({
|
||||||
|
module: "forklifts",
|
||||||
|
subModule: "update company",
|
||||||
|
});
|
||||||
|
|
||||||
|
// when a server is updated and is posted from localhost or 127.0.0.1 we also want to post it to the test server so we can see it from there, we want to insert with update on conflict.
|
||||||
|
const id = req.params.id;
|
||||||
|
const updates: Record<string, any> = {};
|
||||||
|
console.log(req.body);
|
||||||
|
if (req.body?.name !== undefined) {
|
||||||
|
updates.name = req.body.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.active !== undefined) {
|
||||||
|
updates.active = req.body.active;
|
||||||
|
}
|
||||||
|
|
||||||
|
updates.upd_user = req.user!.username || "lst_user";
|
||||||
|
updates.upd_date = sql`NOW()`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (Object.keys(updates).length > 0) {
|
||||||
|
await db
|
||||||
|
.update(forkliftCompanies)
|
||||||
|
.set(updates)
|
||||||
|
.where(eq(forkliftCompanies.id, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.hostname === "localhost" && process.env.MAIN_SERVER) {
|
||||||
|
log.info({}, "Running in dev server about to add in a new server");
|
||||||
|
const axiosInstance = axios.create({
|
||||||
|
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
baseURL: process.env.MAIN_SERVER,
|
||||||
|
withCredentials: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const loginRes = (await axiosInstance.post(
|
||||||
|
`${process.env.MAIN_SERVER}/lst/api/auth/sign-in/username`,
|
||||||
|
{
|
||||||
|
username: process.env.MAIN_SERVER_USERNAME,
|
||||||
|
password: process.env.MAIN_SERVER_PASSWORD,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
},
|
||||||
|
)) as any;
|
||||||
|
|
||||||
|
const setCookie = loginRes?.headers["set-cookie"][0];
|
||||||
|
|
||||||
|
//console.log(setCookie.split(";")[0].replace("__Secure-", ""));
|
||||||
|
|
||||||
|
if (!setCookie) {
|
||||||
|
throw new Error("Did not receive a Set-Cookie header from login");
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
axios.patch(
|
||||||
|
`${process.env.MAIN_SERVER}/lst/api/forklifts/companies/${id}`,
|
||||||
|
updates,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Cookie: setCookie.split(";")[0],
|
||||||
|
},
|
||||||
|
withCredentials: true,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
//console.log(error);
|
||||||
|
log.error(
|
||||||
|
{ stack: error },
|
||||||
|
"There was an error updating the company to Main Server",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
log.info(
|
||||||
|
{ stack: data?.data },
|
||||||
|
"A new company was just updated to the server.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
res.status(200).json({ message: `${id} was just updated` });
|
||||||
|
} catch (error) {
|
||||||
|
//console.log(error);
|
||||||
|
res.status(200).json({ message: "Error Server updated", error });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
117
app/src/internal/forklifts/routes/forklifts/addForklift.ts
Normal file
117
app/src/internal/forklifts/routes/forklifts/addForklift.ts
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { type DrizzleError, sql } from "drizzle-orm";
|
||||||
|
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import https from "https";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
|
||||||
|
import {
|
||||||
|
forklifts,
|
||||||
|
newForkliftsSchema,
|
||||||
|
} from "../../../../pkg/db/schema/forklifts.js";
|
||||||
|
import { createLogger } from "../../../../pkg/logger/logger.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.post("/", async (req: Request, res: Response) => {
|
||||||
|
// when a new server is posted from localhost or 127.0.0.1 we also want to post it to the test server so we can see it from there
|
||||||
|
//res.status(200).json({ message: "Server added", ip: req.hostname });
|
||||||
|
const log = createLogger({ module: "forklift", subModule: "add forklift" });
|
||||||
|
const parsed = newForkliftsSchema.safeParse(req.body);
|
||||||
|
|
||||||
|
if (!parsed.success) {
|
||||||
|
return res.status(400).json({ errors: parsed.error.flatten() });
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
db
|
||||||
|
.insert(forklifts)
|
||||||
|
.values({
|
||||||
|
...parsed.data,
|
||||||
|
add_user: req.user?.username,
|
||||||
|
add_date: sql`NOW()`,
|
||||||
|
upd_user: req.user?.username,
|
||||||
|
upd_date: sql`NOW()`,
|
||||||
|
})
|
||||||
|
.onConflictDoUpdate({
|
||||||
|
target: forklifts.serialNumber,
|
||||||
|
set: {
|
||||||
|
...parsed.data,
|
||||||
|
add_user: req.user?.username,
|
||||||
|
add_date: sql`NOW()`,
|
||||||
|
upd_user: req.user?.username,
|
||||||
|
upd_date: sql`NOW()`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.returning({
|
||||||
|
serialNumber: forklifts.serialNumber,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
console.log(error);
|
||||||
|
const err: DrizzleError = error;
|
||||||
|
return res.status(400).json({
|
||||||
|
message: `Error adding forklift`,
|
||||||
|
error: err.cause,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (req.hostname === "localhost" && process.env.MAIN_SERVER) {
|
||||||
|
// log.info({}, "Running in dev server about to add in a new server");
|
||||||
|
// const axiosInstance = axios.create({
|
||||||
|
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
// baseURL: process.env.MAIN_SERVER, // e.g. "https://example.com"
|
||||||
|
// withCredentials: true,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const loginRes = (await axiosInstance.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/auth/sign-in/username`,
|
||||||
|
// {
|
||||||
|
// username: process.env.MAIN_SERVER_USERNAME,
|
||||||
|
// password: process.env.MAIN_SERVER_PASSWORD,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// headers: { "Content-Type": "application/json" },
|
||||||
|
// },
|
||||||
|
// )) as any;
|
||||||
|
// const setCookie = loginRes.headers["set-cookie"][0];
|
||||||
|
|
||||||
|
// if (!setCookie) {
|
||||||
|
// throw new Error("Did not receive a Set-Cookie header from login");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const { data, error } = await tryCatch(
|
||||||
|
// axios.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/forklifts/companies`,
|
||||||
|
// parsed.data,
|
||||||
|
// {
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// Cookie: setCookie.split(";")[0],
|
||||||
|
// },
|
||||||
|
// withCredentials: true,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (error) {
|
||||||
|
// log.error(
|
||||||
|
// { stack: error },
|
||||||
|
// "There was an error adding the company to Main Server",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// log.info(
|
||||||
|
// { stack: data?.data },
|
||||||
|
// "A new Company was just added to the server.",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
return res
|
||||||
|
.status(201)
|
||||||
|
.json({ message: `Forklift ${data[0]?.serialNumber} added`, data: data });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import { requireAuth } from "../../../../pkg/middleware/authMiddleware.js";
|
||||||
|
|
||||||
|
import addForklift from "./addForklift.js";
|
||||||
|
import getForklifts from "./getForklifts.js";
|
||||||
|
import updateForklift from "./updateForklift.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin", "manager", "supervisor"]),
|
||||||
|
getForklifts,
|
||||||
|
);
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin"]),
|
||||||
|
addForklift,
|
||||||
|
);
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin"]),
|
||||||
|
updateForklift,
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
||||||
38
app/src/internal/forklifts/routes/forklifts/getForklifts.ts
Normal file
38
app/src/internal/forklifts/routes/forklifts/getForklifts.ts
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import { and, asc, eq } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import { forkliftCompanies } from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { leases } from "../../../../pkg/db/schema/forkliftLeases.js";
|
||||||
|
import { forklifts } from "../../../../pkg/db/schema/forklifts.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get("/", async (req: Request, res: Response) => {
|
||||||
|
const plant = req.query.plant;
|
||||||
|
|
||||||
|
const conditions = [];
|
||||||
|
|
||||||
|
if (plant !== undefined) {
|
||||||
|
conditions.push(eq(leases.leaseNumber, `${plant}`));
|
||||||
|
}
|
||||||
|
|
||||||
|
//conditions.push(eq(forkliftCompanies.active, true));
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
db
|
||||||
|
.select()
|
||||||
|
.from(forklifts)
|
||||||
|
//.innerJoin(forkliftCompanies, eq(forkliftCompanies.id, leases.companyId))
|
||||||
|
.where(and(...conditions))
|
||||||
|
.orderBy(asc(forklifts.serialNumber)),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return res.status(400).json({ error: error });
|
||||||
|
}
|
||||||
|
res.status(200).json({ message: "Current Forklifts", data: data });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
136
app/src/internal/forklifts/routes/forklifts/updateForklift.ts
Normal file
136
app/src/internal/forklifts/routes/forklifts/updateForklift.ts
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { eq, sql } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import https from "https";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import { forkliftCompanies } from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { leases } from "../../../../pkg/db/schema/forkliftLeases.js";
|
||||||
|
import { forklifts } from "../../../../pkg/db/schema/forklifts.js";
|
||||||
|
import { serverData } from "../../../../pkg/db/schema/servers.js";
|
||||||
|
import { createLogger } from "../../../../pkg/logger/logger.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.patch("/:id", async (req: Request, res: Response) => {
|
||||||
|
const log = createLogger({
|
||||||
|
module: "forklifts",
|
||||||
|
subModule: "update leases",
|
||||||
|
});
|
||||||
|
|
||||||
|
// when a server is updated and is posted from localhost or 127.0.0.1 we also want to post it to the test server so we can see it from there, we want to insert with update on conflict.
|
||||||
|
const id = req.params.id;
|
||||||
|
const updates: Record<string, any> = {};
|
||||||
|
if (req.body?.model !== undefined) {
|
||||||
|
updates.model = req.body.model;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.plant !== undefined) {
|
||||||
|
updates.plant = req.body.plant;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.glCode !== undefined) {
|
||||||
|
updates.glCode = req.body.glCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.profitCenter !== undefined) {
|
||||||
|
updates.profitCenter = req.body.profitCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.manufacturer !== undefined) {
|
||||||
|
updates.manufacturer = req.body.manufacturer;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.manufacturerYear !== undefined) {
|
||||||
|
updates.manufacturerYear = req.body.manufacturerYear;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.engine !== undefined) {
|
||||||
|
updates.engine = req.body.engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.batteryType !== undefined) {
|
||||||
|
updates.batteryType = req.body.batteryType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.dataPlate !== undefined) {
|
||||||
|
updates.dataPlate = req.body.dataPlate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.forkliftNumber !== undefined) {
|
||||||
|
updates.forkliftNumber = req.body.forkliftNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
updates.upd_user = req.user!.username || "lst_user";
|
||||||
|
updates.upd_date = sql`NOW()`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (Object.keys(updates).length > 0) {
|
||||||
|
await db
|
||||||
|
.update(forklifts)
|
||||||
|
.set(updates)
|
||||||
|
.where(eq(forklifts.forklift_id, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (req.hostname === "localhost" && process.env.MAIN_SERVER) {
|
||||||
|
// log.info({}, "Running in dev server about to add in a new server");
|
||||||
|
// const axiosInstance = axios.create({
|
||||||
|
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
// baseURL: process.env.MAIN_SERVER,
|
||||||
|
// withCredentials: true,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const loginRes = (await axiosInstance.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/auth/sign-in/username`,
|
||||||
|
// {
|
||||||
|
// username: process.env.MAIN_SERVER_USERNAME,
|
||||||
|
// password: process.env.MAIN_SERVER_PASSWORD,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// headers: { "Content-Type": "application/json" },
|
||||||
|
// },
|
||||||
|
// )) as any;
|
||||||
|
|
||||||
|
// const setCookie = loginRes?.headers["set-cookie"][0];
|
||||||
|
|
||||||
|
// //console.log(setCookie.split(";")[0].replace("__Secure-", ""));
|
||||||
|
|
||||||
|
// if (!setCookie) {
|
||||||
|
// throw new Error("Did not receive a Set-Cookie header from login");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const { data, error } = await tryCatch(
|
||||||
|
// axios.patch(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/forklifts/companies/${id}`,
|
||||||
|
// updates,
|
||||||
|
// {
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// Cookie: setCookie.split(";")[0],
|
||||||
|
// },
|
||||||
|
// withCredentials: true,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (error) {
|
||||||
|
// //console.log(error);
|
||||||
|
// log.error(
|
||||||
|
// { stack: error },
|
||||||
|
// "There was an error updating the lease to Main Server",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// log.info(
|
||||||
|
// { stack: data?.data },
|
||||||
|
// "A new lease was just updated to the server.",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
res.status(200).json({ message: `${id} was just updated` });
|
||||||
|
} catch (error) {
|
||||||
|
//console.log(error);
|
||||||
|
res.status(200).json({ message: "Error updating lease", error });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
114
app/src/internal/forklifts/routes/hours/addHours.ts
Normal file
114
app/src/internal/forklifts/routes/hours/addHours.ts
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { type DrizzleError, sql } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import https from "https";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import {
|
||||||
|
insertLeasesCompanySchema,
|
||||||
|
leases,
|
||||||
|
} from "../../../../pkg/db/schema/forkliftLeases.js";
|
||||||
|
import { createLogger } from "../../../../pkg/logger/logger.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.post("/", async (req: Request, res: Response) => {
|
||||||
|
// when a new server is posted from localhost or 127.0.0.1 we also want to post it to the test server so we can see it from there
|
||||||
|
//res.status(200).json({ message: "Server added", ip: req.hostname });
|
||||||
|
const log = createLogger({ module: "forklift", subModule: "add lease" });
|
||||||
|
const parsed = insertLeasesCompanySchema.safeParse(req.body);
|
||||||
|
|
||||||
|
if (!parsed.success) {
|
||||||
|
return res.status(400).json({ errors: parsed.error.flatten() });
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
db
|
||||||
|
.insert(leases)
|
||||||
|
.values({
|
||||||
|
...parsed.data,
|
||||||
|
add_user: req.user?.username,
|
||||||
|
add_date: sql`NOW()`,
|
||||||
|
upd_user: req.user?.username,
|
||||||
|
upd_date: sql`NOW()`,
|
||||||
|
})
|
||||||
|
.onConflictDoUpdate({
|
||||||
|
target: leases.leaseNumber,
|
||||||
|
set: {
|
||||||
|
...parsed.data,
|
||||||
|
add_user: req.user?.username,
|
||||||
|
add_date: sql`NOW()`,
|
||||||
|
upd_user: req.user?.username,
|
||||||
|
upd_date: sql`NOW()`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.returning({
|
||||||
|
leaseNumber: leases.leaseNumber,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
const err: DrizzleError = error;
|
||||||
|
return res.status(400).json({
|
||||||
|
message: `Error adding lease`,
|
||||||
|
error: err.cause,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (req.hostname === "localhost" && process.env.MAIN_SERVER) {
|
||||||
|
// log.info({}, "Running in dev server about to add in a new server");
|
||||||
|
// const axiosInstance = axios.create({
|
||||||
|
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
// baseURL: process.env.MAIN_SERVER, // e.g. "https://example.com"
|
||||||
|
// withCredentials: true,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const loginRes = (await axiosInstance.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/auth/sign-in/username`,
|
||||||
|
// {
|
||||||
|
// username: process.env.MAIN_SERVER_USERNAME,
|
||||||
|
// password: process.env.MAIN_SERVER_PASSWORD,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// headers: { "Content-Type": "application/json" },
|
||||||
|
// },
|
||||||
|
// )) as any;
|
||||||
|
// const setCookie = loginRes.headers["set-cookie"][0];
|
||||||
|
|
||||||
|
// if (!setCookie) {
|
||||||
|
// throw new Error("Did not receive a Set-Cookie header from login");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const { data, error } = await tryCatch(
|
||||||
|
// axios.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/forklifts/leases`,
|
||||||
|
// parsed.data,
|
||||||
|
// {
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// Cookie: setCookie.split(";")[0],
|
||||||
|
// },
|
||||||
|
// withCredentials: true,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (error) {
|
||||||
|
// log.error(
|
||||||
|
// { stack: error },
|
||||||
|
// "There was an error adding the company to Main Server",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// log.info(
|
||||||
|
// { stack: data?.data },
|
||||||
|
// "A new Company was just added to the server.",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
return res
|
||||||
|
.status(201)
|
||||||
|
.json({ message: `lease ${data[0]?.leaseNumber} added`, data: data });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
59
app/src/internal/forklifts/routes/hours/getHours.ts
Normal file
59
app/src/internal/forklifts/routes/hours/getHours.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import { and, asc, eq } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import { forkliftCompanies } from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { leases } from "../../../../pkg/db/schema/forkliftLeases.js";
|
||||||
|
import { forklifts } from "../../../../pkg/db/schema/forklifts.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get("/", async (req: Request, res: Response) => {
|
||||||
|
const conditions = [];
|
||||||
|
|
||||||
|
if (req.query.lease !== undefined) {
|
||||||
|
conditions.push(eq(leases.leaseNumber, `${req.query.lease}`));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.query.companyId !== undefined) {
|
||||||
|
conditions.push(eq(leases.companyId, `${req.query.companyId}`));
|
||||||
|
}
|
||||||
|
|
||||||
|
//conditions.push(eq(forkliftCompanies.active, true));
|
||||||
|
|
||||||
|
const { data, error } = (await tryCatch(
|
||||||
|
db
|
||||||
|
.select({
|
||||||
|
id: leases.id,
|
||||||
|
leaseNumber: leases.leaseNumber,
|
||||||
|
startDate: leases.startDate,
|
||||||
|
endDate: leases.endDate,
|
||||||
|
leaseLink: leases.leaseLink,
|
||||||
|
companyName: forkliftCompanies.name,
|
||||||
|
add_user: leases.add_user,
|
||||||
|
add_date: leases.add_date,
|
||||||
|
upd_user: leases.upd_user,
|
||||||
|
upd_date: leases.upd_date,
|
||||||
|
})
|
||||||
|
.from(leases)
|
||||||
|
.innerJoin(forkliftCompanies, eq(forkliftCompanies.id, leases.companyId))
|
||||||
|
.where(and(...conditions))
|
||||||
|
.orderBy(asc(leases.leaseNumber)),
|
||||||
|
)) as any;
|
||||||
|
|
||||||
|
// add the forklifts that are in this lease
|
||||||
|
const forkliftData = await db.select().from(forklifts);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return res.status(400).json({ error: error });
|
||||||
|
}
|
||||||
|
|
||||||
|
const leaseData = data.map((i: any) => ({
|
||||||
|
...i,
|
||||||
|
forklifts: forkliftData.filter((x) => x.leaseId === i.id),
|
||||||
|
}));
|
||||||
|
res.status(200).json({ message: "Current Leases", data: leaseData });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
20
app/src/internal/forklifts/routes/hours/leaseRoutes.ts
Normal file
20
app/src/internal/forklifts/routes/hours/leaseRoutes.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import { requireAuth } from "../../../../pkg/middleware/authMiddleware.js";
|
||||||
|
|
||||||
|
import addHours from "./addHours.js";
|
||||||
|
import gethours from "./getHours.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin", "manager", "supervisor"]),
|
||||||
|
addHours,
|
||||||
|
);
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin", "manager", "supervisor"]),
|
||||||
|
gethours,
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
||||||
166
app/src/internal/forklifts/routes/invoices/addInvoice.ts
Normal file
166
app/src/internal/forklifts/routes/invoices/addInvoice.ts
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { type DrizzleError, sql } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import https from "https";
|
||||||
|
import type z from "zod";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import {
|
||||||
|
leaseInvoiceForklifts,
|
||||||
|
newForkliftInvoiceSchema,
|
||||||
|
} from "../../../../pkg/db/schema/forkliftLeasesInvoice.js";
|
||||||
|
import {
|
||||||
|
leaseInvoices,
|
||||||
|
newInvoiceSchema,
|
||||||
|
} from "../../../../pkg/db/schema/leaseInvoices.js";
|
||||||
|
import { createLogger } from "../../../../pkg/logger/logger.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.post("/", async (req: Request, res: Response) => {
|
||||||
|
// when a new server is posted from localhost or 127.0.0.1 we also want to post it to the test server so we can see it from there
|
||||||
|
//res.status(200).json({ message: "Server added", ip: req.hostname });
|
||||||
|
const log = createLogger({ module: "forklift", subModule: "add invoice" });
|
||||||
|
|
||||||
|
const parsedInvoice = newInvoiceSchema.safeParse({
|
||||||
|
leaseId: req.body.leaseId,
|
||||||
|
companyId: req.body.companyId,
|
||||||
|
invoiceNumber: req.body.invoiceNumber,
|
||||||
|
invoiceDate: req.body.invoiceDate,
|
||||||
|
comment: req.body.comment,
|
||||||
|
uploadedBy: req.body.uploadedBy,
|
||||||
|
totalAmount: req.body.totalAmount,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!parsedInvoice.success)
|
||||||
|
return res.status(400).json({ error: parsedInvoice.error.flatten });
|
||||||
|
|
||||||
|
const invoiceData = parsedInvoice.data;
|
||||||
|
|
||||||
|
const forkliftItems = Array.isArray(req.body.forklifts)
|
||||||
|
? req.body.forklifts
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const validatedForklifts = []; //z.infer<typeof newForkliftInvoiceSchema>[] = [];
|
||||||
|
|
||||||
|
for (const item of forkliftItems) {
|
||||||
|
// const parsedItem = newForkliftInvoiceSchema.safeParse(item);
|
||||||
|
// if (parsedItem.success) {
|
||||||
|
validatedForklifts.push(item);
|
||||||
|
//} else {
|
||||||
|
//return res.status(400).json({ error: parsedItem.error.flatten() });
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
// this will be the total invoice amount minus each forklift this way we can keep the total amount in here plus forklifts seperated
|
||||||
|
// const totalAmount = (
|
||||||
|
// validatedForklifts.reduce((sum, f) => sum + Number(f.amount || 0), 0) -
|
||||||
|
// req.body.totalInvoice
|
||||||
|
// ).toString();
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
db
|
||||||
|
.insert(leaseInvoices)
|
||||||
|
.values({
|
||||||
|
...invoiceData,
|
||||||
|
add_date: sql`NOW()`,
|
||||||
|
totalAmount: req.body.totalAmount,
|
||||||
|
uploadedBy: req.user!.username || "lst_user",
|
||||||
|
})
|
||||||
|
// .onConflictDoUpdate({
|
||||||
|
// target: leaseInvoices.invoiceNumber,
|
||||||
|
// set: {
|
||||||
|
// totalAmount,
|
||||||
|
// invoiceDate: invoiceData.invoiceDate,
|
||||||
|
// uploadedBy: req.user!.username || "lst_user",
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
.returning(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
const err: DrizzleError = error;
|
||||||
|
return res.status(400).json({
|
||||||
|
message: `Error adding lease`,
|
||||||
|
// @ts-ignore
|
||||||
|
error: err.cause.detail,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const invoiceId = data[0]?.id;
|
||||||
|
console.log(validatedForklifts);
|
||||||
|
const forkliftInvoices = validatedForklifts.map((f) => {
|
||||||
|
return {
|
||||||
|
invoiceId,
|
||||||
|
forkliftId: f.forklift_id,
|
||||||
|
amount: f.amount,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
if (validatedForklifts.length > 0) {
|
||||||
|
await db.insert(leaseInvoiceForklifts).values(forkliftInvoices);
|
||||||
|
// .onConflictDoUpdate({
|
||||||
|
// target: [
|
||||||
|
// leaseInvoiceForklifts.invoiceId,
|
||||||
|
// leaseInvoiceForklifts.forkliftId,
|
||||||
|
// ],
|
||||||
|
// set: { amount: (excluded) => excluded.amount },
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
// if (req.hostname === "localhost" && process.env.MAIN_SERVER) {
|
||||||
|
// log.info({}, "Running in dev server about to add in a new server");
|
||||||
|
// const axiosInstance = axios.create({
|
||||||
|
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
// baseURL: process.env.MAIN_SERVER, // e.g. "https://example.com"
|
||||||
|
// withCredentials: true,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const loginRes = (await axiosInstance.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/auth/sign-in/username`,
|
||||||
|
// {
|
||||||
|
// username: process.env.MAIN_SERVER_USERNAME,
|
||||||
|
// password: process.env.MAIN_SERVER_PASSWORD,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// headers: { "Content-Type": "application/json" },
|
||||||
|
// },
|
||||||
|
// )) as any;
|
||||||
|
// const setCookie = loginRes.headers["set-cookie"][0];
|
||||||
|
|
||||||
|
// if (!setCookie) {
|
||||||
|
// throw new Error("Did not receive a Set-Cookie header from login");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const { data, error } = await tryCatch(
|
||||||
|
// axios.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/forklifts/leases`,
|
||||||
|
// parsed.data,
|
||||||
|
// {
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// Cookie: setCookie.split(";")[0],
|
||||||
|
// },
|
||||||
|
// withCredentials: true,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (error) {
|
||||||
|
// log.error(
|
||||||
|
// { stack: error },
|
||||||
|
// "There was an error adding the company to Main Server",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// log.info(
|
||||||
|
// { stack: data?.data },
|
||||||
|
// "A new Company was just added to the server.",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
return res
|
||||||
|
.status(201)
|
||||||
|
.json({ message: `lease ${data[0]?.invoiceNumber} added`, data: data });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
52
app/src/internal/forklifts/routes/invoices/getInvoices.ts
Normal file
52
app/src/internal/forklifts/routes/invoices/getInvoices.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import { and, asc, eq, relations } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import { forkliftCompanies } from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { leases } from "../../../../pkg/db/schema/forkliftLeases.js";
|
||||||
|
import { forklifts } from "../../../../pkg/db/schema/forklifts.js";
|
||||||
|
import { leaseInvoices } from "../../../../pkg/db/schema/leaseInvoices.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get("/", async (req: Request, res: Response) => {
|
||||||
|
const invoiceNumber = req.query.lease;
|
||||||
|
|
||||||
|
const conditions = [];
|
||||||
|
|
||||||
|
if (invoiceNumber !== undefined) {
|
||||||
|
conditions.push(eq(leaseInvoices.invoiceNumber, `${invoiceNumber}`));
|
||||||
|
}
|
||||||
|
|
||||||
|
//conditions.push(eq(forkliftCompanies.active, true));
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
db
|
||||||
|
.select(
|
||||||
|
// {
|
||||||
|
// id: leases.id,
|
||||||
|
// leaseNumber: leases.leaseNumber,
|
||||||
|
// startDate: leases.startDate,
|
||||||
|
// endDate: leases.endDate,
|
||||||
|
// leaseLink: leases.leaseLink,
|
||||||
|
// companyName: forkliftCompanies.name,
|
||||||
|
// add_user: leases.add_user,
|
||||||
|
// add_date: leases.add_date,
|
||||||
|
// upd_user: leases.upd_user,
|
||||||
|
// upd_date: leases.upd_date,
|
||||||
|
// }
|
||||||
|
)
|
||||||
|
.from(leaseInvoices)
|
||||||
|
//.innerJoin(forkliftCompanies, eq(forkliftCompanies.id, leases.companyId))
|
||||||
|
.where(and(...conditions))
|
||||||
|
.orderBy(asc(leaseInvoices.invoiceNumber)),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return res.status(400).json({ error: error });
|
||||||
|
}
|
||||||
|
res.status(200).json({ message: "Current Leases", data: data });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
22
app/src/internal/forklifts/routes/invoices/invoiceRoutes.ts
Normal file
22
app/src/internal/forklifts/routes/invoices/invoiceRoutes.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import { requireAuth } from "../../../../pkg/middleware/authMiddleware.js";
|
||||||
|
|
||||||
|
import addInvoice from "./addInvoice.js";
|
||||||
|
import getInvoices from "./getInvoices.js";
|
||||||
|
import updateInvoice from "./updateInvoices.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin", "manager"]),
|
||||||
|
getInvoices,
|
||||||
|
);
|
||||||
|
router.use("/", requireAuth("forklifts", ["systemAdmin", "admin"]), addInvoice);
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin"]),
|
||||||
|
updateInvoice,
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
||||||
114
app/src/internal/forklifts/routes/invoices/updateInvoices.ts
Normal file
114
app/src/internal/forklifts/routes/invoices/updateInvoices.ts
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { eq, sql } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import https from "https";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import { forkliftCompanies } from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { leases } from "../../../../pkg/db/schema/forkliftLeases.js";
|
||||||
|
import { serverData } from "../../../../pkg/db/schema/servers.js";
|
||||||
|
import { createLogger } from "../../../../pkg/logger/logger.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.patch("/:id", async (req: Request, res: Response) => {
|
||||||
|
const log = createLogger({
|
||||||
|
module: "forklifts",
|
||||||
|
subModule: "update invoice",
|
||||||
|
});
|
||||||
|
|
||||||
|
// when a server is updated and is posted from localhost or 127.0.0.1 we also want to post it to the test server so we can see it from there, we want to insert with update on conflict.
|
||||||
|
const id = req.params.id;
|
||||||
|
const updates: Record<string, any> = {};
|
||||||
|
console.log(req.body);
|
||||||
|
if (req.body?.leaseNumber !== undefined) {
|
||||||
|
updates.leaseNumber = req.body.leaseNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.startDate !== undefined) {
|
||||||
|
updates.startDate = req.body.startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.endDate !== undefined) {
|
||||||
|
updates.endDate = req.body.endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.companyId !== undefined) {
|
||||||
|
updates.companyId = req.body.companyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.leaseLink !== undefined) {
|
||||||
|
updates.leaseLink = req.body.leaseLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
updates.upd_user = req.user!.username || "lst_user";
|
||||||
|
updates.upd_date = sql`NOW()`;
|
||||||
|
|
||||||
|
console.log(updates);
|
||||||
|
try {
|
||||||
|
if (Object.keys(updates).length > 0) {
|
||||||
|
await db.update(leases).set(updates).where(eq(leases.id, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (req.hostname === "localhost" && process.env.MAIN_SERVER) {
|
||||||
|
// log.info({}, "Running in dev server about to add in a new server");
|
||||||
|
// const axiosInstance = axios.create({
|
||||||
|
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
// baseURL: process.env.MAIN_SERVER,
|
||||||
|
// withCredentials: true,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const loginRes = (await axiosInstance.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/auth/sign-in/username`,
|
||||||
|
// {
|
||||||
|
// username: process.env.MAIN_SERVER_USERNAME,
|
||||||
|
// password: process.env.MAIN_SERVER_PASSWORD,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// headers: { "Content-Type": "application/json" },
|
||||||
|
// },
|
||||||
|
// )) as any;
|
||||||
|
|
||||||
|
// const setCookie = loginRes?.headers["set-cookie"][0];
|
||||||
|
|
||||||
|
// //console.log(setCookie.split(";")[0].replace("__Secure-", ""));
|
||||||
|
|
||||||
|
// if (!setCookie) {
|
||||||
|
// throw new Error("Did not receive a Set-Cookie header from login");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const { data, error } = await tryCatch(
|
||||||
|
// axios.patch(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/forklifts/leases/${id}`,
|
||||||
|
// updates,
|
||||||
|
// {
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// Cookie: setCookie.split(";")[0],
|
||||||
|
// },
|
||||||
|
// withCredentials: true,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (error) {
|
||||||
|
// //console.log(error);
|
||||||
|
// log.error(
|
||||||
|
// { stack: error },
|
||||||
|
// "There was an error updating the lease to Main Server",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// log.info(
|
||||||
|
// { stack: data?.data },
|
||||||
|
// "A new lease was just updated to the server.",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
res.status(200).json({ message: `${id} was just updated` });
|
||||||
|
} catch (error) {
|
||||||
|
//console.log(error);
|
||||||
|
res.status(200).json({ message: "Error updating lease", error });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
114
app/src/internal/forklifts/routes/leases/addLease.ts
Normal file
114
app/src/internal/forklifts/routes/leases/addLease.ts
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { type DrizzleError, sql } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import https from "https";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import {
|
||||||
|
insertLeasesCompanySchema,
|
||||||
|
leases,
|
||||||
|
} from "../../../../pkg/db/schema/forkliftLeases.js";
|
||||||
|
import { createLogger } from "../../../../pkg/logger/logger.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.post("/", async (req: Request, res: Response) => {
|
||||||
|
// when a new server is posted from localhost or 127.0.0.1 we also want to post it to the test server so we can see it from there
|
||||||
|
//res.status(200).json({ message: "Server added", ip: req.hostname });
|
||||||
|
const log = createLogger({ module: "forklift", subModule: "add lease" });
|
||||||
|
const parsed = insertLeasesCompanySchema.safeParse(req.body);
|
||||||
|
|
||||||
|
if (!parsed.success) {
|
||||||
|
return res.status(400).json({ errors: parsed.error.flatten() });
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data, error } = await tryCatch(
|
||||||
|
db
|
||||||
|
.insert(leases)
|
||||||
|
.values({
|
||||||
|
...parsed.data,
|
||||||
|
add_user: req.user?.username,
|
||||||
|
add_date: sql`NOW()`,
|
||||||
|
upd_user: req.user?.username,
|
||||||
|
upd_date: sql`NOW()`,
|
||||||
|
})
|
||||||
|
.onConflictDoUpdate({
|
||||||
|
target: leases.leaseNumber,
|
||||||
|
set: {
|
||||||
|
...parsed.data,
|
||||||
|
add_user: req.user?.username,
|
||||||
|
add_date: sql`NOW()`,
|
||||||
|
upd_user: req.user?.username,
|
||||||
|
upd_date: sql`NOW()`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.returning({
|
||||||
|
leaseNumber: leases.leaseNumber,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
const err: DrizzleError = error;
|
||||||
|
return res.status(400).json({
|
||||||
|
message: `Error adding lease`,
|
||||||
|
error: err.cause,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (req.hostname === "localhost" && process.env.MAIN_SERVER) {
|
||||||
|
// log.info({}, "Running in dev server about to add in a new server");
|
||||||
|
// const axiosInstance = axios.create({
|
||||||
|
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
// baseURL: process.env.MAIN_SERVER, // e.g. "https://example.com"
|
||||||
|
// withCredentials: true,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const loginRes = (await axiosInstance.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/auth/sign-in/username`,
|
||||||
|
// {
|
||||||
|
// username: process.env.MAIN_SERVER_USERNAME,
|
||||||
|
// password: process.env.MAIN_SERVER_PASSWORD,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// headers: { "Content-Type": "application/json" },
|
||||||
|
// },
|
||||||
|
// )) as any;
|
||||||
|
// const setCookie = loginRes.headers["set-cookie"][0];
|
||||||
|
|
||||||
|
// if (!setCookie) {
|
||||||
|
// throw new Error("Did not receive a Set-Cookie header from login");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const { data, error } = await tryCatch(
|
||||||
|
// axios.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/forklifts/leases`,
|
||||||
|
// parsed.data,
|
||||||
|
// {
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// Cookie: setCookie.split(";")[0],
|
||||||
|
// },
|
||||||
|
// withCredentials: true,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (error) {
|
||||||
|
// log.error(
|
||||||
|
// { stack: error },
|
||||||
|
// "There was an error adding the company to Main Server",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// log.info(
|
||||||
|
// { stack: data?.data },
|
||||||
|
// "A new Company was just added to the server.",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
return res
|
||||||
|
.status(201)
|
||||||
|
.json({ message: `lease ${data[0]?.leaseNumber} added`, data: data });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
59
app/src/internal/forklifts/routes/leases/getLeases.ts
Normal file
59
app/src/internal/forklifts/routes/leases/getLeases.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import { and, asc, eq } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import { forkliftCompanies } from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { leases } from "../../../../pkg/db/schema/forkliftLeases.js";
|
||||||
|
import { forklifts } from "../../../../pkg/db/schema/forklifts.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get("/", async (req: Request, res: Response) => {
|
||||||
|
const conditions = [];
|
||||||
|
|
||||||
|
if (req.query.lease !== undefined) {
|
||||||
|
conditions.push(eq(leases.leaseNumber, `${req.query.lease}`));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.query.companyId !== undefined) {
|
||||||
|
conditions.push(eq(leases.companyId, `${req.query.companyId}`));
|
||||||
|
}
|
||||||
|
|
||||||
|
//conditions.push(eq(forkliftCompanies.active, true));
|
||||||
|
|
||||||
|
const { data, error } = (await tryCatch(
|
||||||
|
db
|
||||||
|
.select({
|
||||||
|
id: leases.id,
|
||||||
|
leaseNumber: leases.leaseNumber,
|
||||||
|
startDate: leases.startDate,
|
||||||
|
endDate: leases.endDate,
|
||||||
|
leaseLink: leases.leaseLink,
|
||||||
|
companyName: forkliftCompanies.name,
|
||||||
|
add_user: leases.add_user,
|
||||||
|
add_date: leases.add_date,
|
||||||
|
upd_user: leases.upd_user,
|
||||||
|
upd_date: leases.upd_date,
|
||||||
|
})
|
||||||
|
.from(leases)
|
||||||
|
.innerJoin(forkliftCompanies, eq(forkliftCompanies.id, leases.companyId))
|
||||||
|
.where(and(...conditions))
|
||||||
|
.orderBy(asc(leases.leaseNumber)),
|
||||||
|
)) as any;
|
||||||
|
|
||||||
|
// add the forklifts that are in this lease
|
||||||
|
const forkliftData = await db.select().from(forklifts);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return res.status(400).json({ error: error });
|
||||||
|
}
|
||||||
|
|
||||||
|
const leaseData = data.map((i: any) => ({
|
||||||
|
...i,
|
||||||
|
forklifts: forkliftData.filter((x) => x.leaseId === i.id),
|
||||||
|
}));
|
||||||
|
res.status(200).json({ message: "Current Leases", data: leaseData });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
18
app/src/internal/forklifts/routes/leases/leaseRoutes.ts
Normal file
18
app/src/internal/forklifts/routes/leases/leaseRoutes.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import { requireAuth } from "../../../../pkg/middleware/authMiddleware.js";
|
||||||
|
|
||||||
|
import addLeases from "./addLease.js";
|
||||||
|
import getLeases from "./getLeases.js";
|
||||||
|
import updateLeases from "./updateLease.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.use("/", requireAuth("forklifts", ["systemAdmin", "admin"]), getLeases);
|
||||||
|
router.use("/", requireAuth("forklifts", ["systemAdmin", "admin"]), addLeases);
|
||||||
|
router.use(
|
||||||
|
"/",
|
||||||
|
requireAuth("forklifts", ["systemAdmin", "admin"]),
|
||||||
|
updateLeases,
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
||||||
114
app/src/internal/forklifts/routes/leases/updateLease.ts
Normal file
114
app/src/internal/forklifts/routes/leases/updateLease.ts
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { eq, sql } from "drizzle-orm";
|
||||||
|
import type { Request, Response } from "express";
|
||||||
|
import { Router } from "express";
|
||||||
|
import https from "https";
|
||||||
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
|
import { forkliftCompanies } from "../../../../pkg/db/schema/forkliftLeaseCompanys.js";
|
||||||
|
import { leases } from "../../../../pkg/db/schema/forkliftLeases.js";
|
||||||
|
import { serverData } from "../../../../pkg/db/schema/servers.js";
|
||||||
|
import { createLogger } from "../../../../pkg/logger/logger.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.patch("/:id", async (req: Request, res: Response) => {
|
||||||
|
const log = createLogger({
|
||||||
|
module: "forklifts",
|
||||||
|
subModule: "update leases",
|
||||||
|
});
|
||||||
|
|
||||||
|
// when a server is updated and is posted from localhost or 127.0.0.1 we also want to post it to the test server so we can see it from there, we want to insert with update on conflict.
|
||||||
|
const id = req.params.id;
|
||||||
|
const updates: Record<string, any> = {};
|
||||||
|
console.log(req.body);
|
||||||
|
if (req.body?.leaseNumber !== undefined) {
|
||||||
|
updates.leaseNumber = req.body.leaseNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.startDate !== undefined) {
|
||||||
|
updates.startDate = req.body.startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.endDate !== undefined) {
|
||||||
|
updates.endDate = req.body.endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.companyId !== undefined) {
|
||||||
|
updates.companyId = req.body.companyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body?.leaseLink !== undefined) {
|
||||||
|
updates.leaseLink = req.body.leaseLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
updates.upd_user = req.user!.username || "lst_user";
|
||||||
|
updates.upd_date = sql`NOW()`;
|
||||||
|
|
||||||
|
console.log(updates);
|
||||||
|
try {
|
||||||
|
if (Object.keys(updates).length > 0) {
|
||||||
|
await db.update(leases).set(updates).where(eq(leases.id, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (req.hostname === "localhost" && process.env.MAIN_SERVER) {
|
||||||
|
// log.info({}, "Running in dev server about to add in a new server");
|
||||||
|
// const axiosInstance = axios.create({
|
||||||
|
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
// baseURL: process.env.MAIN_SERVER,
|
||||||
|
// withCredentials: true,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const loginRes = (await axiosInstance.post(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/auth/sign-in/username`,
|
||||||
|
// {
|
||||||
|
// username: process.env.MAIN_SERVER_USERNAME,
|
||||||
|
// password: process.env.MAIN_SERVER_PASSWORD,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// headers: { "Content-Type": "application/json" },
|
||||||
|
// },
|
||||||
|
// )) as any;
|
||||||
|
|
||||||
|
// const setCookie = loginRes?.headers["set-cookie"][0];
|
||||||
|
|
||||||
|
// //console.log(setCookie.split(";")[0].replace("__Secure-", ""));
|
||||||
|
|
||||||
|
// if (!setCookie) {
|
||||||
|
// throw new Error("Did not receive a Set-Cookie header from login");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const { data, error } = await tryCatch(
|
||||||
|
// axios.patch(
|
||||||
|
// `${process.env.MAIN_SERVER}/lst/api/forklifts/leases/${id}`,
|
||||||
|
// updates,
|
||||||
|
// {
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// Cookie: setCookie.split(";")[0],
|
||||||
|
// },
|
||||||
|
// withCredentials: true,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (error) {
|
||||||
|
// //console.log(error);
|
||||||
|
// log.error(
|
||||||
|
// { stack: error },
|
||||||
|
// "There was an error updating the lease to Main Server",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// log.info(
|
||||||
|
// { stack: data?.data },
|
||||||
|
// "A new lease was just updated to the server.",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
res.status(200).json({ message: `${id} was just updated` });
|
||||||
|
} catch (error) {
|
||||||
|
//console.log(error);
|
||||||
|
res.status(200).json({ message: "Error updating lease", error });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
24
app/src/internal/forklifts/routes/routes.ts
Normal file
24
app/src/internal/forklifts/routes/routes.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import type { Express, Request, Response } from "express";
|
||||||
|
import { requireAuth } from "../../../pkg/middleware/authMiddleware.js";
|
||||||
|
import companies from "./companies/companiesRoutes.js";
|
||||||
|
import forklifts from "./forklifts/forkliftRoutes.js";
|
||||||
|
import invoices from "./invoices/invoiceRoutes.js";
|
||||||
|
import leases from "./leases/leaseRoutes.js";
|
||||||
|
export const setupForkliftRoutes = (app: Express, basePath: string) => {
|
||||||
|
app.use(
|
||||||
|
basePath + "/api/forklifts", // will pass bc system admin but this is just telling us we need this
|
||||||
|
forklifts,
|
||||||
|
);
|
||||||
|
app.use(
|
||||||
|
basePath + "/api/forklifts/companies", // will pass bc system admin but this is just telling us we need this
|
||||||
|
companies,
|
||||||
|
);
|
||||||
|
app.use(
|
||||||
|
basePath + "/api/forklifts/leases", // will pass bc system admin but this is just telling us we need this
|
||||||
|
leases,
|
||||||
|
);
|
||||||
|
app.use(
|
||||||
|
basePath + "/api/forklifts/invoices", // will pass bc system admin but this is just telling us we need this
|
||||||
|
invoices,
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -8,8 +8,64 @@
|
|||||||
* add_date
|
* add_date
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type IncomingForecastData = {
|
import { db } from "../../../../pkg/db/db.js";
|
||||||
CustomerArticleNumber: number;
|
import {
|
||||||
};
|
type ForecastData,
|
||||||
|
forecastData,
|
||||||
|
} from "../../../../pkg/db/schema/forecastEDIData.js";
|
||||||
|
import { prodQuery } from "../../../../pkg/prodSql/prodQuery.js";
|
||||||
|
import { activeArticle } from "../../../../pkg/prodSql/querys/datamart/article.js";
|
||||||
|
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
|
||||||
|
|
||||||
export const forecastData = async (data: IncomingForecastData) => {};
|
export const forecastEdiData = async (data: ForecastData[]) => {
|
||||||
|
//console.log(data);
|
||||||
|
const { data: article, error } = await tryCatch(
|
||||||
|
prodQuery(activeArticle, "forecast data active articles"),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: "Failed to get active articles",
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const forecaseEDIDATA = [];
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
const activeAV = article?.data.filter(
|
||||||
|
(c: any) =>
|
||||||
|
c?.customerArticleNumber === data[i].customerArticleNo?.toString(),
|
||||||
|
);
|
||||||
|
const newData = data[i];
|
||||||
|
//console.log(activeAV[0].IdArtikelvarianten);
|
||||||
|
|
||||||
|
forecaseEDIDATA.push({
|
||||||
|
...newData,
|
||||||
|
article: activeAV.length > 0 ? activeAV[0].article : 0,
|
||||||
|
description:
|
||||||
|
activeAV.length > 0 ? activeAV[0].description : "No Av Created",
|
||||||
|
requirementDate: new Date(newData.requirementDate),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(forecaseEDIDATA[0]);
|
||||||
|
const { data: f, error: ef } = await tryCatch(
|
||||||
|
db.insert(forecastData).values(forecaseEDIDATA),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ef) {
|
||||||
|
console.log(ef);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: "There was an error posting the new data",
|
||||||
|
error: ef,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
message: "All forecast Data was posted",
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ const addProdLabel = async (
|
|||||||
if (prodLabelError) {
|
if (prodLabelError) {
|
||||||
log.error({ error: error }, "Error adding the label");
|
log.error({ error: error }, "Error adding the label");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const preprintLabels = async (preprint: Preprint, username?: string) => {
|
export const preprintLabels = async (preprint: Preprint, username?: string) => {
|
||||||
@@ -85,12 +87,12 @@ export const preprintLabels = async (preprint: Preprint, username?: string) => {
|
|||||||
"POST",
|
"POST",
|
||||||
"/public/v1.0/Warehousing/GenerateAndPrintLabel",
|
"/public/v1.0/Warehousing/GenerateAndPrintLabel",
|
||||||
{
|
{
|
||||||
scannerId: preprint.scannerId,
|
scannerId: preprint.scannerId.toString(),
|
||||||
lotNr: preprint.lotNr,
|
lotNr: preprint.lotNr.toString(),
|
||||||
machineId: preprint.machineId, // 457=22, 458=23
|
machineId: preprint.machineId.toString(),
|
||||||
printerId: preprint.printerId, // 457=22, 458=23
|
printerId: preprint.printerId.toString(),
|
||||||
layoutId: preprint.layoutId,
|
layoutId: preprint.layoutId.toString(),
|
||||||
numberOfCopies: preprint.numberOfCopies,
|
numberOfCopies: preprint.numberOfCopies.toString(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (labels?.data.Result === 1) {
|
if (labels?.data.Result === 1) {
|
||||||
@@ -116,7 +118,7 @@ export const preprintLabels = async (preprint: Preprint, username?: string) => {
|
|||||||
}
|
}
|
||||||
labelsPrinted.push(parseInt(labels?.data.SSCC.slice(10, -1)));
|
labelsPrinted.push(parseInt(labels?.data.SSCC.slice(10, -1)));
|
||||||
// add the label to our label db for tracking purposes
|
// add the label to our label db for tracking purposes
|
||||||
addProdLabel(
|
await addProdLabel(
|
||||||
preprint,
|
preprint,
|
||||||
parseInt(labels?.data.SSCC.slice(10, -1)),
|
parseInt(labels?.data.SSCC.slice(10, -1)),
|
||||||
username || "lst",
|
username || "lst",
|
||||||
@@ -141,12 +143,12 @@ export const preprintLabels = async (preprint: Preprint, username?: string) => {
|
|||||||
"POST",
|
"POST",
|
||||||
"/public/v1.0/Warehousing/GenerateAndPrintLabel",
|
"/public/v1.0/Warehousing/GenerateAndPrintLabel",
|
||||||
{
|
{
|
||||||
scannerId: preprint.scannerId,
|
scannerId: preprint.scannerId.toString(),
|
||||||
lotNr: preprint.lotNr,
|
lotNr: preprint.lotNr.toString(),
|
||||||
machineId: preprint.machineId, // 457=22, 458=23
|
machineId: preprint.machineId.toString(),
|
||||||
printerId: preprint.printerId, // 457=22, 458=23
|
printerId: preprint.printerId.toString(),
|
||||||
layoutId: preprint.layoutId,
|
layoutId: preprint.layoutId.toString(),
|
||||||
numberOfCopies: preprint.numberOfCopies,
|
numberOfCopies: preprint.numberOfCopies.toString(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -173,7 +175,7 @@ export const preprintLabels = async (preprint: Preprint, username?: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
labelsPrinted.push(parseInt(labels.data.SSCC.slice(10, -1)));
|
labelsPrinted.push(parseInt(labels.data.SSCC.slice(10, -1)));
|
||||||
addProdLabel(
|
await addProdLabel(
|
||||||
preprint,
|
preprint,
|
||||||
parseInt(labels?.data.SSCC.slice(10, -1)),
|
parseInt(labels?.data.SSCC.slice(10, -1)),
|
||||||
username || "lst",
|
username || "lst",
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import type { Express, Request, Response } from "express";
|
import type { Express, Request, Response } from "express";
|
||||||
|
import dm from "./routes/demandMgt/dmRoutes.js";
|
||||||
import labeling from "./routes/labeling/labelingRoutes.js";
|
import labeling from "./routes/labeling/labelingRoutes.js";
|
||||||
import schedule from "./routes/scheduler/scheduleRoutes.js";
|
import schedule from "./routes/scheduler/scheduleRoutes.js";
|
||||||
|
|
||||||
export const setupLogisticsRoutes = (app: Express, basePath: string) => {
|
export const setupLogisticsRoutes = (app: Express, basePath: string) => {
|
||||||
app.use(basePath + "/api/logistics/schedule", schedule);
|
app.use(basePath + "/api/logistics/schedule", schedule);
|
||||||
app.use(basePath + "/api/logistics/labeling", labeling);
|
app.use(basePath + "/api/logistics/labeling", labeling);
|
||||||
|
app.use(basePath + "/api/logistics/dm", dm);
|
||||||
|
|
||||||
// app.use(
|
// app.use(
|
||||||
// basePath + "/api/admin/users",
|
// basePath + "/api/admin/users",
|
||||||
|
|||||||
9
app/src/internal/logistics/routes/demandMgt/dmRoutes.ts
Normal file
9
app/src/internal/logistics/routes/demandMgt/dmRoutes.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import { requireAuth } from "../../../../pkg/middleware/authMiddleware.js";
|
||||||
|
import forecastData from "./forecastEDIData.js";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.use("/", forecastData);
|
||||||
|
|
||||||
|
export default router;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user