Now using terratec

Moved from NextJS to Terratec
This commit is contained in:
Ipmake 2024-02-06 08:07:44 +01:00
parent 70e328ef6d
commit 5a96c2ae1b
82 changed files with 22718 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
node_modules
dist
# Keep environment variables out of version control
.env
build

841
backend/package-lock.json generated Normal file
View File

@ -0,0 +1,841 @@
{
"name": "backend",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "backend",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@prisma/client": "^5.3.1",
"chalk": "^4.0.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"prisma": "^5.3.1"
},
"devDependencies": {
"@types/express": "latest",
"@types/node": "latest",
"typescript": "^5.2.2"
}
},
"node_modules/@prisma/client": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.3.1.tgz",
"integrity": "sha512-ArOKjHwdFZIe1cGU56oIfy7wRuTn0FfZjGuU/AjgEBOQh+4rDkB6nF+AGHP8KaVpkBIiHGPQh3IpwQ3xDMdO0Q==",
"hasInstallScript": true,
"dependencies": {
"@prisma/engines-version": "5.3.1-2.61e140623197a131c2a6189271ffee05a7aa9a59"
},
"engines": {
"node": ">=16.13"
},
"peerDependencies": {
"prisma": "*"
},
"peerDependenciesMeta": {
"prisma": {
"optional": true
}
}
},
"node_modules/@prisma/engines": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.3.1.tgz",
"integrity": "sha512-6QkILNyfeeN67BNEPEtkgh3Xo2tm6D7V+UhrkBbRHqKw9CTaz/vvTP/ROwYSP/3JT2MtIutZm/EnhxUiuOPVDA==",
"hasInstallScript": true
},
"node_modules/@prisma/engines-version": {
"version": "5.3.1-2.61e140623197a131c2a6189271ffee05a7aa9a59",
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.3.1-2.61e140623197a131c2a6189271ffee05a7aa9a59.tgz",
"integrity": "sha512-y5qbUi3ql2Xg7XraqcXEdMHh0MocBfnBzDn5GbV1xk23S3Mq8MGs+VjacTNiBh3dtEdUERCrUUG7Z3QaJ+h79w=="
},
"node_modules/@types/body-parser": {
"version": "1.19.3",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.3.tgz",
"integrity": "sha512-oyl4jvAfTGX9Bt6Or4H9ni1Z447/tQuxnZsytsCaExKlmJiU8sFgnIBRzJUpKwB5eWn9HuBYlUlVA74q/yN0eQ==",
"dev": true,
"dependencies": {
"@types/connect": "*",
"@types/node": "*"
}
},
"node_modules/@types/connect": {
"version": "3.4.36",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.36.tgz",
"integrity": "sha512-P63Zd/JUGq+PdrM1lv0Wv5SBYeA2+CORvbrXbngriYY0jzLUWfQMQQxOhjONEz/wlHOAxOdY7CY65rgQdTjq2w==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/express": {
"version": "4.17.17",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
"integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==",
"dev": true,
"dependencies": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^4.17.33",
"@types/qs": "*",
"@types/serve-static": "*"
}
},
"node_modules/@types/express-serve-static-core": {
"version": "4.17.36",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.36.tgz",
"integrity": "sha512-zbivROJ0ZqLAtMzgzIUC4oNqDG9iF0lSsAqpOD9kbs5xcIM3dTiyuHvBc7R8MtWBp3AAWGaovJa+wzWPjLYW7Q==",
"dev": true,
"dependencies": {
"@types/node": "*",
"@types/qs": "*",
"@types/range-parser": "*",
"@types/send": "*"
}
},
"node_modules/@types/http-errors": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.2.tgz",
"integrity": "sha512-lPG6KlZs88gef6aD85z3HNkztpj7w2R7HmR3gygjfXCQmsLloWNARFkMuzKiiY8FGdh1XDpgBdrSf4aKDiA7Kg==",
"dev": true
},
"node_modules/@types/mime": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==",
"dev": true
},
"node_modules/@types/node": {
"version": "20.6.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.2.tgz",
"integrity": "sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==",
"dev": true
},
"node_modules/@types/qs": {
"version": "6.9.8",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.8.tgz",
"integrity": "sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg==",
"dev": true
},
"node_modules/@types/range-parser": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
"dev": true
},
"node_modules/@types/send": {
"version": "0.17.1",
"resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz",
"integrity": "sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==",
"dev": true,
"dependencies": {
"@types/mime": "^1",
"@types/node": "*"
}
},
"node_modules/@types/serve-static": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.2.tgz",
"integrity": "sha512-J2LqtvFYCzaj8pVYKw8klQXrLLk7TBZmQ4ShlcdkELFKGwGMfevMLneMMRkMgZxotOD9wg497LpC7O8PcvAmfw==",
"dev": true,
"dependencies": {
"@types/http-errors": "*",
"@types/mime": "*",
"@types/node": "*"
}
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
"dependencies": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
},
"node_modules/body-parser": {
"version": "1.20.1",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
"integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
"dependencies": {
"bytes": "3.1.2",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
"qs": "6.11.0",
"raw-body": "2.5.1",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"dependencies": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/chalk": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz",
"integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
"dependencies": {
"safe-buffer": "5.2.1"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
"integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
},
"node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/destroy": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/dotenv": {
"version": "16.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/motdotla/dotenv?sponsor=1"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
"version": "4.18.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
"integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
"body-parser": "1.20.1",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.5.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "1.2.0",
"fresh": "0.5.2",
"http-errors": "2.0.0",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.7",
"qs": "6.11.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "0.18.0",
"serve-static": "1.15.0",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.10.0"
}
},
"node_modules/finalhandler": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
"integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
"dependencies": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
"statuses": "2.0.1",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
},
"node_modules/get-intrinsic": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
"dependencies": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-proto": "^1.0.1",
"has-symbols": "^1.0.3"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dependencies": {
"function-bind": "^1.1.1"
},
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"engines": {
"node": ">=8"
}
},
"node_modules/has-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
"dependencies": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
},
"node_modules/methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
},
"node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/object-inspect": {
"version": "1.12.3",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
},
"node_modules/prisma": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.3.1.tgz",
"integrity": "sha512-Wp2msQIlMPHe+5k5Od6xnsI/WNG7UJGgFUJgqv/ygc7kOECZapcSz/iU4NIEzISs3H1W9sFLjAPbg/gOqqtB7A==",
"hasInstallScript": true,
"dependencies": {
"@prisma/engines": "5.3.1"
},
"bin": {
"prisma": "build/index.js"
},
"engines": {
"node": ">=16.13"
}
},
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
"dependencies": {
"forwarded": "0.2.0",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"dependencies": {
"side-channel": "^1.0.4"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
"integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
"dependencies": {
"bytes": "3.1.2",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/send": {
"version": "0.18.0",
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
"integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "2.0.0",
"mime": "1.6.0",
"ms": "2.1.3",
"on-finished": "2.4.1",
"range-parser": "~1.2.1",
"statuses": "2.0.1"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/send/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/serve-static": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
"integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
"dependencies": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.18.0"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"dependencies": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"dependencies": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/typescript": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
"engines": {
"node": ">= 0.8"
}
}
}
}

24
backend/package.json Normal file
View File

@ -0,0 +1,24 @@
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "./dist/index.js",
"scripts": {
"start": "npx tsc && node dist/index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@prisma/client": "^5.3.1",
"chalk": "^4.0.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"prisma": "^5.3.1"
},
"devDependencies": {
"@types/express": "latest",
"@types/node": "latest",
"typescript": "^5.2.2"
}
}

View File

