Compare commits
5 Commits
master
...
patch01-ba
Author | SHA1 | Date | |
---|---|---|---|
|
8d6c74f5e5 | ||
|
11051d85e6 | ||
|
66fb96acba | ||
|
327bfb2760 | ||
|
1d49f676e3 |
3
.eslintrc.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "next/core-web-vitals"
|
||||
}
|
43
.gitignore
vendored
@ -1,5 +1,38 @@
|
||||
node_modules
|
||||
dist
|
||||
# Keep environment variables out of version control
|
||||
.env
|
||||
build
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
.yarn/install-state.gz
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
.env
|
36
README.md
Normal file
@ -0,0 +1,36 @@
|
||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
@ -1,3 +0,0 @@
|
||||
.env
|
||||
node_modules
|
||||
dist
|
@ -1,12 +0,0 @@
|
||||
FROM node:lts-buster
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json /app
|
||||
RUN npm install
|
||||
|
||||
COPY . /app
|
||||
|
||||
EXPOSE 3001
|
||||
|
||||
CMD ["npm", "run deploy"]
|
850
backend/package-lock.json
generated
@ -1,850 +0,0 @@
|
||||
{
|
||||
"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",
|
||||
"moment": "^2.30.1",
|
||||
"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/moment": {
|
||||
"version": "2.30.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
||||
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "./dist/index.js",
|
||||
"scripts": {
|
||||
"start": "npx tsc && node dist/index.js",
|
||||
"deploy": "npx prisma db push && npx prisma generate && 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",
|
||||
"moment": "^2.30.1",
|
||||
"prisma": "^5.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "latest",
|
||||
"@types/node": "latest",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
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_v4()")) @db.Uuid
|
||||
username String
|
||||
password String @db.VarChar(128)
|
||||
token String @db.VarChar(128)
|
||||
}
|
||||
|
||||
model Employees {
|
||||
ID String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
|
||||
Vorname String
|
||||
Nachname String
|
||||
Anstelldatum DateTime? @db.Date
|
||||
Geburtstag DateTime? @db.Date
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.3145608a.css",
|
||||
"main.js": "/static/js/main.d5b20504.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.d5b20504.js.map": "/static/js/main.d5b20504.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.3145608a.css",
|
||||
"static/js/main.d5b20504.js"
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 224 KiB |
Before Width: | Height: | Size: 586 KiB |
Before Width: | Height: | Size: 5.9 MiB |
Before Width: | Height: | Size: 192 KiB |
@ -1 +0,0 @@
|
||||
<!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.d5b20504.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>
|
Before Width: | Height: | Size: 149 KiB |
@ -1,25 +0,0 @@
|
||||
{
|
||||
"short_name": "DWLDash",
|
||||
"name": "Event dashboard for DWL",
|
||||
"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"
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
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*/
|
@ -1,98 +0,0 @@
|
||||
/* @license
|
||||
Papa Parse
|
||||
v5.4.1
|
||||
https://github.com/mholt/PapaParse
|
||||
License: MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* @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
|
@ -1,33 +0,0 @@
|
||||
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_ITEMS: errorBuilder("invalid_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
|
||||
}
|
||||
|
||||
export function getFormatNumber(number: number, digits: number): string {
|
||||
// format the number with the digits. so if the digits is 2 and the number is 9 return 09
|
||||
return number.toString().padStart(digits, '0')
|
||||
}
|
@ -1,504 +0,0 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
import express from 'express'
|
||||
import dotenv from 'dotenv'
|
||||
import init from './init'
|
||||
import Errors, { authorize, getFormatNumber } from './functions'
|
||||
import fs from 'fs'
|
||||
import crypto from 'crypto'
|
||||
import moment from 'moment'
|
||||
|
||||
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'))
|
||||
|
||||
// all 404 requests go to the index in that folder
|
||||
app.use((req, res, next) => {
|
||||
// ihnore /api routes
|
||||
if (req.path.startsWith('/api')) return next()
|
||||
res.sendFile('index.html', { root: '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.put("/api/employees", 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)
|
||||
|
||||
if (!Array.isArray(req.body)) return res.status(400).send(Errors.INVALID_ITEMS)
|
||||
|
||||
const employees: {
|
||||
ID: string;
|
||||
Vorname: string;
|
||||
Nachname: string;
|
||||
Geburtstag?: number | Date;
|
||||
Anstelldatum?: number | Date;
|
||||
}[] = req.body;
|
||||
|
||||
for (let i in employees) {
|
||||
if (
|
||||
!employees[i].Vorname
|
||||
|| !employees[i].Nachname
|
||||
|| employees[i].ID
|
||||
) return res.status(400).send(Errors.MISSING_ITEMS)
|
||||
|
||||
if (employees[i].Geburtstag && typeof employees[i].Geburtstag !== 'number') return res.status(400).send(Errors.INVALID_ITEMS)
|
||||
if (employees[i].Anstelldatum && typeof employees[i].Anstelldatum !== 'number') return res.status(400).send(Errors.INVALID_ITEMS)
|
||||
|
||||
if (employees[i].Geburtstag && typeof employees[i].Geburtstag === 'number') employees[i].Geburtstag = new Date(employees[i].Geburtstag as number)
|
||||
if (employees[i].Anstelldatum && typeof employees[i].Anstelldatum === 'number') employees[i].Anstelldatum = new Date(employees[i].Anstelldatum as number)
|
||||
}
|
||||
|
||||
const newEmployees = await prisma.employees.createMany({
|
||||
data: employees as {
|
||||
Vorname: string;
|
||||
Nachname: string;
|
||||
Geburtstag?: Date;
|
||||
Anstelldatum?: Date;
|
||||
}[]
|
||||
})
|
||||
|
||||
res.send(newEmployees)
|
||||
})
|
||||
|
||||
app.patch("/api/employees/: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)
|
||||
|
||||
let { Vorname, Nachname, Geburtstag, Anstelldatum } = req.body as {
|
||||
Vorname: string;
|
||||
Nachname: string;
|
||||
Geburtstag?: number | Date;
|
||||
Anstelldatum?: number | Date;
|
||||
}
|
||||
if (!Vorname || !Nachname) return res.status(400).send(Errors.MISSING_ITEMS)
|
||||
|
||||
|
||||
if (Geburtstag && typeof Geburtstag !== 'number') return res.status(400).send(Errors.INVALID_ITEMS)
|
||||
if (Anstelldatum && typeof Anstelldatum !== 'number') return res.status(400).send(Errors.INVALID_ITEMS)
|
||||
|
||||
if (Geburtstag && typeof Geburtstag === 'number') Geburtstag = new Date(Geburtstag)
|
||||
if (Anstelldatum && typeof Anstelldatum === 'number') Anstelldatum = new Date(Anstelldatum)
|
||||
|
||||
const updatedEmployee = await prisma.employees.update({
|
||||
where: {
|
||||
ID: req.params.id
|
||||
},
|
||||
data: {
|
||||
Vorname,
|
||||
Nachname,
|
||||
Geburtstag: (Geburtstag as Date | undefined),
|
||||
Anstelldatum: (Anstelldatum as Date | undefined)
|
||||
}
|
||||
})
|
||||
|
||||
res.send(updatedEmployee)
|
||||
})
|
||||
|
||||
app.patch("/api/employees/", 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)
|
||||
|
||||
if (!Array.isArray(req.body)) return res.status(400).send(Errors.INVALID_ITEMS)
|
||||
|
||||
const employees: {
|
||||
ID: string;
|
||||
Vorname: string;
|
||||
Nachname: string;
|
||||
Geburtstag?: number | Date;
|
||||
Anstelldatum?: number | Date;
|
||||
}[] = req.body;
|
||||
|
||||
for (let i in employees) {
|
||||
if (
|
||||
!employees[i].Vorname
|
||||
|| !employees[i].Nachname
|
||||
|| !employees[i].ID
|
||||
) return res.status(400).send(Errors.MISSING_ITEMS)
|
||||
|
||||
if (employees[i].Geburtstag && typeof employees[i].Geburtstag !== 'number') return res.status(400).send(Errors.INVALID_ITEMS)
|
||||
if (employees[i].Anstelldatum && typeof employees[i].Anstelldatum !== 'number') return res.status(400).send(Errors.INVALID_ITEMS)
|
||||
|
||||
if (employees[i].Geburtstag && typeof employees[i].Geburtstag === 'number') employees[i].Geburtstag = new Date(employees[i].Geburtstag as number)
|
||||
if (employees[i].Anstelldatum && typeof employees[i].Anstelldatum === 'number') employees[i].Anstelldatum = new Date(employees[i].Anstelldatum as number)
|
||||
}
|
||||
|
||||
const updatedEmployees = await Promise.all(employees.map(employee =>
|
||||
prisma.employees.update({
|
||||
where: { ID: employee.ID },
|
||||
data: {
|
||||
Vorname: employee.Vorname,
|
||||
Nachname: employee.Nachname,
|
||||
Geburtstag: employee.Geburtstag as Date | undefined,
|
||||
Anstelldatum: employee.Anstelldatum as Date | undefined
|
||||
}
|
||||
})
|
||||
))
|
||||
|
||||
res.send(updatedEmployees)
|
||||
})
|
||||
|
||||
app.get('/api/employees', 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.employees.findMany({
|
||||
select: {
|
||||
ID: true,
|
||||
Vorname: true,
|
||||
Nachname: true,
|
||||
Geburtstag: true,
|
||||
Anstelldatum: true,
|
||||
},
|
||||
orderBy: {
|
||||
Nachname: 'asc'
|
||||
}
|
||||
})
|
||||
|
||||
res.send(workers)
|
||||
})
|
||||
|
||||
app.delete('/api/employees/:employees', 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 employees: string[] = req.params.employees.split(',')
|
||||
|
||||
await prisma.employees.deleteMany({
|
||||
where: {
|
||||
ID: {
|
||||
in: employees
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
res.send('OK')
|
||||
})
|
||||
|
||||
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 } = req.body
|
||||
if (!username) return res.status(400).send(Errors.MISSING_ITEMS)
|
||||
|
||||
const newUser = await prisma.users.update({
|
||||
where: {
|
||||
ID: req.params.id
|
||||
},
|
||||
data: {
|
||||
username,
|
||||
...(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.get('/api/toshow/:targetDate?', async (req, res) => {
|
||||
const { targetDate } = req.params;
|
||||
if (targetDate && targetDate.length !== 10) return res.status(400).send(Errors.INVALID_ITEMS)
|
||||
|
||||
let dates: Types.EmployeeEvent[] = await prisma.employees.findMany({})
|
||||
|
||||
let currDate;
|
||||
if (targetDate) currDate = moment(targetDate, "YYYY-MM-DD");
|
||||
else currDate = moment();
|
||||
for (let i in dates) {
|
||||
let validity = false;
|
||||
// `${currDate.getFullYear()}-${getFormatNumber(date.getMonth(), 2)}-${getFormatNumber(date.getDay(), 2)}`
|
||||
|
||||
if (dates[i].Anstelldatum) {
|
||||
const date = dates[i].Anstelldatum;
|
||||
const dateWithoutYear = moment(date).format("MM-DD");
|
||||
|
||||
if (
|
||||
date &&
|
||||
(
|
||||
(
|
||||
moment(dateWithoutYear, "MM-DD") >= moment(currDate).subtract(14, "days") &&
|
||||
moment(dateWithoutYear, "MM-DD") <= currDate
|
||||
)
|
||||
||
|
||||
(
|
||||
moment(dateWithoutYear, "MM-DD").subtract(1, "year") >= moment(currDate).subtract(14, "days") &&
|
||||
moment(dateWithoutYear, "MM-DD").subtract(1, "year") <= currDate
|
||||
)
|
||||
)
|
||||
) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dates[i].Geburtstag) {
|
||||
const date = dates[i].Geburtstag;
|
||||
const dateWithoutYear = moment(date).format("MM-DD");
|
||||
|
||||
if (
|
||||
date &&
|
||||
(
|
||||
(
|
||||
moment(dateWithoutYear, "MM-DD") >= moment(currDate).subtract(14, "days") &&
|
||||
moment(dateWithoutYear, "MM-DD") <= currDate
|
||||
)
|
||||
||
|
||||
(
|
||||
moment(dateWithoutYear, "MM-DD").subtract(1, "year") >= moment(currDate).subtract(14, "days") &&
|
||||
moment(dateWithoutYear, "MM-DD").subtract(1, "year") <= currDate
|
||||
)
|
||||
)
|
||||
) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!validity) delete dates[i];
|
||||
}
|
||||
dates = dates.filter((date) => date !== null);
|
||||
|
||||
|
||||
for (let i = 14; i >= 1; i--) {
|
||||
console.log(i);
|
||||
const date = moment(currDate).subtract(i, "days")
|
||||
const dayOfWeek = date.format("dddd");
|
||||
|
||||
if (["Saturday", "Sunday"].includes(dayOfWeek)) continue;
|
||||
|
||||
for (let j in dates) {
|
||||
let validity = false;
|
||||
|
||||
if (dates[j].Anstelldatum) {
|
||||
const dateWithoutYear = moment(dates[j].Anstelldatum, "YYYY-MM-DD").format("MM-DD");
|
||||
|
||||
if (
|
||||
date &&
|
||||
(
|
||||
(
|
||||
moment(dateWithoutYear, "MM-DD") >= moment(currDate).subtract(14, "days") &&
|
||||
moment(dateWithoutYear, "MM-DD") <= moment(currDate).subtract(i, "days")
|
||||
)
|
||||
||
|
||||
(
|
||||
moment(dateWithoutYear, "MM-DD").subtract(1, "year") >= moment(currDate).subtract(14, "days") &&
|
||||
moment(dateWithoutYear, "MM-DD").subtract(1, "year") <= moment(currDate).subtract(i, "days")
|
||||
)
|
||||
)
|
||||
) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dates[j].Geburtstag) {
|
||||
const dateWithoutYear = moment(dates[j].Geburtstag, "YYYY-MM-DD").format("MM-DD");
|
||||
|
||||
if (
|
||||
date &&
|
||||
(
|
||||
(
|
||||
moment(dateWithoutYear, "MM-DD") >= moment(currDate).subtract(14, "days") &&
|
||||
moment(dateWithoutYear, "MM-DD") <= moment(currDate).subtract(i, "days")
|
||||
)
|
||||
||
|
||||
(
|
||||
moment(dateWithoutYear, "MM-DD").subtract(1, "year") >= moment(currDate).subtract(14, "days") &&
|
||||
moment(dateWithoutYear, "MM-DD").subtract(1, "year") <= moment(currDate).subtract(i, "days")
|
||||
)
|
||||
)
|
||||
) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
console.log(date);
|
||||
|
||||
if (validity) {
|
||||
delete dates[j];
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the EventType depending on whats closer to the current date
|
||||
const dateWithoutYear = moment(dates[j].Anstelldatum, "YYYY-MM-DD").format("MM-DD");
|
||||
const dateWithoutYear2 = moment(dates[j].Geburtstag, "YYYY-MM-DD").format("MM-DD");
|
||||
|
||||
if (dates[j].Anstelldatum && !dates[j].Geburtstag) dates[j].EventType = "Jubiläum";
|
||||
else if (dates[j].Geburtstag && !dates[j].Anstelldatum) dates[j].EventType = "Geburtstag";
|
||||
else if (
|
||||
Math.abs(moment(dateWithoutYear, "MM-DD").diff(moment(currDate), "days")) <=
|
||||
Math.abs(moment(dateWithoutYear2, "MM-DD").diff(moment(currDate), "days"))
|
||||
) dates[j].EventType = "Jubiläum"
|
||||
else dates[j].EventType = "Geburtstag"
|
||||
|
||||
|
||||
console.log(date.format("dddd"), dates[j].Vorname, dates[j].Nachname, validity, dates[j].EventType);
|
||||
}
|
||||
dates = dates.filter((date) => date !== null);
|
||||
}
|
||||
|
||||
res.send(dates)
|
||||
})
|
||||
|
||||
|
||||
|
||||
app.listen(process.env.PORT, () => {
|
||||
console.log(`Server is running on port ${process.env.PORT}`)
|
||||
})
|
@ -1,30 +0,0 @@
|
||||
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!");
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
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}`));
|
||||
}
|
||||
}
|
19
backend/src/types.d.ts
vendored
@ -1,19 +0,0 @@
|
||||
declare namespace Types {
|
||||
interface ErrorResponse {
|
||||
error: true
|
||||
type: string
|
||||
message: string
|
||||
}
|
||||
|
||||
interface Employees {
|
||||
ID: string;
|
||||
Vorname: string;
|
||||
Nachname: string;
|
||||
Anstelldatum: Date | null;
|
||||
Geburtstag: Date | null;
|
||||
}
|
||||
|
||||
interface EmployeeEvent extends Employees {
|
||||
EventType?: "Geburtstag" | "Jubiläum";
|
||||
}
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
{
|
||||
"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. */
|
||||
}
|
||||
}
|
21
compose-dev.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
services:
|
||||
app:
|
||||
image: docker/dev-environments-javascript:stable-1
|
||||
entrypoint:
|
||||
- sleep
|
||||
- infinity
|
||||
init: true
|
||||
environment:
|
||||
DATABASE_URL: postgres://postgres:bQnroQrK9uUrq7@postgres:5432/DWL
|
||||
volumes:
|
||||
- type: bind
|
||||
source: /var/run/docker.sock
|
||||
target: /var/run/docker.sock
|
||||
postgres:
|
||||
image: postgres
|
||||
ports:
|
||||
- 5432:5432
|
||||
volumes:
|
||||
- /var/run/dwldash/docker/postgres:/var/lib/postgres
|
||||
environment:
|
||||
POSTGRES_PASSWORD: bQnroQrK9uUrq7
|
@ -1,21 +0,0 @@
|
||||
name: dwldash
|
||||
services:
|
||||
postgres:
|
||||
volumes:
|
||||
- dwldashdb:/var/lib/postgres
|
||||
restart: no
|
||||
environment:
|
||||
POSTGRES_PASSWORD: bQnroQrK9uUrq7
|
||||
image: postgres
|
||||
app:
|
||||
volumes:
|
||||
- /var/run/dwldash/docker/data:/dwldash
|
||||
restart: no
|
||||
environment:
|
||||
DATABASE_URL: postgres://postgres:bQnroQrK9uUrq7@postgres:5432/DWL
|
||||
PORT: 3000
|
||||
image: git.ipmake.me/bkrheine/dwldashboard:latest
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
dwldashdb:
|
@ -1,46 +0,0 @@
|
||||
# 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 can’t go back!**
|
||||
|
||||
If you aren’t 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 you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t 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/).
|
18074
frontend/package-lock.json
generated
@ -1,59 +0,0 @@
|
||||
{
|
||||
"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",
|
||||
"@mui/x-date-pickers": "^6.19.6",
|
||||
"@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",
|
||||
"papaparse": "^5.4.1",
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/papaparse": "^5.3.14"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 224 KiB |
Before Width: | Height: | Size: 586 KiB |
Before Width: | Height: | Size: 5.9 MiB |
Before Width: | Height: | Size: 192 KiB |
@ -1,45 +0,0 @@
|
||||
<!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>
|
@ -1,25 +0,0 @@
|
||||
{
|
||||
"short_name": "DWLDash",
|
||||
"name": "Event dashboard for DWL",
|
||||
"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"
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
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;
|
@ -1,25 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { getBaseURL } from '../functions';
|
||||
|
||||
const CompareDate = () => {
|
||||
axios
|
||||
.get(`${getBaseURL()}/api/workers`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
})
|
||||
.then(response => {
|
||||
console.log(response.data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
return (
|
||||
<div>
|
||||
<h1>Compare Date</h1>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CompareDate;
|
@ -1,32 +0,0 @@
|
||||
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;
|
@ -1,46 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
export default function PhilSwift() {
|
||||
return (
|
||||
<svg viewBox="0 0 1920 1080" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_1_10)">
|
||||
<path d="M-24.5002 525.144C84.4997 356.144 435.5 63.1437 752.5 280.644C982.135 438.201 1314 675.644 1545 574.644C1680.83 515.253 1900.33 304.31 1944.5 263.644" stroke="url(#paint0_radial_1_10)" stroke-width="18"/>
|
||||
<path d="M-24.5002 580.705C84.4997 411.705 435.5 118.705 752.5 336.205C982.135 493.763 1314 731.205 1545 630.205C1680.83 570.814 1900.33 359.872 1944.5 319.205" stroke="url(#paint1_radial_1_10)" stroke-width="18"/>
|
||||
<path d="M-24.5002 636.266C84.4997 467.266 435.5 174.266 752.5 391.766C982.135 549.324 1314 786.766 1545 685.766C1680.83 626.375 1900.33 415.433 1944.5 374.766" stroke="url(#paint2_radial_1_10)" stroke-width="18"/>
|
||||
<path d="M-24.5002 691.828C84.4997 522.828 435.5 229.828 752.5 447.328C982.135 604.885 1314 842.328 1545 741.328C1680.83 681.937 1900.33 470.994 1944.5 430.328" stroke="url(#paint3_radial_1_10)" stroke-width="18"/>
|
||||
<path d="M-24.5002 747.389C84.4997 578.389 435.5 285.389 752.5 502.889C982.135 660.447 1314 897.889 1545 796.889C1680.83 737.498 1900.33 526.556 1944.5 485.889" stroke="url(#paint4_radial_1_10)" stroke-width="18"/>
|
||||
<path d="M-24.5002 802.95C84.4997 633.95 435.5 340.95 752.5 558.45C982.135 716.008 1314 953.45 1545 852.45C1680.83 793.059 1900.33 582.117 1944.5 541.45" stroke="url(#paint5_radial_1_10)" stroke-width="18"/>
|
||||
</g>
|
||||
<defs>
|
||||
<radialGradient id="paint0_radial_1_10" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(958.75 398.784) rotate(89.852) scale(483.813 2318.21)">
|
||||
<stop stop-color="#9BCAE1"/>
|
||||
<stop offset="1" stop-color="#003263"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint1_radial_1_10" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(958.75 454.346) rotate(89.852) scale(483.813 2318.21)">
|
||||
<stop stop-color="#9BCAE1"/>
|
||||
<stop offset="1" stop-color="#003263"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint2_radial_1_10" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(958.75 509.907) rotate(89.852) scale(483.813 2318.21)">
|
||||
<stop stop-color="#9BCAE1"/>
|
||||
<stop offset="1" stop-color="#003263"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint3_radial_1_10" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(958.75 565.468) rotate(89.852) scale(483.813 2318.21)">
|
||||
<stop stop-color="#9BCAE1"/>
|
||||
<stop offset="1" stop-color="#003263"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint4_radial_1_10" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(958.75 621.03) rotate(89.852) scale(483.813 2318.21)">
|
||||
<stop stop-color="#9BCAE1"/>
|
||||
<stop offset="1" stop-color="#003263"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint5_radial_1_10" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(958.75 676.591) rotate(89.852) scale(483.813 2318.21)">
|
||||
<stop stop-color="#9BCAE1"/>
|
||||
<stop offset="1" stop-color="#003263"/>
|
||||
</radialGradient>
|
||||
<clipPath id="clip0_1_10">
|
||||
<rect width="1920" height="1080" fill="white" transform="translate(-0.000244141 -0.000335693)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
);
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
import { Box, Divider } from "@mui/material"
|
||||
import SidebarElement from "./SidebarElement"
|
||||
import { ArrowBack, Home, Logout, Person, TableChartOutlined, Event } from "@mui/icons-material"
|
||||
|
||||
function Sidebar() {
|
||||
|
||||
return (
|
||||
<Box sx={{
|
||||
width: "250px",
|
||||
height: "100vh",
|
||||
position: "fixed",
|
||||
top: "0",
|
||||
left: "0",
|
||||
|
||||
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="Verwalten" Icon={TableChartOutlined} Path="/admin/manage" />
|
||||
{/* <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
|
@ -1,67 +0,0 @@
|
||||
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.main : theme.palette.secondary.main,
|
||||
|
||||
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;
|
@ -1,224 +0,0 @@
|
||||
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 valid = () => {
|
||||
if (!username) return false;
|
||||
if (!password && id === "create") return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setUsername("");
|
||||
setPassword("");
|
||||
|
||||
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);
|
||||
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%",
|
||||
}}
|
||||
/>
|
||||
|
||||
<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`)
|
||||
},
|
||||
{
|
||||
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
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem(
|
||||
"token"
|
||||
)}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}}
|
||||
loading={saving}
|
||||
>
|
||||
Speichern
|
||||
</LoadingButton>
|
||||
</Box>
|
||||
</Backdrop>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default UserModal;
|
@ -1,12 +0,0 @@
|
||||
export function getBaseURL(): string {
|
||||
if(process.env.NODE_ENV === "development") return "http://127.0.0.1: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, ".");
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
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;
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
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;
|
@ -1,51 +0,0 @@
|
||||
import { Box } from "@mui/material";
|
||||
import { Route, Routes, useLocation, useNavigate } 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 Kalender from "./admin/Kalender";
|
||||
import ManageData from "./admin/ManageData";
|
||||
import { useEffect } from "react";
|
||||
import { getBaseURL } from "../functions";
|
||||
|
||||
function AdminFrame() {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
if (!localStorage.getItem("token") && location.pathname !== "/login") navigate("/login");
|
||||
}, []);
|
||||
|
||||
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="/manage" element={<ManageData />} />
|
||||
<Route path="/kalender" element={<Kalender />} />
|
||||
</Routes>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default AdminFrame;
|
@ -1,274 +0,0 @@
|
||||
import { Box, Collapse, Typography } from "@mui/material";
|
||||
import { useEffect, useState } from "react";
|
||||
import PhilSwift from "../components/PhilSwift";
|
||||
import axios from "axios";
|
||||
import { getBaseURL } from "../functions";
|
||||
import moment from "moment";
|
||||
|
||||
interface EmployeeWithColor extends Types.Employees {
|
||||
color: string;
|
||||
EventType: "Geburtstag" | "Jubiläum";
|
||||
}
|
||||
|
||||
function LandingPage() {
|
||||
const [data, setData] = useState<EmployeeWithColor[]>([]);
|
||||
const [currEvent, setCurrEvent] = useState<number>(0);
|
||||
|
||||
useEffect(() => {
|
||||
axios
|
||||
.get(`${getBaseURL()}/api/toshow`)
|
||||
.then((res) => {
|
||||
setData(res.data.map((employee: Types.Employees) => ({
|
||||
...employee,
|
||||
color: `hsl(${Math.random() * 360}, 100%, 50%)`,
|
||||
})));
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setCurrEvent((prev) => {
|
||||
if (data.length === 0) return 0;
|
||||
if (data.length === 1) return 0;
|
||||
if (prev === data.length - 1) return 0;
|
||||
else return prev + 1;
|
||||
});
|
||||
}, 8000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
window.location.reload();
|
||||
}, moment().endOf("day").diff(moment(), "milliseconds"));
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
|
||||
display: "flex",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "center",
|
||||
flexDirection: "column",
|
||||
padding: "10px",
|
||||
zIndex: 1000,
|
||||
}}
|
||||
>
|
||||
{/* <PhilSwift /> */}
|
||||
<img src="/logo.png" alt="" style={{ width: "auto", height: "100px" }} />
|
||||
</Box>
|
||||
<ParticleSimulation data={data} currEvent={currEvent} />
|
||||
<Box
|
||||
sx={{
|
||||
display: "center",
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
top: 0,
|
||||
left: 0,
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
zIndex: 10,
|
||||
}}
|
||||
>
|
||||
{data.map((employee, index) => {
|
||||
return (
|
||||
<Collapse
|
||||
in={currEvent === index}
|
||||
key={index}
|
||||
orientation="horizontal"
|
||||
timeout={1000} // Add this line to make the collapse slower
|
||||
easing={"ease-in-out"}
|
||||
>
|
||||
<Box sx={{
|
||||
width: "100vw",
|
||||
height: "100vh",
|
||||
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
flexDirection: "column",
|
||||
}}>
|
||||
<Typography
|
||||
variant="h1"
|
||||
sx={{
|
||||
width: "100vw",
|
||||
textAlign: "center",
|
||||
fontFamily: "Lexend Variable",
|
||||
color: employee.color,
|
||||
fontSize: "15rem",
|
||||
}}
|
||||
>
|
||||
{employee.Vorname} {employee.Nachname}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="h2"
|
||||
sx={{
|
||||
width: "100vw",
|
||||
textAlign: "center",
|
||||
fontFamily: "Lexend Variable",
|
||||
color: employee.color,
|
||||
fontSize: "5rem",
|
||||
}}
|
||||
>
|
||||
{employee.EventType === "Geburtstag" ? "hat Geburtstag" : "hat Jubiläum"}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Collapse>
|
||||
);
|
||||
})}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default LandingPage;
|
||||
|
||||
interface Particle {
|
||||
x: number;
|
||||
y: number;
|
||||
dx: number;
|
||||
dy: number;
|
||||
size: number;
|
||||
color: string;
|
||||
}
|
||||
|
||||
function ParticleSimulation({
|
||||
data,
|
||||
currEvent,
|
||||
} : {
|
||||
data: EmployeeWithColor[],
|
||||
currEvent: number,
|
||||
}): JSX.Element {
|
||||
const currColor = data[currEvent]?.color || "hsl(0, 100%, 50%)";
|
||||
|
||||
const [particles, setParticles] = useState<Particle[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
setParticles([])
|
||||
|
||||
// initialize particles
|
||||
for (let i = 0; i < 100; i++) {
|
||||
const size = Math.random() * 8 + 5;
|
||||
const x = Math.random() * window.innerWidth;
|
||||
const y = Math.random() * window.innerHeight;
|
||||
const dx = (Math.random() - 0.5) * 5;
|
||||
const dy = 2;
|
||||
// random color
|
||||
const color = `hsl(${Math.random() * 360}, 100%, 50%)`;
|
||||
setParticles((prev) => [...prev, { x, y, dx, dy, size, color }]);
|
||||
}
|
||||
|
||||
const cursor: {
|
||||
x: number;
|
||||
y: number;
|
||||
} = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
};
|
||||
|
||||
const cursorMove = (e: MouseEvent) => {
|
||||
cursor.x = e.clientX;
|
||||
cursor.y = e.clientY;
|
||||
};
|
||||
|
||||
document.addEventListener("mousemove", cursorMove);
|
||||
|
||||
const interval = setInterval(() => {
|
||||
setParticles((prev) =>
|
||||
prev.map((particle) => {
|
||||
// make the particles just fall down and then reappear at the top
|
||||
let x = particle.x + particle.dx;
|
||||
let y = particle.y + particle.dy;
|
||||
if (x > window.innerWidth || x < 0) {
|
||||
x = Math.random() * window.innerWidth;
|
||||
y = 0;
|
||||
}
|
||||
if (y > window.innerHeight || y < 0) {
|
||||
x = Math.random() * window.innerWidth;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
// make them collide with the text each other
|
||||
// for (let i = 0; i < prev.length; i++) {
|
||||
// if (i === prev.indexOf(particle)) continue;
|
||||
// const other = prev[i];
|
||||
// const dx = x - other.x;
|
||||
// const dy = y - other.y;
|
||||
// const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
// if (distance < particle.size + other.size) {
|
||||
// particle.dx = -particle.dx;
|
||||
// particle.dy = -particle.dy;
|
||||
// }
|
||||
// }
|
||||
|
||||
// make them collide with the cursor
|
||||
// const distance = dist(x, y, cursor.x, cursor.y);
|
||||
// if(distance < 10) {
|
||||
// particle.dx = -particle.dx
|
||||
// particle.dy = -particle.dy
|
||||
// }
|
||||
|
||||
return { ...particle, x, y };
|
||||
})
|
||||
);
|
||||
}, 1000 / 60); // 60 fps
|
||||
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
document.removeEventListener("mousemove", cursorMove);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
zIndex: -1000,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
>
|
||||
{particles.map((particle, index) => {
|
||||
return (
|
||||
<Box
|
||||
key={index}
|
||||
style={{
|
||||
width: `${particle.size}px`,
|
||||
height: `${particle.size}px`,
|
||||
backgroundColor: particle.color,
|
||||
position: "absolute",
|
||||
top: `${particle.y}px`,
|
||||
left: `${particle.x}px`,
|
||||
borderRadius: "50%",
|
||||
zIndex: 0,
|
||||
transition: "background-color 5s ease-in-out",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
function dist(x1: number, y1: number, x2: number, y2: number) {
|
||||
return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2);
|
||||
}
|
@ -1,224 +0,0 @@
|
||||
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;
|
@ -1,189 +0,0 @@
|
||||
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"></TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{users.map((user) => (
|
||||
<TableRow>
|
||||
<TableCell align="left">{user.username}</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;
|
@ -1,18 +0,0 @@
|
||||
import { Box, Typography } from '@mui/material'
|
||||
import React from 'react'
|
||||
|
||||
function Dashboard() {
|
||||
return (
|
||||
<Box sx={{
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}>
|
||||
<Typography variant="h1">Noch nicht Implementiert!</Typography>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
export default Dashboard
|
@ -1,174 +0,0 @@
|
||||
import React, { useState, ChangeEvent, FormEvent } from "react";
|
||||
import Alert from "@mui/material/Alert";
|
||||
import { Box, Button, Typography } from "@mui/material";
|
||||
import { DataGrid, GridColDef } from "@mui/x-data-grid";
|
||||
import moment from "moment";
|
||||
|
||||
function Import() {
|
||||
let correct = 0;
|
||||
let incorrect = 0;
|
||||
const [file, setFile] = useState<File | null>(null);
|
||||
const [csvData, setCsvData] = useState<
|
||||
Array<{ [key: string]: string } | null>
|
||||
>([]);
|
||||
const [correctCount, setCorrectCount] = useState(0);
|
||||
const [incorrectCount, setIncorrectCount] = useState(0);
|
||||
|
||||
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);
|
||||
|
||||
newArray.forEach((row) => {
|
||||
let isValid = true;
|
||||
for (const key in row) {
|
||||
if (!key.includes("name") && row[key]) {
|
||||
if (!moment(row[key], "DD.MM.YYYY", false).isValid()) {
|
||||
isValid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isValid) {
|
||||
correct++;
|
||||
} else {
|
||||
incorrect++;
|
||||
}
|
||||
});
|
||||
setCorrectCount(correct);
|
||||
setIncorrectCount(incorrect);
|
||||
};
|
||||
|
||||
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)}>CSV Anzeigen</Button>
|
||||
</form>
|
||||
<br />
|
||||
{csvData.length > 0 ? (
|
||||
<div>
|
||||
<Typography variant="h4">Fehlerhafte Daten</Typography>
|
||||
|
||||
<Alert variant="filled" severity="error" sx={{textAlign:"center"}}>
|
||||
{incorrectCount} von {correctCount + incorrectCount} Datensätze
|
||||
enthalten fehlerhafte Daten und wurden nicht importiert.Üperprüfen Sie die Daten und korrigieren Sie die Fehler.
|
||||
</Alert>
|
||||
<DataGrid
|
||||
rows={(csvData || [])
|
||||
.map((row, index) => ({ id: index, ...row }))
|
||||
.filter((row: { [key: string]: any }) => {
|
||||
for (const key in row) {
|
||||
if (row.hasOwnProperty(key)) {
|
||||
const value = row[key];
|
||||
if (
|
||||
!key.includes("name") &&
|
||||
value &&
|
||||
value.length > 0 &&
|
||||
!moment(value, "DD.MM.YYYY", false).isValid()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
correct++;
|
||||
return false;
|
||||
})}
|
||||
columns={
|
||||
csvData.length > 0
|
||||
? Object.keys(csvData[0] || {}).map(
|
||||
(header) =>
|
||||
({
|
||||
field: header,
|
||||
headerName: header.replace(/"/g, ""),
|
||||
width: 250,
|
||||
editable: true,
|
||||
valueFormatter: (params) => {
|
||||
if (params.value) {
|
||||
if (
|
||||
moment(
|
||||
params.value,
|
||||
"DD.MM.YYYY",
|
||||
false
|
||||
).isValid()
|
||||
) {
|
||||
return params.value;
|
||||
}
|
||||
if (
|
||||
!header.includes("name") &&
|
||||
params.value.length > 0
|
||||
) {
|
||||
incorrect++;
|
||||
return `Error: ${params.value}`;
|
||||
}
|
||||
correct++;
|
||||
return params.value;
|
||||
}
|
||||
},
|
||||
} as GridColDef)
|
||||
)
|
||||
: []
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<p>Keine Daten zum anzeigen</p>
|
||||
)}
|
||||
<Button
|
||||
sx={{
|
||||
marginTop: 2,
|
||||
}}
|
||||
variant="contained"
|
||||
>
|
||||
Daten einspielen
|
||||
</Button>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default Import;
|
@ -1,24 +0,0 @@
|
||||
import React from "react";
|
||||
import { Typography } from "@mui/material";
|
||||
import axios from "axios";
|
||||
import Calendar from "react-calendar";
|
||||
|
||||
function Kalender() {
|
||||
return (
|
||||
axios.get('https://feiertage-api.de/api/')
|
||||
.then(response => {
|
||||
console.log(response.data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
}),
|
||||
<div className="container">
|
||||
<Typography variant="h4" style={{ margin: "20px 0" }}>
|
||||
Kalender
|
||||
</Typography>
|
||||
<Calendar/>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default Kalender;
|
@ -1,31 +0,0 @@
|
||||
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
|
@ -1,912 +0,0 @@
|
||||
import {
|
||||
Alert,
|
||||
Backdrop,
|
||||
Box,
|
||||
Button,
|
||||
Checkbox,
|
||||
CircularProgress,
|
||||
Collapse,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableRow,
|
||||
TextField,
|
||||
Tooltip,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import axios from "axios";
|
||||
import { useEffect, useState } from "react";
|
||||
import { getBaseURL } from "../../functions";
|
||||
import moment from "moment";
|
||||
import { Add, Delete, Edit, Refresh, UploadFile } from "@mui/icons-material";
|
||||
import { DatePicker } from "@mui/x-date-pickers";
|
||||
import PapaParse from "papaparse";
|
||||
|
||||
function ManageData() {
|
||||
const [employees, setEmployees] = useState<Types.Employees[]>([]);
|
||||
const [checked, setChecked] = useState<string[]>([]);
|
||||
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
|
||||
const [createPopup, setCreatePopup] = useState<boolean>(false);
|
||||
const [editPopup, setEditPopup] = useState<Types.Employees | false>(false);
|
||||
const [deletePopup, setDeletePopup] = useState<Types.Employees | false>(
|
||||
false
|
||||
);
|
||||
const [uploadPopup, setUploadPopup] = useState<boolean>(false);
|
||||
|
||||
const getEmployees = () => {
|
||||
setLoading(true);
|
||||
setChecked([]);
|
||||
axios
|
||||
.get(`${getBaseURL()}/api/employees`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setEmployees(res.data);
|
||||
setLoading(false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getEmployees();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!createPopup) getEmployees();
|
||||
}, [createPopup]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!editPopup) getEmployees();
|
||||
}, [editPopup]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!deletePopup) getEmployees();
|
||||
}, [deletePopup]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!uploadPopup) getEmployees();
|
||||
}, [uploadPopup]);
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "auto",
|
||||
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
|
||||
pt: "30px",
|
||||
px: "30px",
|
||||
}}
|
||||
>
|
||||
<Backdrop open={loading} sx={{ zIndex: 1000 }}>
|
||||
<CircularProgress color="secondary" />
|
||||
</Backdrop>
|
||||
|
||||
{CreatePopUp(createPopup, setCreatePopup)}
|
||||
{EditPopUp(editPopup, setEditPopup)}
|
||||
{DeletePopUp(deletePopup, setDeletePopup)}
|
||||
{UploadPopUp(uploadPopup, setUploadPopup)}
|
||||
|
||||
<Typography variant="h4" sx={{ fontWeight: "bold" }}>
|
||||
Daten Verwalten
|
||||
</Typography>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "flex-end",
|
||||
padding: "10px",
|
||||
backgroundColor: "#00000022",
|
||||
borderRadius: "5px",
|
||||
ml: "auto",
|
||||
}}
|
||||
>
|
||||
<Tooltip arrow placement="top" title="Mitarbeiter Hinzufügen">
|
||||
<Button
|
||||
onClick={() => {
|
||||
setCreatePopup(true);
|
||||
}}
|
||||
>
|
||||
<Add />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip arrow placement="top" title="Daten Aktualisieren">
|
||||
<Button onClick={() => getEmployees()}>
|
||||
<Refresh />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip arrow placement="top" title="CSV Hochladen">
|
||||
<Button onClick={() => setUploadPopup(true)}>
|
||||
<UploadFile />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
|
||||
<Collapse orientation="horizontal" in={checked.length > 0}>
|
||||
<Tooltip arrow placement="top" title="Ausgewählte Löschen">
|
||||
<Button
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
axios
|
||||
.delete(
|
||||
`${getBaseURL()}/api/employees/${checked.join(",")}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem(
|
||||
"token"
|
||||
)}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
getEmployees();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Delete />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Collapse>
|
||||
</Box>
|
||||
|
||||
<Table>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell padding="checkbox">
|
||||
<Checkbox
|
||||
checked={checked.length === employees.length}
|
||||
onChange={(_, v) => {
|
||||
if (v) setChecked(employees.map((employee) => employee.ID));
|
||||
else setChecked([]);
|
||||
}}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell>Nachname</TableCell>
|
||||
<TableCell>Vorname</TableCell>
|
||||
<TableCell>Geburtstag</TableCell>
|
||||
<TableCell>Anstelldatum</TableCell>
|
||||
<TableCell align="right"></TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{employees.map((employee, index) => (
|
||||
<TableRow key={index}>
|
||||
<TableCell padding="checkbox">
|
||||
<Checkbox
|
||||
checked={checked.includes(employee.ID)}
|
||||
onChange={(_, v) => {
|
||||
if (v) setChecked([...checked, employee.ID]);
|
||||
else setChecked(checked.filter((id) => id !== employee.ID));
|
||||
}}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell>{employee.Nachname}</TableCell>
|
||||
<TableCell>{employee.Vorname}</TableCell>
|
||||
<TableCell>
|
||||
{employee.Geburtstag
|
||||
? moment(employee.Geburtstag).format("DD.MM.YYYY")
|
||||
: "-"}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{employee.Anstelldatum
|
||||
? moment(employee.Anstelldatum).format("DD.MM.YYYY")
|
||||
: "-"}
|
||||
</TableCell>
|
||||
<TableCell align="right">
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "center",
|
||||
gap: "10px",
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={() => {
|
||||
setEditPopup(employee);
|
||||
}}
|
||||
>
|
||||
<Edit />
|
||||
</Button>
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="error"
|
||||
onClick={() => {
|
||||
setDeletePopup(employee);
|
||||
}}
|
||||
>
|
||||
<Delete />
|
||||
</Button>
|
||||
</Box>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default ManageData;
|
||||
|
||||
function CreatePopUp(
|
||||
createPopup: boolean,
|
||||
setCreatePopup: (value: boolean) => void
|
||||
) {
|
||||
const [vorname, setVorname] = useState<string>("");
|
||||
const [nachname, setNachname] = useState<string>("");
|
||||
|
||||
const [showGeburtstag, setShowGeburtstag] = useState<boolean>(false);
|
||||
const [geburtstag, setGeburtstag] = useState<moment.Moment | null>(null);
|
||||
const [showAnstelldatum, setShowAnstelldatum] = useState<boolean>(false);
|
||||
const [anstelldatum, setAnstelldatum] = useState<moment.Moment | null>(null);
|
||||
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
|
||||
const checkValid = () => {
|
||||
if (vorname === "" || vorname.length > 24) return false;
|
||||
if (nachname === "" || nachname.length > 24) return false;
|
||||
|
||||
if (showGeburtstag && !geburtstag) return false;
|
||||
if (showAnstelldatum && !anstelldatum) return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!createPopup) {
|
||||
setVorname("");
|
||||
setNachname("");
|
||||
setShowGeburtstag(false);
|
||||
setGeburtstag(null);
|
||||
setShowAnstelldatum(false);
|
||||
setAnstelldatum(null);
|
||||
setLoading(false);
|
||||
}
|
||||
}, [createPopup]);
|
||||
|
||||
return (
|
||||
<Backdrop open={createPopup} sx={{ zIndex: 1000 }}>
|
||||
<Box
|
||||
sx={{
|
||||
width: "500px",
|
||||
height: "auto",
|
||||
backgroundColor: "white",
|
||||
borderRadius: "5px",
|
||||
boxShadow: "0 0 10px #00000055",
|
||||
padding: "20px",
|
||||
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "center",
|
||||
|
||||
gap: "20px",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ fontWeight: "bold", fontSize: "30px" }}>
|
||||
Neuen Mitarbeiter Hinzufügen
|
||||
</Typography>
|
||||
|
||||
<TextField
|
||||
label="Vorname"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
value={vorname}
|
||||
maxRows={1}
|
||||
onChange={(e) => {
|
||||
if (e.target.value.length > 24) return;
|
||||
setVorname(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<TextField
|
||||
label="Nachname"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
value={nachname}
|
||||
maxRows={1}
|
||||
onChange={(e) => {
|
||||
if (e.target.value.length > 24) return;
|
||||
setNachname(e.target.value);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: "5px",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<Checkbox
|
||||
checked={showGeburtstag}
|
||||
onChange={(_, v) => setShowGeburtstag(v)}
|
||||
/>
|
||||
<DatePicker
|
||||
label="Geburtstag"
|
||||
sx={{ width: "100%" }}
|
||||
format="DD.MM.YYYY"
|
||||
value={geburtstag}
|
||||
onChange={(v) => setGeburtstag(v)}
|
||||
disabled={!showGeburtstag}
|
||||
maxDate={moment() as any}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: "5px",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<Checkbox
|
||||
checked={showAnstelldatum}
|
||||
onChange={(_, v) => setShowAnstelldatum(v)}
|
||||
/>
|
||||
<DatePicker
|
||||
label="Anstelldatum"
|
||||
sx={{ width: "100%" }}
|
||||
format="DD.MM.YYYY"
|
||||
value={anstelldatum}
|
||||
onChange={(v) => setAnstelldatum(v)}
|
||||
disabled={!showAnstelldatum}
|
||||
maxDate={moment() as any}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "flex-end",
|
||||
padding: "10px",
|
||||
gap: "10px",
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
variant="contained"
|
||||
disabled={!checkValid() || loading}
|
||||
onClick={() => {
|
||||
if (!checkValid()) return;
|
||||
setLoading(true);
|
||||
axios
|
||||
.put(
|
||||
`${getBaseURL()}/api/employees`,
|
||||
[
|
||||
{
|
||||
Vorname: vorname,
|
||||
Nachname: nachname,
|
||||
Geburtstag: showGeburtstag
|
||||
? moment(geburtstag).add(1, "day").toDate().getTime()
|
||||
: null,
|
||||
Anstelldatum: showAnstelldatum
|
||||
? moment(anstelldatum).add(1, "day").toDate().getTime()
|
||||
: null,
|
||||
},
|
||||
],
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
setCreatePopup(false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
setLoading(false);
|
||||
});
|
||||
}}
|
||||
>
|
||||
{loading && <CircularProgress size={20} />} Hinzufügen
|
||||
</Button>
|
||||
<Button
|
||||
variant="outlined"
|
||||
disabled={loading}
|
||||
onClick={() => {
|
||||
setCreatePopup(false);
|
||||
}}
|
||||
>
|
||||
Abbrechen
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Backdrop>
|
||||
);
|
||||
}
|
||||
|
||||
function EditPopUp(
|
||||
editPopup: Types.Employees | false,
|
||||
setEditPopup: (value: Types.Employees | false) => void
|
||||
) {
|
||||
const [vorname, setVorname] = useState<string>(
|
||||
editPopup ? editPopup.Vorname : ""
|
||||
);
|
||||
const [nachname, setNachname] = useState<string>(
|
||||
editPopup ? editPopup.Nachname : ""
|
||||
);
|
||||
|
||||
const [showGeburtstag, setShowGeburtstag] = useState<boolean>(
|
||||
editPopup ? !!editPopup.Geburtstag : false
|
||||
);
|
||||
const [geburtstag, setGeburtstag] = useState<moment.Moment | null>(
|
||||
editPopup
|
||||
? editPopup.Geburtstag
|
||||
? moment(editPopup.Geburtstag)
|
||||
: null
|
||||
: null
|
||||
);
|
||||
const [showAnstelldatum, setShowAnstelldatum] = useState<boolean>(
|
||||
editPopup ? !!editPopup.Anstelldatum : false
|
||||
);
|
||||
const [anstelldatum, setAnstelldatum] = useState<moment.Moment | null>(
|
||||
editPopup
|
||||
? editPopup.Anstelldatum
|
||||
? moment(editPopup.Anstelldatum)
|
||||
: null
|
||||
: null
|
||||
);
|
||||
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
|
||||
const checkValid = () => {
|
||||
if (vorname === "" || vorname.length > 24) return false;
|
||||
if (nachname === "" || nachname.length > 24) return false;
|
||||
|
||||
if (showGeburtstag && !geburtstag) return false;
|
||||
if (showAnstelldatum && !anstelldatum) return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (editPopup) {
|
||||
setVorname(editPopup.Vorname);
|
||||
setNachname(editPopup.Nachname);
|
||||
setShowGeburtstag(!!editPopup.Geburtstag);
|
||||
setGeburtstag(editPopup.Geburtstag ? moment(editPopup.Geburtstag) : null);
|
||||
setShowAnstelldatum(!!editPopup.Anstelldatum);
|
||||
setAnstelldatum(
|
||||
editPopup.Anstelldatum ? moment(editPopup.Anstelldatum) : null
|
||||
);
|
||||
} else {
|
||||
setVorname("");
|
||||
setNachname("");
|
||||
setShowGeburtstag(false);
|
||||
setGeburtstag(null);
|
||||
setShowAnstelldatum(false);
|
||||
setAnstelldatum(null);
|
||||
setLoading(false);
|
||||
}
|
||||
}, [editPopup]);
|
||||
|
||||
return (
|
||||
<Backdrop open={editPopup !== false} sx={{ zIndex: 1000 }}>
|
||||
<Box
|
||||
sx={{
|
||||
width: "500px",
|
||||
height: "auto",
|
||||
backgroundColor: "white",
|
||||
borderRadius: "5px",
|
||||
boxShadow: "0 0 10px #00000055",
|
||||
padding: "20px",
|
||||
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "center",
|
||||
|
||||
gap: "20px",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ fontWeight: "bold", fontSize: "30px" }}>
|
||||
{editPopup && editPopup.Vorname[0]}
|
||||
{". "} {editPopup && editPopup.Nachname} Bearbeiten
|
||||
</Typography>
|
||||
|
||||
<TextField
|
||||
label="Vorname"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
value={vorname}
|
||||
maxRows={1}
|
||||
onChange={(e) => {
|
||||
if (e.target.value.length > 24) return;
|
||||
setVorname(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<TextField
|
||||
label="Nachname"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
value={nachname}
|
||||
maxRows={1}
|
||||
onChange={(e) => {
|
||||
if (e.target.value.length > 24) return;
|
||||
setNachname(e.target.value);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: "5px",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<Checkbox
|
||||
checked={showGeburtstag}
|
||||
onChange={(_, v) => setShowGeburtstag(v)}
|
||||
/>
|
||||
<DatePicker
|
||||
label="Geburtstag"
|
||||
sx={{ width: "100%" }}
|
||||
format="DD.MM.YYYY"
|
||||
value={geburtstag}
|
||||
onChange={(v) => setGeburtstag(v)}
|
||||
disabled={!showGeburtstag}
|
||||
maxDate={moment() as any}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: "5px",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<Checkbox
|
||||
checked={showAnstelldatum}
|
||||
onChange={(_, v) => setShowAnstelldatum(v)}
|
||||
/>
|
||||
<DatePicker
|
||||
label="Anstelldatum"
|
||||
sx={{ width: "100%" }}
|
||||
format="DD.MM.YYYY"
|
||||
value={anstelldatum}
|
||||
onChange={(v) => setAnstelldatum(v)}
|
||||
disabled={!showAnstelldatum}
|
||||
maxDate={moment() as any}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "flex-end",
|
||||
padding: "10px",
|
||||
gap: "10px",
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
variant="contained"
|
||||
disabled={!checkValid() || loading}
|
||||
onClick={() => {
|
||||
if (!checkValid()) return;
|
||||
setLoading(true);
|
||||
if (editPopup && !editPopup.ID) return;
|
||||
axios
|
||||
.patch(
|
||||
`${getBaseURL()}/api/employees`,
|
||||
[
|
||||
{
|
||||
ID: editPopup && editPopup.ID,
|
||||
Vorname: vorname,
|
||||
Nachname: nachname,
|
||||
Geburtstag: showGeburtstag
|
||||
? editPopup && editPopup.Geburtstag
|
||||
? moment(geburtstag).toDate().getTime()
|
||||
: moment(geburtstag).add(1, "day").toDate().getTime()
|
||||
: null,
|
||||
Anstelldatum: showAnstelldatum
|
||||
? editPopup && editPopup.Anstelldatum
|
||||
? moment(anstelldatum).toDate().getTime()
|
||||
: moment(anstelldatum)
|
||||
.add(1, "day")
|
||||
.toDate()
|
||||
.getTime()
|
||||
: null,
|
||||
},
|
||||
],
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
setEditPopup(false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
setLoading(false);
|
||||
});
|
||||
}}
|
||||
>
|
||||
{loading && <CircularProgress size={20} />} Speichern
|
||||
</Button>
|
||||
<Button
|
||||
variant="outlined"
|
||||
disabled={loading}
|
||||
onClick={() => {
|
||||
setEditPopup(false);
|
||||
}}
|
||||
>
|
||||
Abbrechen
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Backdrop>
|
||||
);
|
||||
}
|
||||
|
||||
function DeletePopUp(
|
||||
deletePopup: Types.Employees | false,
|
||||
setDeletePopup: (value: Types.Employees | false) => void
|
||||
) {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!deletePopup) setLoading(false);
|
||||
}, [deletePopup]);
|
||||
|
||||
if (deletePopup === false) return <></>;
|
||||
|
||||
return (
|
||||
<Backdrop open={Boolean(deletePopup)} sx={{ zIndex: 1000 }}>
|
||||
<Box
|
||||
sx={{
|
||||
width: "500px",
|
||||
height: "auto",
|
||||
backgroundColor: "white",
|
||||
borderRadius: "5px",
|
||||
boxShadow: "0 0 10px #00000055",
|
||||
padding: "20px",
|
||||
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "center",
|
||||
|
||||
gap: "20px",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ fontWeight: "bold", fontSize: "30px" }}>
|
||||
Mitarbeiter Löschen
|
||||
</Typography>
|
||||
|
||||
<Typography>
|
||||
Wollen Sie wirklich den Mitarbeiter{" "}
|
||||
<strong>
|
||||
{deletePopup?.Vorname} {deletePopup?.Nachname}{" "}
|
||||
</strong>
|
||||
löschen?
|
||||
</Typography>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "flex-end",
|
||||
padding: "10px",
|
||||
gap: "10px",
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
variant="contained"
|
||||
color="error"
|
||||
disabled={loading}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
if (deletePopup && !deletePopup.ID) return;
|
||||
axios
|
||||
.delete(`${getBaseURL()}/api/employees/${deletePopup?.ID}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
setDeletePopup(false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
setLoading(false);
|
||||
});
|
||||
}}
|
||||
>
|
||||
{loading && <CircularProgress size={20} />} Löschen
|
||||
</Button>
|
||||
<Button
|
||||
variant="outlined"
|
||||
disabled={loading}
|
||||
onClick={() => {
|
||||
setDeletePopup(false);
|
||||
}}
|
||||
>
|
||||
Abbrechen
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Backdrop>
|
||||
);
|
||||
}
|
||||
|
||||
interface EmployeePartial {
|
||||
Vorname: string;
|
||||
Nachname: string;
|
||||
Geburtstag: moment.Moment | null;
|
||||
Anstelldatum: moment.Moment | null;
|
||||
}
|
||||
|
||||
function UploadPopUp(
|
||||
uploadPopup: boolean,
|
||||
setUploadPopup: (value: boolean) => void
|
||||
) {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
|
||||
const [data, setData] = useState<EmployeePartial[] | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!uploadPopup) setLoading(false);
|
||||
}, [uploadPopup]);
|
||||
|
||||
return (
|
||||
<Backdrop open={uploadPopup} sx={{ zIndex: 1000 }}>
|
||||
<Box
|
||||
sx={{
|
||||
width: "500px",
|
||||
height: "auto",
|
||||
backgroundColor: "white",
|
||||
borderRadius: "5px",
|
||||
boxShadow: "0 0 10px #00000055",
|
||||
padding: "20px",
|
||||
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "center",
|
||||
|
||||
gap: "20px",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ fontWeight: "bold", fontSize: "30px" }}>
|
||||
CSV Hochladen
|
||||
</Typography>
|
||||
|
||||
<Collapse in={error !== null}>
|
||||
<Alert severity="error">{error}</Alert>
|
||||
</Collapse>
|
||||
|
||||
<input
|
||||
type="file"
|
||||
onChange={(e) => {
|
||||
if (!e.target.files) return;
|
||||
|
||||
const file = e.target.files[0];
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const result = e.target?.result as string;
|
||||
|
||||
const data: PapaParse.ParseResult<string[]> = PapaParse.parse(result.trim())
|
||||
|
||||
if((data.data[0]).length !== 4) return setError("CSV Datei ist nicht im richtigen Format");
|
||||
if(data.data[0][0] !== "Vorname") return setError("CSV Datei ist nicht im richtigen Format");
|
||||
if(data.data[0][1] !== "Nachname") return setError("CSV Datei ist nicht im richtigen Format");
|
||||
if(data.data[0][2] !== "Anstelldatum") return setError("CSV Datei ist nicht im richtigen Format");
|
||||
if(data.data[0][3] !== "Geburtstag") return setError("CSV Datei ist nicht im richtigen Format");
|
||||
|
||||
const employees: EmployeePartial[] = [];
|
||||
for(let i = 1; i < data.data.length; i++) {
|
||||
const employee = data.data[i];
|
||||
if(employee === null || employee.length === 0) continue;
|
||||
if(employee.length !== 4) return setError("CSV Datei ist nicht im richtigen Format. (Zeile: " + (i + 1).toString() + ")");
|
||||
if(employee[0].length > 24) return setError("Vorname ist zu lang");
|
||||
if(employee[1].length > 24) return setError("Nachname ist zu lang");
|
||||
if(employee[2] !== "" && !moment(employee[2], "DD.MM.YYYY", true).isValid()) return setError("Anstelldatum ist nicht im richtigen Format \n Zeile: " + (i + 1).toString());
|
||||
if(employee[3] !== "" && !moment(employee[3], "DD.MM.YYYY", true).isValid()) return setError("Geburtstag ist nicht im richtigen Format \n Zeile: " + (i + 1).toString());
|
||||
|
||||
employees.push({
|
||||
Vorname: employee[0],
|
||||
Nachname: employee[1],
|
||||
Anstelldatum: employee[2] === "" ? null : moment(employee[2], "DD.MM.YYYY"),
|
||||
Geburtstag: employee[3] === "" ? null : moment(employee[3], "DD.MM.YYYY"),
|
||||
});
|
||||
}
|
||||
|
||||
setData(employees);
|
||||
};
|
||||
|
||||
reader.readAsText(file);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "flex-end",
|
||||
padding: "10px",
|
||||
gap: "10px",
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
variant="contained"
|
||||
disabled={loading || !data}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
axios.put(`${getBaseURL()}/api/employees`, data?.map((e) => ({
|
||||
Vorname: e.Vorname,
|
||||
Nachname: e.Nachname,
|
||||
Geburtstag: e.Geburtstag ? moment(e.Geburtstag).add(1, "day").toDate().getTime() : null,
|
||||
Anstelldatum: e.Anstelldatum ? moment(e.Anstelldatum).add(1, "day").toDate().getTime() : null,
|
||||
})), {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
}).then(() => {
|
||||
setUploadPopup(false);
|
||||
setLoading(false);
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
setLoading(false);
|
||||
setError(`Fehler beim Hochladen: ${err.response.data.message}`);
|
||||
})
|
||||
}}
|
||||
>
|
||||
{loading && <CircularProgress size={20} />} Hochladen
|
||||
</Button>
|
||||
<Button
|
||||
variant="outlined"
|
||||
disabled={loading}
|
||||
onClick={() => {
|
||||
setUploadPopup(false);
|
||||
}}
|
||||
>
|
||||
Abbrechen
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Backdrop>
|
||||
);
|
||||
}
|
21
frontend/src/types.d.ts
vendored
@ -1,21 +0,0 @@
|
||||
declare namespace Types {
|
||||
interface Employees {
|
||||
ID: string;
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
]
|
||||
}
|
4
next.config.js
Normal file
@ -0,0 +1,4 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {}
|
||||
|
||||
module.exports = nextConfig
|
4807
package-lock.json
generated
Normal file
35
package.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "testapp",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -H 100.101.64.38",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.11.3",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@mui/icons-material": "^5.15.3",
|
||||
"@mui/material": "^5.15.3",
|
||||
"@mui/x-data-grid": "^6.18.7",
|
||||
"@prisma/client": "^5.7.1",
|
||||
"axios": "^1.6.2",
|
||||
"next": "^14.0.4",
|
||||
"prisma": "^5.7.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-query": "^3.39.3",
|
||||
"react-router-dom": "^6.21.1",
|
||||
"zustand": "^4.4.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.0.4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
16
prisma/schema.prisma
Normal file
@ -0,0 +1,16 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Mitarbeiter {
|
||||
ID String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
|
||||
Vorname String
|
||||
Nachname String
|
||||
Anstelldatum DateTime @db.Date
|
||||
Geburtstag DateTime @db.Date
|
||||
}
|
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
1
public/next.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
After Width: | Height: | Size: 1.3 KiB |
1
public/vercel.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
|
After Width: | Height: | Size: 629 B |
15
src/app/app.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import { Routes, Route } from "react-router-dom";
|
||||
|
||||
// @Pages
|
||||
import Dashboard from "./dashboard/page";
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/dashboard" element={<Dashboard/>} />
|
||||
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
127
src/app/dashboard/page.tsx
Normal file
@ -0,0 +1,127 @@
|
||||
'use client'
|
||||
import { Box, Button, Typography, } from "@mui/material";
|
||||
import { DataGrid, GridColDef } from '@mui/x-data-grid';
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import axios from "axios";
|
||||
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
// ...3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const URL = "http://100.101.64.38:3000/api/hello";
|
||||
|
||||
export default function Page() {
|
||||
const [data, setData] = useState<any>({ message: "" });
|
||||
|
||||
useEffect(() => {
|
||||
async function getData() {
|
||||
try {
|
||||
const response = await fetch(URL);
|
||||
const jsonData = await response.json();
|
||||
setData(jsonData);
|
||||
} catch (error) {
|
||||
console.error("Error fetching data:", error);
|
||||
}
|
||||
}
|
||||
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
const columns: GridColDef[] = [
|
||||
{
|
||||
field: 'Vorname',
|
||||
headerName: 'Vorname',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
field: 'Nachname',
|
||||
headerName: 'Nachname',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
field: 'Anstelldatum',
|
||||
headerName: 'Anstelldatum',
|
||||
width: 110,
|
||||
},
|
||||
{
|
||||
field: 'Geburtstag',
|
||||
headerName: 'Geburtstag',
|
||||
description: 'This column has a value getter and is not sortable.',
|
||||
sortable: false,
|
||||
width: 160,
|
||||
},
|
||||
];
|
||||
|
||||
const rows = [
|
||||
{ id: "1", Vorname:data.vorname, Nachname: data.nachname, Anstelldatum: data.anstellungsdatum, Geburtstag: data.geburtsdatum }
|
||||
];
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
height: "100vh",
|
||||
background: "linear-gradient(45deg, #003263 15%, #9bc9e5 90%)",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ fontSize: 50, fontWeight: "bold", color: "white" }}>
|
||||
Welcome to the Admin panel bv g
|
||||
</Typography>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "top",
|
||||
height: "90%",
|
||||
background: "white",
|
||||
width: "90%",
|
||||
borderRadius: "20px",
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
variant="contained"
|
||||
sx={{
|
||||
width: "6rem",
|
||||
height: "3rem",
|
||||
marginLeft: "1rem",
|
||||
marginTop: "1rem",
|
||||
|
||||
}}
|
||||
onClick={() => {
|
||||
|
||||
}}
|
||||
>
|
||||
CSV Datei auswählen
|
||||
</Button>
|
||||
<DataGrid rows={rows} columns={columns}
|
||||
sx={{
|
||||
marginTop: "1rem",
|
||||
borderRadius: "20px",
|
||||
width: "auto",
|
||||
}}
|
||||
initialState={{
|
||||
pagination: {
|
||||
paginationModel: {
|
||||
pageSize: 5,
|
||||
},
|
||||
},
|
||||
}}
|
||||
checkboxSelection />
|
||||
|
||||
|
||||
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
BIN
src/app/favicon.ico
Normal file
After Width: | Height: | Size: 25 KiB |
10
src/app/globals.css
Normal file
@ -0,0 +1,10 @@
|
||||
:root {
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100vw;
|
||||
height: auto;
|
||||
;
|
||||
}
|
@ -1,26 +1,21 @@
|
||||
import ReactDOM from "react-dom/client";
|
||||
import "./index.css";
|
||||
import App from "./App";
|
||||
import App from "./app";
|
||||
import { createTheme, ThemeProvider, CssBaseline } from "@mui/material";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
||||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
||||
import moment from "moment";
|
||||
|
||||
// fonts
|
||||
import '@fontsource-variable/overpass';
|
||||
import '@fontsource-variable/lexend';
|
||||
|
||||
moment.locale("de");
|
||||
|
||||
const theme = createTheme({
|
||||
palette: {
|
||||
mode: "light",
|
||||
primary: {
|
||||
main: "#003263",
|
||||
main: "#f7a7ff",
|
||||
},
|
||||
secondary: {
|
||||
main: "#9bc9e5",
|
||||
main: "#4b49ff",
|
||||
},
|
||||
},
|
||||
// make the buttons not rounded
|
||||
@ -45,9 +40,7 @@ root.render(
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
<BrowserRouter>
|
||||
<LocalizationProvider dateAdapter={AdapterMoment}>
|
||||
<App />
|
||||
</LocalizationProvider>
|
||||
</BrowserRouter>
|
||||
</ThemeProvider>
|
||||
);
|
19
src/app/layout.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import type { Metadata } from 'next'
|
||||
import './globals.css'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'DWLDash',
|
||||
description: 'DWL dashboard',
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
)
|
||||
}
|
101
src/app/page.tsx
Normal file
@ -0,0 +1,101 @@
|
||||
'use client'
|
||||
|
||||
import Image from "next/image";
|
||||
import { Box, Button, TextField, Typography } from "@mui/material";
|
||||
import { AccountCircle, Key, Login } from "@mui/icons-material";
|
||||
import { useHref } from "react-router-dom";
|
||||
|
||||
export default function Home() {
|
||||
return(
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "top",
|
||||
height: "100vh",
|
||||
background: "linear-gradient(45deg, #003263 15%, #9bc9e5 90%)",
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
src="/DWLLogo.png"
|
||||
alt="DWLDash Logo"
|
||||
width={500}
|
||||
height={500}
|
||||
style={{ width: "10%", height: "auto" }}
|
||||
/>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ fontSize: 50, fontWeight: "bold" }}>
|
||||
Welcome to the Admin panel
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
height: "auto",
|
||||
backgroundColor: "white",
|
||||
padding: "5%",
|
||||
margin: "10%",
|
||||
borderRadius: "5%",
|
||||
boxShadow: "0 0 100px 5px rgba(0, 0, 0, 0.5)",
|
||||
}}
|
||||
>
|
||||
<Box sx={{ display: "flex", alignItems: "flex-end" }}>
|
||||
<AccountCircle sx={{ color: 'action.active', mr: 1, my: 5 }} />
|
||||
<TextField
|
||||
variant="outlined"
|
||||
label="Username"
|
||||
sx={{ width: "100%", marginBottom: "10%" }}
|
||||
required
|
||||
/>
|
||||
</Box>
|
||||
<Box sx={{ alignItems: "flex-end" }}>
|
||||
<Key sx={{ color: 'action.active', mr: 1, marginTop: "15px" }} />
|
||||
<TextField
|
||||
variant="outlined"
|
||||
label="Password"
|
||||
sx={{ marginBottom: "25%" }}
|
||||
required
|
||||
/>
|
||||
</Box>
|
||||
<Button variant = "contained" startIcon = {< Login />}
|
||||
sx={{
|
||||
':hover': {
|
||||
bgcolor: 'red',
|
||||
color: 'black',
|
||||
},
|
||||
}}
|
||||
onClick={() => {
|
||||
|
||||
}}
|
||||
>
|
||||
|
||||
<Typography
|
||||
sx={{
|
||||
fontSize: 20,
|
||||
fontWeight: "bold",
|
||||
}}
|
||||
>
|
||||
Login
|
||||
</Typography>
|
||||
</Button>
|
||||
</Box>
|
||||
</Box >
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
39
src/pages/api/hello.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
type ResponseData = {
|
||||
vorname: string
|
||||
nachname: string
|
||||
geburtsdatum: string
|
||||
anstellungsdatum: string
|
||||
|
||||
}
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse<ResponseData>
|
||||
) {
|
||||
const result = await prisma.mitarbeiter.findFirst({
|
||||
select: { Vorname: true },
|
||||
orderBy: { ID: 'asc' },
|
||||
});
|
||||
const result2 = await prisma.mitarbeiter.findFirst({
|
||||
select: { Nachname: true },
|
||||
orderBy: { ID: 'asc' },
|
||||
});
|
||||
const result3 = await prisma.mitarbeiter.findFirst({
|
||||
select: { Geburtstag: true },
|
||||
orderBy: { ID: 'asc' },
|
||||
});
|
||||
const result4 = await prisma.mitarbeiter.findFirst({
|
||||
select: { Anstelldatum: true },
|
||||
orderBy: { ID: 'asc' },
|
||||
});
|
||||
const firstname = result?.Vorname ?? '';
|
||||
const lastname = result2?.Nachname ?? '';
|
||||
const birthday = result3?.Geburtstag ?? '';
|
||||
const hiredate = result4?.Anstelldatum ?? '';
|
||||
res.status(200).send({ vorname: firstname, nachname: lastname, geburtsdatum: birthday as string, anstellungsdatum: hiredate as string });
|
||||
}
|
27
tsconfig.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2017",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|