@ -0,0 +1,25 @@
generator client {
provider = "prisma-client-js"
previewFeatures = ["postgresqlExtensions"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
extensions = [uuid_ossp(map: "uuid-ossp")]
}
model users {
ID String @id @default(dbgenerated("uuid_generate_v1()")) @db.Uuid
username String
password String @db.VarChar(128)
token String @db.VarChar(128)
}
model Mitarbeiter {
ID String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
Vorname String
Nachname String
Anstelldatum DateTime @db.Date
Geburtstag DateTime @db.Date
}

BIN
backend/public/AdvanTex.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1,21 @@
{
"files": {
"main.css": "/static/css/main.3145608a.css",
"main.js": "/static/js/main.20c1133d.js",
"static/media/lexend-latin-wght-normal.woff2": "/static/media/lexend-latin-wght-normal.f0861a122355d47a9b27.woff2",
"static/media/overpass-latin-wght-normal.woff2": "/static/media/overpass-latin-wght-normal.4b83544cf101ef6f5e10.woff2",
"static/media/overpass-latin-ext-wght-normal.woff2": "/static/media/overpass-latin-ext-wght-normal.c7886930b5698c36c8d2.woff2",
"static/media/lexend-latin-ext-wght-normal.woff2": "/static/media/lexend-latin-ext-wght-normal.94b395946a6799fff8c8.woff2",
"static/media/overpass-cyrillic-wght-normal.woff2": "/static/media/overpass-cyrillic-wght-normal.5b31761fef8ac8222a1b.woff2",
"static/media/overpass-cyrillic-ext-wght-normal.woff2": "/static/media/overpass-cyrillic-ext-wght-normal.08d0aad8582d63a917c6.woff2",
"static/media/lexend-vietnamese-wght-normal.woff2": "/static/media/lexend-vietnamese-wght-normal.ac5494e335c7c2cb000d.woff2",
"static/media/overpass-vietnamese-wght-normal.woff2": "/static/media/overpass-vietnamese-wght-normal.d1e91653b90562a59206.woff2",
"index.html": "/index.html",
"main.3145608a.css.map": "/static/css/main.3145608a.css.map",
"main.20c1133d.js.map": "/static/js/main.20c1133d.js.map"
},
"entrypoints": [
"static/css/main.3145608a.css",
"static/js/main.20c1133d.js"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

View File

@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>DWL Birthdays</title><script defer="defer" src="/static/js/main.20c1133d.js"></script><link href="/static/css/main.3145608a.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

BIN
backend/public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

View File

@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

View File

@ -0,0 +1,2 @@
body{margin:0;overflow-x:hidden;padding:0}body,label,span{font-family:Arial,Helvetica,sans-serif}@-webkit-keyframes gradientAnim{0%{background-position:0 50%}50%{background-position:100% 50%}to{background-position:0 50%}}@keyframes gradientAnim{0%{background-position:0 50%}50%{background-position:100% 50%}to{background-position:0 50%}}.nav-link{color:#005487;font-size:25px;font-weight:700;letter-spacing:.05em;line-height:24px;overflow:hidden;text-align:center;text-decoration:none;text-overflow:ellipsis;transition:all .3s ease 0s;white-space:nowrap;width:auto!important}.nav-link:after{background:#005487;content:"";display:block;height:2px;margin-left:auto;margin-right:auto;transition:width .3s ease 0s;width:0}.nav-link:hover:after{width:100%}.nav-link-left{color:#005487;font-size:25px;font-weight:700;letter-spacing:.05em;line-height:24px;overflow:hidden;text-align:center;text-decoration:none;text-overflow:ellipsis;transition:all .3s ease 0s;white-space:nowrap;width:auto!important}.nav-link-left:after{background:#fff;content:"";display:block;height:2px;margin-right:auto;transition:width .3s ease 0s;width:0}.nav-link-left:hover:after{width:100%}.se-resizing-bar{display:none!important}.sun-editor-editable{height:auto!important}.se-toolbar{position:-webkit-sticky!important;position:sticky!important;-webkit-transform:translate(-105px);transform:translate(-105px);width:100px!important;z-index:0!important}.se-btn-tray,.se-toolbar{flex-direction:column!important}.se-btn-tray{align-items:flex-start!important;display:flex!important;gap:2px!important}.se-wrapper{margin-top:-480px}.articleBanner{transition:.3s ease}.articleBanner:hover{-webkit-filter:brightness(.7);filter:brightness(.7)}a{color:#000;text-decoration:none}input[name=suneditor_image_radio]{display:none}@font-face{font-display:swap;font-family:Overpass Variable;font-style:normal;font-weight:100 900;src:url(/static/media/overpass-cyrillic-ext-wght-normal.08d0aad8582d63a917c6.woff2) format("woff2-variations");unicode-range:u+0460-052f,u+1c80-1c88,u+20b4,u+2de0-2dff,u+a640-a69f,u+fe2e-fe2f}@font-face{font-display:swap;font-family:Overpass Variable;font-style:normal;font-weight:100 900;src:url(/static/media/overpass-cyrillic-wght-normal.5b31761fef8ac8222a1b.woff2) format("woff2-variations");unicode-range:u+0301,u+0400-045f,u+0490-0491,u+04b0-04b1,u+2116}@font-face{font-display:swap;font-family:Overpass Variable;font-style:normal;font-weight:100 900;src:url(/static/media/overpass-vietnamese-wght-normal.d1e91653b90562a59206.woff2) format("woff2-variations");unicode-range:u+0102-0103,u+0110-0111,u+0128-0129,u+0168-0169,u+01a0-01a1,u+01af-01b0,u+0300-0301,u+0303-0304,u+0308-0309,u+0323,u+0329,u+1ea0-1ef9,u+20ab}@font-face{font-display:swap;font-family:Overpass Variable;font-style:normal;font-weight:100 900;src:url(/static/media/overpass-latin-ext-wght-normal.c7886930b5698c36c8d2.woff2) format("woff2-variations");unicode-range:u+0100-02af,u+0304,u+0308,u+0329,u+1e00-1e9f,u+1ef2-1eff,u+2020,u+20a0-20ab,u+20ad-20cf,u+2113,u+2c60-2c7f,u+a720-a7ff}@font-face{font-display:swap;font-family:Overpass Variable;font-style:normal;font-weight:100 900;src:url(/static/media/overpass-latin-wght-normal.4b83544cf101ef6f5e10.woff2) format("woff2-variations");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+0304,u+0308,u+0329,u+2000-206f,u+2074,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}@font-face{font-display:swap;font-family:Lexend Variable;font-style:normal;font-weight:100 900;src:url(/static/media/lexend-vietnamese-wght-normal.ac5494e335c7c2cb000d.woff2) format("woff2-variations");unicode-range:u+0102-0103,u+0110-0111,u+0128-0129,u+0168-0169,u+01a0-01a1,u+01af-01b0,u+0300-0301,u+0303-0304,u+0308-0309,u+0323,u+0329,u+1ea0-1ef9,u+20ab}@font-face{font-display:swap;font-family:Lexend Variable;font-style:normal;font-weight:100 900;src:url(/static/media/lexend-latin-ext-wght-normal.94b395946a6799fff8c8.woff2) format("woff2-variations");unicode-range:u+0100-02af,u+0304,u+0308,u+0329,u+1e00-1e9f,u+1ef2-1eff,u+2020,u+20a0-20ab,u+20ad-20cf,u+2113,u+2c60-2c7f,u+a720-a7ff}@font-face{font-display:swap;font-family:Lexend Variable;font-style:normal;font-weight:100 900;src:url(/static/media/lexend-latin-wght-normal.f0861a122355d47a9b27.woff2) format("woff2-variations");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+0304,u+0308,u+0329,u+2000-206f,u+2074,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}
/*# sourceMappingURL=main.3145608a.css.map*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,93 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @remix-run/router v1.9.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
/**
* React Router v6.16.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
/**
* [js-sha256]{@link https://github.com/emn178/js-sha256}
*
* @version 0.10.1
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2023
* @license MIT
*/
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
//! moment.js

File diff suppressed because one or more lines are too long

11
backend/public/test.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Loading</title>
</head>
<body>
</body>
</html>

27
backend/src/functions.ts Normal file
View File

@ -0,0 +1,27 @@
import { prisma } from "."
export function errorBuilder(type: string, message: string): Types.ErrorResponse {
return {
error: true,
type,
message
}
}
const Errors = {
MISSING_ITEMS: errorBuilder("missing_items", "Die Anfrage ist Fehlerhaft."),
INVALID_CREDENTIALS: errorBuilder("invalid_credentials", "Die eingegebenen Anmeldedaten sind inkorrekt!"),
NOT_FOUND: errorBuilder("not_found", "Die angeforderte Ressource wurde nicht gefunden!"),
}
export default Errors
export async function authorize(token: string) {
const user = await prisma.users.findFirst({
where: {
token
}
})
if (!user) return false
return user
}

215
backend/src/index.ts Normal file
View File

@ -0,0 +1,215 @@
import { PrismaClient } from '@prisma/client'
import express from 'express'
import dotenv from 'dotenv'
import init from './init'
import Errors, { authorize } from './functions'
import fs from 'fs'
import crypto from 'crypto'
dotenv.config()
const prisma = new PrismaClient()
const app = express()
app.use(express.json({
limit: '50mb'
}))
app.use((req, res, next) => {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "*");
res.setHeader("Access-Control-Allow-Headers", 'Content-Type, Authorization');
next();
})
app.use(express.static('public'))
export { prisma, app }
init()
app.post('/api/auth/login', async (req, res) => {
const { username, password } = req.body
if (!username || !password) {
res.status(400).send(Errors.MISSING_ITEMS)
return
}
const user = await prisma.users.findFirst({
where: {
username
}
})
if (!user) return res.status(401).send(Errors.INVALID_CREDENTIALS)
if (user.password !== password) return res.status(401).send(Errors.INVALID_CREDENTIALS)
res.send({
token: user.token
})
})
app.get('/api/auth/verify', async (req, res) => {
const token = req.headers.authorization?.split(' ')[1]
if (!token) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const user = await authorize(token)
if (!user) return res.status(401).send(Errors.INVALID_CREDENTIALS)
res.send('OK')
})
app.post("/api/worker/create", async (req, res) => {
const token = req.headers.authorization?.split(' ')[1]
if (!token) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const user = await authorize(token)
if (!user) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const { title, content, image, sponsors } = req.body
if (!title || !content || !image) return res.status(400).send(Errors.MISSING_ITEMS)
// sponsors is an array of sponsor IDs
})
app.get('/api/workers', async (req, res) => {
const token = req.headers.authorization?.split(' ')[1]
if (!token) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const user = await authorize(token)
if (!user) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const workers = await prisma.mitarbeiter.findMany({
select: {
Vorname: true,
Nachname: true,
Geburtstag: true,
Anstelldatum: true,
}
})
res.send(workers)
})
app.get('/api/users', async (req, res) => {
const token = req.headers.authorization?.split(' ')[1]
if (!token) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const user = await authorize(token)
if (!user) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const users = await prisma.users.findMany({
select: {
ID: true,
username: true,
}
})
res.send(users)
})
app.get('/api/user/:id', async (req, res) => {
const token = req.headers.authorization?.split(' ')[1]
if (!token) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const user = await authorize(token)
if (!user) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const foundUser = await prisma.users.findUnique({
where: {
ID: req.params.id
},
select: {
ID: true,
username: true
}
})
if (!foundUser) return res.status(404).send(Errors.NOT_FOUND)
res.send(foundUser)
})
app.post('/api/users/create', async (req, res) => {
const token = req.headers.authorization?.split(' ')[1]
if (!token || !req.body) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const user = await authorize(token)
if (!user) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const { username, password } = req.body
if (!username || !password) return res.status(400).send(Errors.MISSING_ITEMS)
const newUser = await prisma.users.create({
data: {
username,
password,
token: crypto.randomBytes(64).toString('hex'),
}
})
res.send(newUser)
})
app.patch('/api/users/edit/:id', async (req, res) => {
const token = req.headers.authorization?.split(' ')[1]
if (!token || !req.body) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const user = await authorize(token)
if (!user) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const { username, password, admin, article_create, article_manage, sponsor_manage, user_manage } = req.body
if (!username || admin === undefined || article_create === undefined || article_manage === undefined || sponsor_manage === undefined || user_manage === undefined) return res.status(400).send(Errors.MISSING_ITEMS)
const newUser = await prisma.users.update({
where: {
ID: req.params.id
},
data: {
username,
admin,
article_create,
article_manage,
sponsor_manage,
user_manage,
...(password && { password })
}
})
res.send(newUser)
})
app.delete('/api/users/delete/:id', async (req, res) => {
const token = req.headers.authorization?.split(' ')[1]
if (!token) return res.status(401).send(Errors.INVALID_CREDENTIALS)
const user = await authorize(token)
if (!user) return res.status(401).send(Errors.INVALID_CREDENTIALS)
await prisma.users.delete({
where: {
ID: req.params.id
}
})
res.send('OK')
})
app.listen(process.env.PORT, () => {
console.log(`Server is running on port ${process.env.PORT}`)
})

30
backend/src/init.ts Normal file
View File

@ -0,0 +1,30 @@
import { prisma } from ".";
import crypto from "crypto";
import Logger from "./logger";
const logger = new Logger("Init");
export default async function init() {
logger.info("Checking database...");
const users = await prisma.users.count();
if (users === 0) {
logger.warn("No users found, creating admin user...");
await prisma.$transaction([
prisma.users.create({
data: {
username: "admin",
password: crypto
.createHash("sha256")
.update("rheine admin rheine")
.digest("hex"),
token: crypto.randomBytes(64).toString("hex"),
},
}),
]);
logger.info("Admin user created! Username: admin, Password: admin");
}
logger.info("Database is ready!");
}

43
backend/src/logger.ts Normal file
View File

@ -0,0 +1,43 @@
import chalk from "chalk";
export default class Logger {
space: string;
static getTime(): string {
const date = new Date();
const hours = date.getHours();
const minutes = date.getMinutes();
const seconds = date.getSeconds();
return `${hours < 10 ? '0' : ''}${hours}:${minutes < 10 ? '0' : ''}${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
}
constructor(name: string) {
this.space = name;
}
public log(message: string): void {
console.log(`[${Logger.getTime()}] [${this.space}] ${chalk.blue('[LOGS]')} ${message}`);
}
public warn(message: string): void {
console.log(`[${Logger.getTime()}] [${this.space}] ${chalk.yellow('[WARN]')} ${message}`);
}
public error(message: string): void {
console.log(`[${Logger.getTime()}] [${this.space}] ${chalk.red('[ERROR]')} ${message}`);
}
public info(message: string): void {
console.log(`[${Logger.getTime()}] [${this.space}] ${chalk.green('[INFO]')} ${message}`);
}
public debug(message: string): void {
if(!process.env.LOG_DEBUG) return;
console.log(`[${Logger.getTime()}] [${this.space}] ${chalk.magenta('[DEBG]')} ${message}`);
}
public fatal(message: string): void {
console.log(chalk.bgRed(`[${Logger.getTime()}] [${this.space}] ${chalk.bold('[FATL]')} ${message}`));
}
}

7
backend/src/types.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
declare namespace Types {
interface ErrorResponse {
error: true
type: string
message: string
}
}

109
backend/tsconfig.json Normal file
View File

@ -0,0 +1,109 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "NodeNext", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
"noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

46
frontend/README.md Normal file
View File

@ -0,0 +1,46 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).

17959
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

54
frontend/package.json Normal file
View File

@ -0,0 +1,54 @@
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fontsource-variable/lexend": "^5.0.12",
"@fontsource-variable/overpass": "^5.0.9",
"@mui/icons-material": "^5.14.9",
"@mui/lab": "^5.0.0-alpha.154",
"@mui/material": "^5.14.10",
"@mui/x-data-grid": "^6.19.1",
"@types/node": "^16.18.52",
"@types/react": "^18.2.22",
"@types/react-dom": "^18.2.7",
"axios": "^1.5.1",
"js-sha256": "^0.10.1",
"moment": "^2.29.4",
"react": "^18.2.0",
"react-calendar": "^4.8.0",
"react-dom": "^18.2.0",
"react-intersection-observer": "^9.5.2",
"react-router-dom": "^6.16.0",
"react-scripts": "5.0.1",
"suneditor": "^2.45.1",
"suneditor-react": "^3.6.1",
"typescript": "^4.9.5",
"zustand": "^4.4.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && cp -a build/* ../backend/public",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>DWL Birthdays</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

BIN
frontend/public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

View File

@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

11
frontend/public/test.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Loading</title>
</head>
<body>
</body>
</html>

20
frontend/src/App.tsx Normal file
View File

@ -0,0 +1,20 @@
import { Routes, Route } from "react-router-dom";
// @Pages
import LandingPage from "./pages/LandingPage";
import LoginPage from "./pages/Login";
import NotFound from "./pages/404";
import AdminFrame from "./pages/AdminFrame";
function App() {
return (
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/login" element={<LoginPage />} />
<Route path="/admin/*" element={<AdminFrame />} />
<Route path="*" element={<NotFound />} />
</Routes>
);
}
export default App;

View File

@ -0,0 +1,32 @@
import { Typography } from "@mui/material";
import { CSSProperties } from "react";
import { Link } from "react-router-dom";
function NavLink({
children,
to,
style,
}: {
children: string;
to: string;
style?: CSSProperties;
}) {
return (
<Link
to={to}
style={style}
onClick={() => {
const element = document.getElementById(to.replaceAll("#", ""));
if (element) {
element.scrollIntoView({ behavior: "smooth" });
}
}}
>
<Typography fontSize="20px" fontWeight="bold" className="nav-link">
{children}
</Typography>
</Link>
);
}
export default NavLink;

View File

@ -0,0 +1,63 @@
import { Box, Divider } from "@mui/material"
import SidebarElement from "./SidebarElement"
import { ArrowBack, Home, Logout, Newspaper, Person, TableChartOutlined, Event } from "@mui/icons-material"
function Sidebar() {
return (
<Box sx={{
width: "250px",
height: "100vh",
position: "fixed",
top: "0",
left: "0",
backgroundColor: "#121212",
boxShadow: "0 0 10px #00000055",
zIndex: 1000,
display: "flex",
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "center",
py: "10px",
}}>
<img src="/logo.png" alt="logo" style={{
width: "80%",
marginBottom: "10px",
}} />
<Divider sx={{
width: "100%",
height: "1px",
mb: "5px",
}} />
<Box sx={{
width: "100%",
height: "100%",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
gap: "2px",
}}>
<SidebarElement Title="Dashboard" Icon={Home} Path="/admin/dashboard" />
<SidebarElement Title="Daten import" Icon={TableChartOutlined} Path="/admin/import" />
<SidebarElement Title="Kalender" Icon={Event} Path="/admin/Kalender" />
<SidebarElement Title="Benutzer" Icon={Person} Path="/admin/benutzer" />
<SidebarElement Title="Zur Website" Icon={ArrowBack} Path="/" sx={{
mt: "auto",
}} />
<SidebarElement Title="Logout" Icon={Logout} Path="/admin/logout" />
</Box>
</Box>
)
}
export default Sidebar

View File

@ -0,0 +1,67 @@
import { Box, SvgIconTypeMap, SxProps, Theme, Typography } from "@mui/material";
import { OverridableComponent } from "@mui/material/OverridableComponent";
import { useLocation, useNavigate } from "react-router-dom";
function SidebarElement({
Title,
Icon,
Path,
sx
}: {
Title: string;
Icon: OverridableComponent<SvgIconTypeMap<{}, "svg">> & {
muiName: string;
};
Path: string;
sx?: SxProps<Theme>;
}) {
const navigate = useNavigate();
const location = useLocation();
return (
<Box
sx={{
width: "100%",
height: "50px",
cursor: "pointer",
backgroundColor: theme => location.pathname === Path ? theme.palette.primary.light : "#00000011",
display: "flex",
flexDirection: "row",
justifyContent: "flex-start",
alignItems: "center",
gap: "15px",
px: "20px",
transition: "all 0.2s ease-in-out",
"&:hover": {
gap: "25px",
background: (theme) => theme.palette.primary.main,
},
...sx
}}
onClick={() => navigate(Path)}
>
<Icon
sx={{
fontSize: "30px",
color: "#fff",
}}
/>
<Typography
sx={{
fontFamily: "Lexend Variable",
fontSize: "20px",
fontWeight: "bold",
color: "#fff",
}}
>
{Title}
</Typography>
</Box>
);
}
export default SidebarElement;

View File

@ -0,0 +1,380 @@
import { Close } from "@mui/icons-material";
import {
Backdrop,
Box,
Button,
Checkbox,
CircularProgress,
IconButton,
Stack,
TextField,
Typography,
} from "@mui/material";
import { useEffect, useState } from "react";
import axios from "axios";
import { getBaseURL } from "../functions";
import { LoadingButton } from "@mui/lab";
import { sha256 } from "js-sha256";
function UserModal({
id,
onClose,
}: {
id: string | null;
onClose?: () => void;
}) {
const [saving, setSaving] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
const [username, setUsername] = useState<string>("");
const [password, setPassword] = useState<string>("");
const [permissions, setPermissions] = useState<Types.UserPermissions>({
admin: false,
article_create: false,
article_manage: false,
sponsor_manage: false,
user_manage: false,
});
const valid = () => {
if (!username) return false;
if (!password && id === "create") return false;
return true;
};
useEffect(() => {
setUsername("");
setPassword("");
setPermissions({
admin: false,
article_create: false,
article_manage: false,
sponsor_manage: false,
user_manage: false,
});
if (!id) return;
if (id === "create") return;
setLoading(true);
axios
.get(`${getBaseURL()}/api/user/${id}`, {
headers: {
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
})
.then((res) => {
setUsername(res.data.username);
setPermissions({
admin: res.data.admin,
article_create: res.data.article_create,
article_manage: res.data.article_manage,
sponsor_manage: res.data.sponsor_manage,
user_manage: res.data.user_manage,
});
setLoading(false);
});
}, [id]);
if (!id) return <></>;
if (loading)
return (
<Backdrop
open={true}
sx={{
zIndex: 2000,
flexDirection: "column",
}}
>
<CircularProgress />
<Typography
sx={{
fontFamily: "Lexend Variable",
fontSize: "20px",
fontWeight: "bold",
color: "#fff",
}}
>
Lade...
</Typography>
</Backdrop>
);
return (
<>
<Backdrop
open={true}
sx={{
zIndex: 2000,
}}
>
<Box
sx={{
width: "500px",
height: "auto",
padding: "10px",
backgroundColor: "#fff",
boxShadow: "0px 0px 10px #00000033",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
gap: "10px",
}}
>
<Box
sx={{
width: "100%",
height: "auto",
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
}}
>
<Box
sx={{
width: "40px",
}}
/>
<Typography
sx={{
fontFamily: "Lexend Variable",
fontSize: "28px",
fontWeight: 700,
textAlign: "center",
}}
>
Benutzer {id === "create" ? "Erstellen" : "Bearbeiten"}
</Typography>
<IconButton onClick={onClose}>
<Close />
</IconButton>
</Box>
<TextField
label="Benutzername"
variant="outlined"
value={username}
onChange={(e) => {
if (e.target.value.length >= 64) return;
if (e.target.value.includes("\n")) return;
setUsername(e.target.value);
}}
sx={{
width: "80%",
}}
/>
<TextField
label="Passwort"
variant="outlined"
value={password}
type="password"
onChange={(e) => {
if (e.target.value.length >= 64) return;
if (e.target.value.includes("\n")) return;
setPassword(e.target.value);
}}
sx={{
width: "80%",
}}
/>
<Box
sx={{
display: "flex",
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "flex-start",
width: "80%",
mx: "20px",
}}
>
<Stack
direction="row"
spacing={1}
justifyContent="center"
alignItems="center"
>
<Checkbox
checked={permissions.admin}
onChange={(e) => {
setPermissions({
...permissions,
admin: e.target.checked,
});
}}
/>
Admin
</Stack>
<Stack
direction="row"
spacing={1}
justifyContent="center"
alignItems="center"
>
<Checkbox
disabled={permissions.admin}
checked={permissions.article_create}
onChange={(e) => {
setPermissions({
...permissions,
article_create: e.target.checked,
});
}}
/>
Artikel Erstellen
</Stack>
<Stack
direction="row"
spacing={1}
justifyContent="center"
alignItems="center"
>
<Checkbox
disabled={permissions.admin}
checked={permissions.article_manage}
onChange={(e) => {
setPermissions({
...permissions,
article_manage: e.target.checked,
});
}}
/>
Artikel Verwalten
</Stack>
<Stack
direction="row"
spacing={1}
justifyContent="center"
alignItems="center"
>
<Checkbox
disabled={permissions.admin}
checked={permissions.sponsor_manage}
onChange={(e) => {
setPermissions({
...permissions,
sponsor_manage: e.target.checked,
});
}}
/>
Sponsoren Verwalten
</Stack>
<Stack
direction="row"
spacing={1}
justifyContent="center"
alignItems="center"
>
<Checkbox
disabled={permissions.admin}
checked={permissions.user_manage}
onChange={(e) => {
setPermissions({
...permissions,
user_manage: e.target.checked,
});
}}
/>
Nutzer Verwalten
</Stack>
</Box>
<LoadingButton
variant="contained"
sx={{ width: "80%" }}
disabled={!valid()}
onClick={() => {
setSaving(true);
if (id === "create") {
axios
.post(
`${getBaseURL()}/api/users/create`,
{
username,
password: sha256(`rheine ${password.trim()} rheine`),
admin: permissions.admin,
article_create: permissions.admin
? false
: permissions.article_create,
article_manage: permissions.admin
? false
: permissions.article_manage,
sponsor_manage: permissions.admin
? false
: permissions.sponsor_manage,
user_manage: permissions.admin
? false
: permissions.user_manage,
},
{
headers: {
Authorization: `Bearer ${localStorage.getItem(
"token"
)}`,
},
}
)
.then(() => {
window.location.reload();
});
} else {
axios
.patch(
`${getBaseURL()}/api/users/edit/${id}`,
{
username,
password: password
? sha256(`rheine ${password.trim()} rheine`)
: undefined,
admin: permissions.admin,
article_create: permissions.admin
? false
: permissions.article_create,
article_manage: permissions.admin
? false
: permissions.article_manage,
sponsor_manage: permissions.admin
? false
: permissions.sponsor_manage,
user_manage: permissions.admin
? false
: permissions.user_manage,
},
{
headers: {
Authorization: `Bearer ${localStorage.getItem(
"token"
)}`,
},
}
)
.then(() => {
window.location.reload();
});
}
}}
loading={saving}
>
Speichern
</LoadingButton>
</Box>
</Backdrop>
</>
);
}
export default UserModal;

12
frontend/src/functions.ts Normal file
View File

@ -0,0 +1,12 @@
export function getBaseURL(): string {
if(process.env.NODE_ENV === "development") return "http://100.108.94.138:3001"
else return ""
}
export function resizeIframe(obj: HTMLIFrameElement) {
obj.style.height = (obj.contentWindow as any).document.documentElement.scrollHeight + 'px';
}
export function formatNum(num: number) {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}

130
frontend/src/index.css Normal file
View File

@ -0,0 +1,130 @@
body {
margin: 0;
padding: 0;
overflow-x: hidden;
font-family: Arial, Helvetica, sans-serif;
}
span, label {
font-family: Arial, Helvetica, sans-serif;
}
@keyframes gradientAnim {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.nav-link {
color: #005487;
font-weight: bold;
font-size: 25px;
line-height: 24px;
letter-spacing: 0.05em;
text-align: center;
text-decoration: none;
transition: all 0.3s ease 0s;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: auto !important;
}
.nav-link::after {
content: "";
display: block;
width: 0;
height: 2px;
background: #005487;
transition: width 0.3s ease 0s;
margin-left: auto;
margin-right: auto;
}
.nav-link:hover::after {
width: 100%;
}
a {
text-decoration: none;
}
.nav-link-left {
color: #005487;
font-weight: bold;
font-size: 25px;
line-height: 24px;
letter-spacing: 0.05em;
text-align: center;
text-decoration: none;
transition: all 0.3s ease 0s;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: auto !important;
}
.nav-link-left::after {
content: "";
display: block;
width: 0;
height: 2px;
background: #fff;
transition: width 0.3s ease 0s;
margin-right: auto;
}
.nav-link-left:hover::after {
width: 100%;
}
.se-resizing-bar {
display: none !important;
}
.sun-editor-editable {
height: auto !important;
}
.se-toolbar{
position: sticky !important;
flex-direction: column !important;
width: 100px !important;
transform: translate(-105px);
z-index: 0 !important;
}
.se-btn-tray {
display: flex !important;
flex-direction: column !important;
align-items: flex-start !important;
gap: 2px !important;
}
.se-wrapper {
margin-top: -480px;
}
.articleBanner {
transition: ease 0.3s;
}
.articleBanner:hover {
filter: brightness(0.7);
}
a {
color: #000;
text-decoration: none;
}
input[name="suneditor_image_radio"] {
display: none;
}

46
frontend/src/index.tsx Normal file
View File

@ -0,0 +1,46 @@
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import { createTheme, ThemeProvider, CssBaseline } from "@mui/material";
import { BrowserRouter } from "react-router-dom";
// fonts
import '@fontsource-variable/overpass';
import '@fontsource-variable/lexend';
const theme = createTheme({
palette: {
mode: "dark",
primary: {
main: "#003263",
},
secondary: {
main: "#9bc9e5",
},
},
// make the buttons not rounded
components: {
MuiButton: {
styleOverrides: {
root: {
borderRadius: 0,
fontFamily: "Lexend Variable",
},
},
},
},
});
export { theme };
const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement
);
root.render(
<ThemeProvider theme={theme}>
<CssBaseline />
<BrowserRouter>
<App />
</BrowserRouter>
</ThemeProvider>
);

View File

@ -0,0 +1,87 @@
import { Box, Button, Typography } from "@mui/material";
import { useNavigate } from "react-router-dom";
import {HouseOutlined } from "@mui/icons-material";
function NotFound() {
const navigate = useNavigate();
return (
<Box
sx={{
position: "absolute",
width: "100vw",
height: "100vh",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
background: `linear-gradient(45deg, #0022ff55, #00AA0099)`,
}}
>
<Box
sx={{
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
}}
>
<Typography
sx={{
fontWeight: "bold",
fontSize: "10rem",
lineHeight: "1.2",
textAlign: "right",
background: `linear-gradient(45deg, #0022ff, #00AA00)`,
backgroundClip: "text",
backgroundSize: "cover",
backgroundPosition: "center",
backgroundRepeat: "no-repeat",
color: "transparent",
}}
>
404
</Typography>
<Typography
sx={{
fontWeight: "light",
fontSize: "2rem",
lineHeight: "1.2",
textAlign: "center",
background: `linear-gradient(45deg, #0022ff, #00AA00)`,
backgroundClip: "text",
backgroundSize: "cover",
backgroundPosition: "center",
backgroundRepeat: "no-repeat",
color: "transparent",
}}
>
Seite nicht gefunden
</Typography>
<Button
variant="contained"
color="secondary"
startIcon={< HouseOutlined />}
sx={{
mt: "2rem",
color: "#fff",
}}
onClick={() => {
navigate("/");
}}
>
Zurück zur Startseite
</Button>
</Box>
</Box>
);
}
export default NotFound;

View File

@ -0,0 +1,42 @@
import { Box } from "@mui/material";
import { Route, Routes } from "react-router-dom";
import Sidebar from "../components/Sidebar";
import Dashboard from "./admin/Dashboard";
import Benutzer from "./admin/Benutzer";
import Logout from "./admin/Logout";
import Import from "./admin/Import";
import Kalender from "./admin/Kalender";
function AdminFrame() {
return (
<Box
sx={{
width: "100%",
height: "auto",
display: "flex",
flexDirection: "row",
justifyContent: "flex-start",
alignItems: "flex-start",
gap: "10px",
}}
>
<Sidebar />
<Box sx={{
marginLeft: "255px",
width: "calc(100% - 255px)",
}}>
<Routes>
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/benutzer" element={<Benutzer />} />
<Route path="/logout" element={<Logout />} />
<Route path="/import" element={<Import />} />
<Route path="/kalender" element={<Kalender />} />
</Routes>
</Box>
</Box>
);
}
export default AdminFrame;

View File

@ -0,0 +1,133 @@
import { Typography, Button, Box, Grid, CircularProgress } from "@mui/material";
import { BadgeOutlined } from "@mui/icons-material";
import { useTheme } from "@mui/material";
import { useLocation } from "react-router-dom";
import { useEffect, useState } from "react";
import axios from "axios";
import { getBaseURL } from "../functions";
function LandingPage() {
const theme = useTheme();
const location = useLocation();
useEffect(() => {
const element = document.getElementById(location.hash.replaceAll("#", ""));
if (element) {
element.scrollIntoView({ behavior: "smooth" });
}
}, [location]);
return (
<>
<Box
sx={{
width: "100%",
height: "calc(100vh - 100px)",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
}}
>
<video
src="/assets/backgroundvid1.webm"
autoPlay
loop
muted
style={{
height: "100vh",
width: "100vw",
position: "absolute",
top: "50px",
zIndex: -1,
filter: "brightness(0.25)",
objectFit: "cover",
minWidth: "100vw",
minHeight: "100vh",
}}
/>
<Typography
sx={{
color: "#fff",
fontWeight: "bolder",
fontSize: "7rem",
letterSpacing: "0.05rem",
lineHeight: "1.2",
textAlign: "center",
"@media (max-width: 1200px)": {
fontSize: "4rem",
},
}}
>
von Rheine für Rheine
</Typography>
<Typography
sx={{
color: "#fff",
fontWeight: "light",
fontFamily: "Overpass Variable",
fontSize: "1.25rem",
textAlign: "center",
}}
>
Als regionale Unternehmen unterstützen wir regionale Vorhaben.
</Typography>
</Box>
<Box
sx={{
width: "100%",
height: "200px",
background: `linear-gradient(45deg, #2f5c01, ${theme.palette.primary.main})`,
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
}}
>
<Typography
sx={{
color: "#fff",
fontWeight: "bolder",
fontSize: "2rem",
letterSpacing: "0.05rem",
lineHeight: "1.2",
textAlign: "center",
}}
>
Wir sind dabei !
</Typography>
<Typography
sx={{
color: "#fff",
fontWeight: "light",
fontFamily: "sans-serif",
fontSize: "1rem",
textAlign: "center",
}}
>
Danke an die bisherigen Teilnehmer !
</Typography>
<Button
variant="contained"
color="secondary"
startIcon={<BadgeOutlined />}
sx={{
color: "#fff",
marginTop: "1rem",
"&:hover": {
transform: "scale(1.1)",
},
}}
href="mailto:info@rheine-tourismus.de?subject=Wir%20m%C3%B6chten%20Sponsor%20werden!%20"
>
Sponsor Werden!
</Button>
</Box>
</>
);
}
export default LandingPage;

View File

@ -0,0 +1,224 @@
import {
LockOutlined,
PersonOutlineOutlined,
ArrowForwardOutlined,
} from "@mui/icons-material";
import {
Alert,
Box,
Button,
CircularProgress,
Collapse,
InputAdornment,
TextField,
} from "@mui/material";
import axios, { AxiosError } from "axios";
import { sha256 } from "js-sha256";
import { useEffect, useState } from "react";
import { getBaseURL } from "../functions";
let backgrounds = ["/assets/background1.jpg", "/assets/background2.jpg"];
function Login() {
const [loading, setLoading] = useState(true);
const [error, setError] = useState<false | string>(false);
const [currentBackground, setCurrentBackground] = useState(0);
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
const valid = () => {
if (username.length < 3) return false;
if (password.length < 3) return false;
return true;
};
const login = () => {
setLoading(true);
axios
.post(`${getBaseURL()}/api/auth/login`, {
username: username.trim(),
password: sha256(`rheine ${password.trim()} rheine`),
})
.then((res) => {
localStorage.setItem("token", res.data.token);
setTimeout(() => (window.location.href = "/admin/dashboard"), 1000);
})
.catch((err: AxiosError) => {
setLoading(false);
if ((err.response?.data as any).message) {
setError((err.response?.data as any).message);
} else {
setError(err.message);
}
});
};
useEffect(() => {
const interval = setInterval(() => {
setCurrentBackground((current) => (current + 1) % backgrounds.length);
}, 15000);
return () => clearInterval(interval);
}, []);
useEffect(() => {
if (localStorage.getItem("token")) {
axios
.get(`${getBaseURL()}/api/auth/verify`, {
headers: { Authorization: `Bearer ${localStorage.getItem("token")}` },
})
.then((res) => {
window.location.href = "/admin/dashboard";
})
.catch((err) => {
localStorage.removeItem("token");
setLoading(false);
});
} else {
setLoading(false);
}
}, []);
return (
<Box
sx={{
width: "100vw",
height: "100vh",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
background: `linear-gradient(45deg, #0022ff55, #00AA0099)`,
backgroundSize: "cover",
backgroundPosition: "center",
backgroundRepeat: "no-repeat",
backgroundAttachment: "fixed",
objectFit: "cover",
zIndex: 1,
}}
>
{backgrounds.map((background, index) => (
<img
src={background}
alt=""
key={index}
style={{
position: "absolute",
width: "100vw",
height: "100vh",
objectFit: "cover",
zIndex: -1,
opacity: currentBackground === index ? 1 : 0,
transition: "opacity 5s ease-in-out",
}}
/>
))}
<Box
sx={{
width: "500px",
height: "500px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
gap: "20px",
backgroundColor: "#fff",
}}
>
<img
src="/logo.png"
alt=""
width="250px"
style={{
marginBottom: "30px",
pointerEvents: "none",
userSelect: "none",
}}
/>
<Collapse in={error !== false}>
<Alert severity="error" sx={{ width: "300px" }}>
{error}
</Alert>
</Collapse>
<TextField
required
variant="outlined"
label="Benutzername"
type="username"
value={username}
onKeyDown={(e) => {
if (e.key === "Enter") login();
}}
onChange={(e) => setUsername(e.target.value)}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<PersonOutlineOutlined />
</InputAdornment>
),
}}
sx={{
width: "300px",
height: "50px",
}}
/>
<TextField
required
variant="outlined"
label="Passwort"
type="password"
onKeyDown={(e) => {
if (e.key === "Enter") login();
}}
value={password}
onChange={(e) => setPassword(e.target.value)}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<LockOutlined />
</InputAdornment>
),
}}
sx={{
width: "300px",
height: "50px",
}}
/>
<Button
variant="contained"
endIcon={
<ArrowForwardOutlined
sx={{
display: loading ? "none" : "block",
}}
/>
}
onClick={login}
disabled={loading || !valid()}
sx={{
mt: "20px",
width: "100px",
gap: "0px",
backgroundColor: (theme) => theme.palette.primary.main,
transition: "all 0.3s ease-in-out",
"&:hover": {
gap: "10px",
},
}}
>
{loading ? <CircularProgress size={20} /> : "Login"}
</Button>
</Box>
</Box>
);
}
export default Login;

View File

@ -0,0 +1,202 @@
import { ManageAccounts, PersonAdd, PersonRemove } from "@mui/icons-material";
import {
Box,
Button,
Divider,
IconButton,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
Typography,
} from "@mui/material";
import axios from "axios";
import { useEffect, useState } from "react";
import { getBaseURL } from "../../functions";
import UserModal from "../../components/UserModal";
function Benutzer() {
const [modalID, setModelID] = useState<string | null>(null);
const [users, setUsers] = useState<Types.User[]>([]);
useEffect(() => {
axios
.get(`${getBaseURL()}/api/users`, {
headers: {
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
})
.then((response) => {
setUsers(response.data);
})
.catch((error) => {
console.log(error);
});
}, []);
return (
<>
<UserModal
id={modalID}
onClose={() => {
setModelID(null);
}}
/>
<Box
sx={{
width: "100%",
pt: "30px",
px: "30px",
display: "flex",
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "flex-start",
}}
>
<Box
sx={{
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
width: "100%",
}}
>
<Typography
sx={{
fontFamily: "Lexend Variable",
fontSize: "40px",
fontWeight: "bold",
ml: "20px",
}}
>
Benutzer
</Typography>
<Button
variant="contained"
sx={{
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
gap: "10px",
}}
onClick={() => {
setModelID("create");
}}
>
<PersonAdd /> Neuer Benutzer
</Button>
</Box>
<Divider
sx={{
width: "100%",
backgroundColor: "#000000AA",
}}
/>
<Table
sx={{
width: "100%",
mt: "30px",
}}
>
<TableHead>
<TableRow>
<TableCell align="left" width="700px">
Name
</TableCell>
<TableCell align="right">Berechtigungen</TableCell>
<TableCell align="right"></TableCell>
</TableRow>
</TableHead>
<TableBody>
{users.map((user) => (
<TableRow>
<TableCell align="left">{user.username}</TableCell>
<TableCell align="right">
{[
{ name: "Admin", value: user.admin },
{ name: "Artikel Erstellen", value: user.article_create },
{ name: "Artikel Verwalten", value: user.article_manage },
{ name: "Sponsoren Verwalten", value: user.sponsor_manage },
{ name: "Nutzer Verwalten", value: user.user_manage },
]
.filter((e) => e.value)
.map((e) => e.name)
.join(", ")}
</TableCell>
<TableCell align="right">
<Box
sx={{
display: "flex",
flexDirection: "row",
justifyContent: "flex-end",
alignItems: "center",
gap: "10px",
}}
>
<IconButton
sx={{
width: "30px",
height: "30px",
padding: "5px",
backgroundColor: "#fff",
borderRadius: "5px",
}}
onClick={() => {
setModelID(user.ID);
}}
>
<ManageAccounts />
</IconButton>
<IconButton
sx={{
width: "30px",
height: "30px",
padding: "5px",
backgroundColor: "#fff",
borderRadius: "5px",
"&:hover": {
background: "red",
},
}}
onClick={() => {
axios
.delete(`${getBaseURL()}/api/users/delete/${user.ID}`, {
headers: {
Authorization: `Bearer ${localStorage.getItem(
"token"
)}`,
},
})
.then(() => {
setUsers(
users.filter((e) => e.ID !== user.ID)
);
});
}}
>
<PersonRemove />
</IconButton>
</Box>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Box>
</>
);
}
export default Benutzer;

View File

@ -0,0 +1,115 @@
import { Visibility, Newspaper, Person, Savings } from "@mui/icons-material";
import { Box, Grid, SvgIconTypeMap, Typography } from "@mui/material";
import { OverridableComponent } from "@mui/material/OverridableComponent";
import axios from "axios";
import { useEffect, useState } from "react";
import { getBaseURL } from "../../functions";
import { DataGrid, GridColDef, GridValueGetterParams } from "@mui/x-data-grid";
import moment from "moment";
const columns: GridColDef[] = [
{
field: "Vorname",
headerName: "Vorname",
width: 150,
},
{
field: "Nachname",
headerName: "Nachname",
width: 150,
},
{
field: "Anstelldatum",
headerName: "Anstelldatum",
type: "date",
width: 160,
valueFormatter: params => moment(params.value).format("DD.MM.YYYY")
},
{
field: "Geburtstag",
headerName: "Geburtstag",
type: "date",
width: 160,
valueFormatter: params => moment(params.value).format("DD.MM.YYYY")
},
];
function Dashboard() {
const [workers, setWorkers] = useState<Types.Worker[]>([]);
useEffect(() => {
axios
.get(`${getBaseURL()}/api/workers`, {
headers: {
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
})
.then((res) => {
setWorkers(res.data);
})
.catch((err) => {
console.log(err);
});
}, []);
const rows = workers.map((worker, index) => ({
id: index,
Vorname: worker.Vorname,
Nachname: worker.Nachname,
Geburtstag: worker.Geburtstag,
Anstelldatum: worker.Anstelldatum,
}))
return (
<Box
sx={{
width: "100%",
height: "auto",
display: "flex",
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "flex-start",
pt: "30px",
px: "30px",
}}
>
<Typography variant="h4" sx={{ fontWeight: "bold" }}>
Nächste Geburtstage
</Typography>
<DataGrid
rows={rows}
columns={columns}
sx={{
fontSize: "1rem",
marginTop: "1rem",
borderRadius: "20px",
width: "100%",
height: "auto",
}}
initialState={{
sorting: {
sortModel: [
{
field: 'commodity',
sort: 'asc',
},
],
},
pagination: {
paginationModel: {
pageSize: 15,
},
},
}}
checkboxSelection
/>
</Box>
);
}
export default Dashboard;

View File

@ -0,0 +1,108 @@
import React, { useState, ChangeEvent, FormEvent } from "react";
import { Box, Button, Typography } from "@mui/material";
import { DataGrid, GridColDef } from "@mui/x-data-grid";
import moment from "moment";
function Import() {
const [file, setFile] = useState<File | null>(null);
const [csvData, setCsvData] = useState<
Array<{ [key: string]: string } | null>
>([]);
const fileReader = new FileReader();
const handleOnChange = (e: ChangeEvent<HTMLInputElement>) => {
if (e.target.files) {
setFile(e.target.files[0]);
}
};
const csvFileToArray = (string: string) => {
const csvRows = string.split("\n");
const csvHeader = csvRows[0].split(";");
const newArray = csvRows
.slice(1)
.map((row) => {
const values = row.split(";");
if (values.length === csvHeader.length) {
const obj: { [key: string]: string } = {};
csvHeader.forEach((header, index) => {
obj[header] = values[index] ? values[index].replace(/"/g, "") : "";
});
return obj;
}
return null;
})
.filter(Boolean);
setCsvData(newArray);
};
const handleOnSubmit = (e: FormEvent) => {
e.preventDefault();
if (file) {
fileReader.onload = function (event) {
if (event.target?.result) {
const text = event.target.result.toString();
csvFileToArray(text);
}
};
fileReader.readAsText(file);
}
};
return (
<Box sx={{ textAlign: "center" }}>
<Typography variant="h1">CSV IMPORT</Typography>
<form>
<input
type="file"
id="csvFileInput"
accept=".csv"
onChange={handleOnChange}
/>
<Button onClick={(e) => handleOnSubmit(e)}>IMPORT CSV</Button>
</form>
<br />
{csvData.length > 0 ? (
<div>
<Typography variant="h4">Imported Data</Typography>
<DataGrid
rows={csvData.map((row, index) => ({ id: index, ...row }))}
columns={
csvData.length > 0
? Object.keys(csvData[0] || {}).map(
(header) =>
({
field: header,
headerName: header.replace(/"/g, ""),
width: 150,
valueFormatter(params) {
if (params.value) {
if (moment(params.value, "DD/MM/YYYY").isValid()) {
return moment(params.value).format(
"DD/MM/YYYY"
);
}
}
return params.value;
},
} as GridColDef)
)
: []
}
/>
</div>
) : (
<p>No data to display</p>
)}
</Box>
);
}
export default Import;

View File

@ -0,0 +1,11 @@
function Kalender() {
return (
<div className="container">
</div>
);
}
export default Kalender;

View File

@ -0,0 +1,31 @@
import { Backdrop, CircularProgress, Typography } from "@mui/material"
import { useEffect } from "react"
function Logout() {
useEffect(() => {
localStorage.removeItem("token")
setTimeout(() => {
window.location.href = "/login"
}, 1000)
}, [])
return (
<Backdrop open={true} sx={{
zIndex: 1000,
flexDirection: "column",
display: "flex",
}}>
<CircularProgress />
<Typography sx={{
fontFamily: "Lexend Variable",
fontSize: "20px",
fontWeight: "bold",
color: "#fff",
}}>
Logge aus...
</Typography>
</Backdrop>
)
}
export default Logout

28
frontend/src/types.d.ts vendored Normal file
View File

@ -0,0 +1,28 @@
declare namespace Types {
interface Worker {
Vorname: string;
Nachname: string;
Geburtstag: Date;
Anstelldatum: Date;
}
interface User extends UserPermissions {
ID: string;
username: string;
}
interface UserPermissions {
admin: boolean;
article_create: boolean;
article_manage: boolean;
sponsor_manage: boolean;
user_manage: boolean;
}
interface Sponsor {
ID: string;
name: string;
url: string;
description: string;
addedAt: Date;
}
}

26
frontend/tsconfig.json Normal file
View File

@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}

657
manager/package-lock.json generated Normal file
View File

@ -0,0 +1,657 @@
{
"name": "manager",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "manager",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@inquirer/prompts": "^3.3.0",
"chalk": "^3.0.0"
},
"devDependencies": {
"@types/inquirer": "^9.0.7",
"@types/node": "^20.11.5",
"typescript": "^5.3.3"
}
},
"node_modules/@inquirer/checkbox": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-1.5.0.tgz",
"integrity": "sha512-3cKJkW1vIZAs4NaS0reFsnpAjP0azffYII4I2R7PTI7ZTMg5Y1at4vzXccOH3762b2c2L4drBhpJpf9uiaGNxA==",
"dependencies": {
"@inquirer/core": "^5.1.1",
"@inquirer/type": "^1.1.5",
"ansi-escapes": "^4.3.2",
"chalk": "^4.1.2",
"figures": "^3.2.0"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/checkbox/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@inquirer/confirm": {
"version": "2.0.15",
"resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-2.0.15.tgz",
"integrity": "sha512-hj8Q/z7sQXsF0DSpLQZVDhWYGN6KLM/gNjjqGkpKwBzljbQofGjn0ueHADy4HUY+OqDHmXuwk/bY+tZyIuuB0w==",
"dependencies": {
"@inquirer/core": "^5.1.1",
"@inquirer/type": "^1.1.5",
"chalk": "^4.1.2"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/confirm/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@inquirer/core": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/@inquirer/core/-/core-5.1.1.tgz",
"integrity": "sha512-IuJyZQUg75+L5AmopgnzxYrgcU6PJKL0hoIs332G1Gv55CnmZrhG6BzNOeZ5sOsTi1YCGOopw4rYICv74ejMFg==",
"dependencies": {
"@inquirer/type": "^1.1.5",
"@types/mute-stream": "^0.0.4",
"@types/node": "^20.9.0",
"@types/wrap-ansi": "^3.0.0",
"ansi-escapes": "^4.3.2",
"chalk": "^4.1.2",
"cli-spinners": "^2.9.1",
"cli-width": "^4.1.0",
"figures": "^3.2.0",
"mute-stream": "^1.0.0",
"run-async": "^3.0.0",
"signal-exit": "^4.1.0",
"strip-ansi": "^6.0.1",
"wrap-ansi": "^6.2.0"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/core/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@inquirer/editor": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-1.2.13.tgz",
"integrity": "sha512-gBxjqt0B9GLN0j6M/tkEcmcIvB2fo9Cw0f5NRqDTkYyB9AaCzj7qvgG0onQ3GVPbMyMbbP4tWYxrBOaOdKpzNA==",
"dependencies": {
"@inquirer/core": "^5.1.1",
"@inquirer/type": "^1.1.5",
"chalk": "^4.1.2",
"external-editor": "^3.1.0"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/editor/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@inquirer/expand": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-1.1.14.tgz",
"integrity": "sha512-yS6fJ8jZYAsxdxuw2c8XTFMTvMR1NxZAw3LxDaFnqh7BZ++wTQ6rSp/2gGJhMacdZ85osb+tHxjVgx7F+ilv5g==",
"dependencies": {
"@inquirer/core": "^5.1.1",
"@inquirer/type": "^1.1.5",
"chalk": "^4.1.2",
"figures": "^3.2.0"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/expand/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@inquirer/input": {
"version": "1.2.14",
"resolved": "https://registry.npmjs.org/@inquirer/input/-/input-1.2.14.tgz",
"integrity": "sha512-tISLGpUKXixIQue7jypNEShrdzJoLvEvZOJ4QRsw5XTfrIYfoWFqAjMQLerGs9CzR86yAI89JR6snHmKwnNddw==",
"dependencies": {
"@inquirer/core": "^5.1.1",
"@inquirer/type": "^1.1.5",
"chalk": "^4.1.2"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/input/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@inquirer/password": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/@inquirer/password/-/password-1.1.14.tgz",
"integrity": "sha512-vL2BFxfMo8EvuGuZYlryiyAB3XsgtbxOcFs4H9WI9szAS/VZCAwdVqs8rqEeaAf/GV/eZOghIOYxvD91IsRWSg==",
"dependencies": {
"@inquirer/input": "^1.2.14",
"@inquirer/type": "^1.1.5",
"ansi-escapes": "^4.3.2",
"chalk": "^4.1.2"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/password/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@inquirer/prompts": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-3.3.0.tgz",
"integrity": "sha512-BBCqdSnhNs+WziSIo4f/RNDu6HAj4R/Q5nMgJb5MNPFX8sJGCvj9BoALdmR0HTWXyDS7TO8euKj6W6vtqCQG7A==",
"dependencies": {
"@inquirer/checkbox": "^1.5.0",
"@inquirer/confirm": "^2.0.15",
"@inquirer/core": "^5.1.1",
"@inquirer/editor": "^1.2.13",
"@inquirer/expand": "^1.1.14",
"@inquirer/input": "^1.2.14",
"@inquirer/password": "^1.1.14",
"@inquirer/rawlist": "^1.2.14",
"@inquirer/select": "^1.3.1"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/rawlist": {
"version": "1.2.14",
"resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-1.2.14.tgz",
"integrity": "sha512-xIYmDpYgfz2XGCKubSDLKEvadkIZAKbehHdWF082AyC2I4eHK44RUfXaoOAqnbqItZq4KHXS6jDJ78F2BmQvxg==",
"dependencies": {
"@inquirer/core": "^5.1.1",
"@inquirer/type": "^1.1.5",
"chalk": "^4.1.2"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/rawlist/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@inquirer/select": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@inquirer/select/-/select-1.3.1.tgz",
"integrity": "sha512-EgOPHv7XOHEqiBwBJTyiMg9r57ySyW4oyYCumGp+pGyOaXQaLb2kTnccWI6NFd9HSi5kDJhF7YjA+3RfMQJ2JQ==",
"dependencies": {
"@inquirer/core": "^5.1.1",
"@inquirer/type": "^1.1.5",
"ansi-escapes": "^4.3.2",
"chalk": "^4.1.2",
"figures": "^3.2.0"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@inquirer/select/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@inquirer/type": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.1.5.tgz",
"integrity": "sha512-wmwHvHozpPo4IZkkNtbYenem/0wnfI6hvOcGKmPEa0DwuaH5XUQzFqy6OpEpjEegZMhYIk8HDYITI16BPLtrRA==",
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/@types/inquirer": {
"version": "9.0.7",
"resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-9.0.7.tgz",
"integrity": "sha512-Q0zyBupO6NxGRZut/JdmqYKOnN95Eg5V8Csg3PGKkP+FnvsUZx1jAyK7fztIszxxMuoBA6E3KXWvdZVXIpx60g==",
"dev": true,
"dependencies": {
"@types/through": "*",
"rxjs": "^7.2.0"
}
},
"node_modules/@types/mute-stream": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.4.tgz",
"integrity": "sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": {
"version": "20.11.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz",
"integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==",
"dependencies": {
"undici-types": "~5.26.4"
}
},
"node_modules/@types/through": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.33.tgz",
"integrity": "sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/wrap-ansi": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz",
"integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g=="
},
"node_modules/ansi-escapes": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
"integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",
"dependencies": {
"type-fest": "^0.21.3"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"engines": {
"node": ">=8"
}
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/chalk": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/chardet": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA=="
},
"node_modules/cli-spinners": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz",
"integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==",
"engines": {
"node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cli-width": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz",
"integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==",
"engines": {
"node": ">= 12"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
},
"node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/external-editor": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz",
"integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==",
"dependencies": {
"chardet": "^0.7.0",
"iconv-lite": "^0.4.24",
"tmp": "^0.0.33"
},
"engines": {
"node": ">=4"
}
},
"node_modules/figures": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
"integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
"dependencies": {
"escape-string-regexp": "^1.0.5"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"engines": {
"node": ">=8"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"engines": {
"node": ">=8"
}
},
"node_modules/mute-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz",
"integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==",
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
"node_modules/os-tmpdir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/run-async": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz",
"integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==",
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/rxjs": {
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
"dev": true,
"dependencies": {
"tslib": "^2.1.0"
}
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/signal-exit": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"dependencies": {
"os-tmpdir": "~1.0.2"
},
"engines": {
"node": ">=0.6.0"
}
},
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
"dev": true
},
"node_modules/type-fest": {
"version": "0.21.3",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
"integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/typescript": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
},
"node_modules/wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=8"
}
}
}
}

21
manager/package.json Normal file
View File

@ -0,0 +1,21 @@
{
"name": "manager",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"scripts": {
"start": "npx tsc && node ."
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/inquirer": "^9.0.7",
"@types/node": "^20.11.5",
"typescript": "^5.3.3"
},
"dependencies": {
"@inquirer/prompts": "^3.3.0",
"chalk": "^3.0.0"
}
}

View File

@ -0,0 +1,54 @@
import chalk from "chalk";
export default class LoadSpinner {
spinner: string[] = [
'⠋',
'⠙',
'⠹',
'⠸',
'⠼',
'⠴',
'⠦',
'⠧',
'⠇',
'⠏'
];
spinnerIndex: number;
updateInterval: NodeJS.Timeout;
message: string;
constructor(message: string) {
this.spinnerIndex = 0;
this.message = message;
// The spinner is a loop that runs every 100ms
// the spinner should look like this: [(spinner) message]
this.updateInterval = setInterval(() => {
this.updateSpinner();
}, 100);
}
private updateSpinner() {
process.stdout.write(`\r${this.spinner[this.spinnerIndex]} ${this.message}`);
this.spinnerIndex++;
if(this.spinnerIndex >= this.spinner.length) this.spinnerIndex = 0;
}
changeMessage(message: string) {
this.message = message;
}
removeSpinner(finishMessage?: string) {
clearInterval(this.updateInterval);
// replace the spinner with a tick but keep the message
process.stdout.write(`\r${chalk.green("✓")} ${finishMessage ?? this.message}\n`);
}
failSpinner(finishMessage?: string) {
clearInterval(this.updateInterval);
// replace the spinner with a cross but keep the message
process.stdout.write(`\r${chalk.red("✗")} ${finishMessage ?? this.message}\n`);
}
}

89
manager/src/index.ts Normal file
View File

@ -0,0 +1,89 @@
import { select, confirm } from '@inquirer/prompts';
import chalk from 'chalk';
import fs from 'fs';
const configExists = fs.existsSync("../terratec.config.json");
async function MainMenu() {
if (!configExists) {
console.log(chalk.red(`No terratec.config.json found`));
const action = await confirm({
message: 'Do you want to create a new config file?',
});
if (action) return await require('./modes/ConfigCreate').default();
else process.exit(0);
}
const action = await select({
message: 'Select Terra manager action',
choices: [
{
name: 'Actions',
value: 'action',
},
{
name: 'Edit config',
value: 'edit',
},
{
name: 'Exit',
value: 'exit',
}
],
});
switch (action) {
case 'action':
{
const selectedAction = await select({
message: 'Select Terra manager action',
choices: [
{
name: 'Start Dev Server',
value: 'dev',
},
{
name: 'Start Build',
value: 'build',
},
{
name: 'Exit',
value: 'exit',
}
],
});
switch (selectedAction) {
case 'dev':
await require('./modes/Dev').default();
break;
case 'build':
await require('./modes/Build').default();
break;
case 'exit':
return MainMenu();
default:
console.log(chalk.red(`Unknown action: ${action}`));
break;
}
}
break;
case 'edit':
await require('./modes/ConfigEdit').default();
break;
case 'exit':
process.exit(0);
break;
default:
console.log(chalk.red(`Unknown action: ${action}`));
break;
}
MainMenu();
}
MainMenu();

View File

@ -0,0 +1,43 @@
import { input } from "@inquirer/prompts";
import chalk from "chalk";
import os from "os";
import fs from "fs";
import LoadSpinner from "../components/LoadSpinner";
export default async () => {
const name = (await input({
message: 'Project name',
default: 'my-app',
transformer: (input: string) => {
return input.toLowerCase().replace(/ /g, '-');
},
validate: (input: string) => {
if(input.length === 0) return 'Project name cannot be empty';
return true;
},
})).toLowerCase().replace(/ /g, '-');
const description = await input({
message: 'Project description',
default: 'My awesome app',
});
const author = await input({
message: 'Author',
default: os.userInfo().username,
});
const version = "0.0.1";
const saveSpinner = new LoadSpinner("Saving config...");
const config: Terratec.Config = {
name,
description,
version,
author,
project: []
};
fs.writeFileSync("../terratec.config.json", JSON.stringify(config, null, 2));
saveSpinner.removeSpinner("Saved config!");
};

View File

@ -0,0 +1,36 @@
import { input, select } from "@inquirer/prompts";
import chalk from "chalk";
export default async () => {
const action = await select({
message: 'Select Terra manager action',
choices: [
{
name: 'Create new part',
value: 'create',
},
{
name: 'Delete part',
value: 'delete',
},
{
name: 'Exit',
value: 'exit',
}
],
});
switch (action) {
case 'create':
await require('./PartCreate').default();
break;
case 'delete':
await require('./PartDelete').default();
break;
case 'exit':
return;
default:
console.log(chalk.red(`Unknown action: ${action}`));
break;
}
};

30
manager/src/modes/Dev.ts Normal file
View File

@ -0,0 +1,30 @@
import chalk from "chalk";
import { exec } from "child_process";
export default async () => {
console.log(chalk.green("Running dev mode"));
const frontend = exec("npm run start", {
cwd: "../frontend",
});
const backend = exec("npm run start", {
cwd: "../backend",
});
frontend.stdout?.on("data", (data) => {
console.log(chalk.blueBright("[Frontend]"), data);
});
backend.stdout?.on("data", (data) => {
console.log(chalk.blueBright("[Backend]"), data);
});
frontend.stderr?.on("data", (data) => {
console.log(chalk.redBright("[Frontend]"), data);
});
backend.stderr?.on("data", (data) => {
console.log(chalk.redBright("[Backend]"), data);
});
};

View File

@ -0,0 +1,76 @@
import { input, select } from "@inquirer/prompts";
import chalk from "chalk";
import fs from "fs";
import LoadSpinner from "../components/LoadSpinner";
const configTxt = fs.readFileSync("../terratec.config.json").toString();
const config: Terratec.Config = JSON.parse(configTxt);
const takenNames = config.project.map((project) => project.name);
export default async () => {
console.log(chalk.green("Config generator"));
const type = await select({
message: 'Part type',
choices: [
{
name: 'Frontend',
value: 'frontend',
},
{
name: 'Backend',
value: 'backend',
}
],
});
const name = (await input({
message: 'Part name',
transformer: (input: string) => {
return input.toLowerCase().replace(/ /g, '-');
},
validate: (input: string) => {
if (input.length === 0) return 'Part name cannot be empty';
if (takenNames.includes(input)) return 'Part name already taken';
return true;
}
})).toLowerCase().replace(/ /g, '-');
const description = await input({
message: 'Part description',
default: 'My awesome part',
});
const readTemplatesSpinner = new LoadSpinner("Reading templates...");
const templates = fs.readdirSync(`./dist/templates/${type}`);
readTemplatesSpinner.removeSpinner("Read templates!");
const template = await select({
message: 'Part template',
choices: [
...templates.map((template) => ({
name: template,
value: template,
})),
],
});
const saveSpinner = new LoadSpinner("Saving config...");
const config: Terratec.Config = JSON.parse(fs.readFileSync("../terratec.config.json").toString());
config.project.push({
name,
description,
type: type as Terratec.ProjectType,
template,
});
fs.writeFileSync("../terratec.config.json", JSON.stringify(config, null, 2));
saveSpinner.removeSpinner("Saved config!");
await require(`../templates/${type}/${template}`).default(config.project[config.project.length - 1]);
};

View File

@ -0,0 +1,41 @@
import { input, select, confirm } from "@inquirer/prompts";
import chalk from "chalk";
import fs from "fs";
import LoadSpinner from "../components/LoadSpinner";
export default async () => {
console.log(chalk.green("Config generator"));
const configTxT = fs.readFileSync("../terratec.config.json").toString();
const config: Terratec.Config = JSON.parse(configTxT);
const part = await select({
message: 'Delete part',
choices: config.project.map((project) => (
{
name: project.name,
value: project.name,
}
)),
});
const sure = await confirm({
message: `Are you sure you want to delete ${part}? All files will be deleted!`,
default: false,
});
if (!sure) return console.log(chalk.red("Aborted"));
const saveSpinner = new LoadSpinner("Saving config...");
config.project = config.project.filter((project) => project.name !== part);
fs.writeFileSync("../terratec.config.json", JSON.stringify(config, null, 2));
saveSpinner.removeSpinner("Saved config!");
const deleteSpinner = new LoadSpinner("Removing files...");
fs.rmSync(`../${part}`, { recursive: true });
deleteSpinner.removeSpinner("Files removed!");
};

View File

@ -0,0 +1,79 @@
import { input, confirm, select, checkbox } from "@inquirer/prompts"
import { exec } from "child_process"
import LoadSpinner from "../../components/LoadSpinner"
import chalk from "chalk"
import fs from "fs"
export default async (props: Terratec.ProjectConfig) => {
console.log(chalk.green("Running template..."))
const typescript = await confirm({
message: "Use typescript?",
default: true,
});
const spinner = new LoadSpinner("Running template...");
fs.mkdirSync(`../${props.name}`);
spinner.changeMessage("Setting up package...")
await new Promise((resolve) => {
exec(`npm init -y`, {
cwd: `../${props.name}`,
}, () => {
resolve(true);
});
})
fs.mkdirSync(`../${props.name}/src`);
if(typescript) {
spinner.changeMessage("Installing typescript...")
await new Promise((resolve) => {
exec(`npm i typescript @types/node @types/express --save-dev`, {
cwd: `../${props.name}`,
}, () => {
resolve(true);
});
})
spinner.changeMessage("Creating tsconfig.json...")
fs.writeFileSync(`../${props.name}/tsconfig.json`, JSON.stringify({
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}, null, 2));
fs.writeFileSync(`../${props.name}/src/index.ts`, `console.log("Hello world!")`);
} else {
fs.writeFileSync(`../${props.name}/src/index.js`, `console.log("Hello world!")`);
}
spinner.changeMessage("Updating package.json...")
const packageJson = JSON.parse(fs.readFileSync(`../${props.name}/package.json`).toString());
packageJson.main = typescript ? "dist/index.js" : "src/index.js";
packageJson.scripts.start = typescript ? "npx tsc && node ." : "node src/index.js";
fs.writeFileSync(`../${props.name}/package.json`, JSON.stringify(packageJson, null, 2));
spinner.changeMessage("Installing dependencies...")
await new Promise((resolve) => {
exec(`npm i express`, {
cwd: `../${props.name}`,
}, () => {
resolve(true);
});
})
spinner.removeSpinner("Template execution finished!");
}

View File

@ -0,0 +1,71 @@
import { input, confirm, select, checkbox } from "@inquirer/prompts"
import { exec } from "child_process"
import LoadSpinner from "../../components/LoadSpinner"
import chalk from "chalk"
export default async (props: Terratec.ProjectConfig) => {
console.log(chalk.green("Running template..."))
const typescript = await confirm({
message: "Use typescript?",
default: true,
});
const spinner = new LoadSpinner("Running template...");
spinner.changeMessage("Running create-react-app...")
await new Promise((resolve) => {
exec(`npx create-react-app ${props.name}${typescript && " --template typescript"}`, {
cwd: "..",
}, () => {
resolve(true);
});
})
spinner.removeSpinner("Template execution finished!");
const optionDependencies = await confirm({
message: "Do you want to install optional dependencies?",
default: true,
});
if(optionDependencies) {
const dependencies = await checkbox({
message: "Select dependencies",
choices: [
{
name: "react-router-dom",
value: "react-router-dom",
},
{
name: "axios",
value: "axios",
},
{
name: "react-query",
value: "react-query",
},
{
name: "Material UI",
value: "@mui/icons-material @mui/material @emotion/styled @emotion/react",
},
{
name: "Zustand",
value: "zustand",
}
]
});
const dependenciesSpinner = new LoadSpinner("Installing dependencies...");
await new Promise((resolve) => {
exec(`npm i ${dependencies.join(" ")}`, {
cwd: `../${props.name}`,
}, () => {
resolve(true);
});
})
dependenciesSpinner.removeSpinner("Dependencies installed!");
}
}

18
manager/src/types.d.ts vendored Normal file
View File

@ -0,0 +1,18 @@
declare namespace Terratec {
type ProjectType = 'frontend' | 'backend';
interface Config {
name: string;
description: string;
version: string;
author: string;
project: ProjectConfig[];
}
interface ProjectConfig {
name: string;
description: string;
type: ProjectType;
template: string;
}
}

109
manager/tsconfig.json Normal file
View File

@ -0,0 +1,109 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "NodeNext", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

7
terratec.config.json Normal file
View File

@ -0,0 +1,7 @@
{
"name": "my-app",
"description": "My awesome app",
"version": "0.0.1",
"author": "niko",
"project": []
}