mangutil 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # mangdto
2
+
3
+ This template should help get you started developing with Vue 3 in Vite.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ [VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8
+
9
+ ## Recommended Browser Setup
10
+
11
+ - Chromium-based browsers (Chrome, Edge, Brave, etc.):
12
+ - [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
13
+ - [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters)
14
+ - Firefox:
15
+ - [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/)
16
+ - [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)
17
+
18
+ ## Customize configuration
19
+
20
+ See [Vite Configuration Reference](https://vite.dev/config/).
21
+
22
+ ## Project Setup
23
+
24
+ ```sh
25
+ npm install
26
+ ```
27
+
28
+ ### Compile and Hot-Reload for Development
29
+
30
+ ```sh
31
+ npm run dev
32
+ ```
33
+
34
+ ### Compile and Minify for Production
35
+
36
+ ```sh
37
+ npm run build
38
+ ```
File without changes
package/dist/index.js ADDED
File without changes
@@ -0,0 +1,5 @@
1
+ import { BstlArtikel, ArtikelData } from "mangdto";
2
+ export default class ConverterUtil {
3
+ static convertBstlArtikel(artikel: BstlArtikel): ArtikelData;
4
+ private static convertProdukt;
5
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mangdto_1 = require("mangdto");
4
+ // import BstlArtikel from "@/entities/common/bstl_artikel"
5
+ // import { Produkt } from "@/entities/common/bstl_artikel"
6
+ // import {
7
+ // Produkt as ProduktData,
8
+ // Extra as ExtraData,
9
+ // Auswahl as AuswahlData,
10
+ // Subprodukt as SubproduktData,
11
+ // } from "@/entities/common/request/artikel_data"
12
+ // import ArtikelData from "@/entities/common/request/artikel_data"
13
+ // import { v4 as uuidv4 } from "uuid"
14
+ class ConverterUtil {
15
+ static convertBstlArtikel(artikel) {
16
+ var artikelData = new mangdto_1.ArtikelData();
17
+ //artikelData.id = uuidv4()
18
+ artikelData.anzahl = artikel.anzahl;
19
+ artikelData.kommentare = artikel.kommentare;
20
+ artikelData.produkt = this.convertProdukt(artikel.produkt);
21
+ return artikelData;
22
+ }
23
+ static convertProdukt(source) {
24
+ var _a, _b, _c;
25
+ var produkt = new mangdto_1.ArtikelData_Produkt();
26
+ produkt.preislisteProduktId = source.preislisteProduktId;
27
+ if (source.art) {
28
+ produkt.artId = source.art.id;
29
+ }
30
+ // produkt.id = uuidv4()
31
+ (_a = source.extras) === null || _a === void 0 ? void 0 : _a.forEach((sourceExtra) => {
32
+ var extra = new mangdto_1.ArtikelData_Extra();
33
+ extra.id = sourceExtra.id;
34
+ if (sourceExtra.art) {
35
+ extra.artId = sourceExtra.art.id;
36
+ }
37
+ extra.preislisteProduktExtraId = sourceExtra.preislisteExtraId;
38
+ produkt.extras.push(extra);
39
+ });
40
+ (_b = source.auswahlen) === null || _b === void 0 ? void 0 : _b.forEach((sourceAuswahl) => {
41
+ var auswahl = new mangdto_1.ArtikelData_Auswahl();
42
+ auswahl.id = sourceAuswahl.id;
43
+ auswahl.auswahlId = sourceAuswahl.preislisteAuswahlId;
44
+ auswahl.optionId = sourceAuswahl.optionId;
45
+ if (sourceAuswahl.option.art) {
46
+ auswahl.artId = sourceAuswahl.option.art.id;
47
+ }
48
+ // auswahl.produkt = this.convertProdukt(sourceAuswahl.option)
49
+ produkt.auswahlen.push(auswahl);
50
+ });
51
+ (_c = source.subprodukte) === null || _c === void 0 ? void 0 : _c.forEach((sourceSubprodukt) => {
52
+ var subprodukt = new mangdto_1.ArtikelData_Subprodukt();
53
+ subprodukt.id = sourceSubprodukt.id;
54
+ subprodukt.subproduktId = sourceSubprodukt.preislisteSubproduktId;
55
+ subprodukt.optionId = sourceSubprodukt.optionId;
56
+ subprodukt.produkt = this.convertProdukt(sourceSubprodukt.produkt);
57
+ produkt.subprodukte.push(subprodukt);
58
+ });
59
+ return produkt;
60
+ }
61
+ }
62
+ exports.default = ConverterUtil;
@@ -0,0 +1,5 @@
1
+ import { ProduktSorte, Terminart } from 'mangdto';
2
+ export default class EnumFormatter {
3
+ static formatSorte(sorte: ProduktSorte): "Getränk" | "Speise";
4
+ static formatTerminart(terminart: Terminart): "Abholung" | "Reservierung" | "Sofortbestellung" | "Lieferung";
5
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // import ProduktSorte from '@/entities/common/enums/produkt_sorte'
4
+ // import Terminart from '@/entities/common/enums/terminart'
5
+ const mangdto_1 = require("mangdto");
6
+ class EnumFormatter {
7
+ static formatSorte(sorte) {
8
+ switch (sorte) {
9
+ case mangdto_1.ProduktSorte.Getraenk:
10
+ return 'Getränk';
11
+ case mangdto_1.ProduktSorte.Speise:
12
+ return 'Speise';
13
+ }
14
+ }
15
+ static formatTerminart(terminart) {
16
+ switch (terminart) {
17
+ case mangdto_1.Terminart.Abholung:
18
+ return 'Abholung';
19
+ case mangdto_1.Terminart.Reservierung:
20
+ return 'Reservierung';
21
+ case mangdto_1.Terminart.Sofortbestellung:
22
+ return 'Sofortbestellung';
23
+ case mangdto_1.Terminart.Lieferung:
24
+ return 'Lieferung';
25
+ }
26
+ }
27
+ }
28
+ exports.default = EnumFormatter;
@@ -0,0 +1,4 @@
1
+ export default class SocketMessage {
2
+ type: string;
3
+ payload: string;
4
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class SocketMessage {
4
+ }
5
+ exports.default = SocketMessage;
@@ -0,0 +1,16 @@
1
+ declare const SocketMessageType: {
2
+ ANFORDERUNG_STATUS_UPDATE: string;
3
+ ABHOLUNG_STATUS_UPDATE: string;
4
+ LIEFERUNG_STATUS_UPDATE: string;
5
+ BESTELLUNG_INSERTED: string;
6
+ BESTELLUNG_UPDATED: string;
7
+ BESTELLUNG_STORNIERT: string;
8
+ SERVICE_INSERTED: string;
9
+ NACHBESTELLUNG_INSERTED: string;
10
+ VORBESTELLUNG_INSERTED: string;
11
+ ARTIKELLISTE_INSERTED: string;
12
+ KUECHENAUFGABE_INSERTED: string;
13
+ RESERVIERUNG_INSERTED: string;
14
+ BENACHRICHTIGUNG: string;
15
+ };
16
+ export default SocketMessageType;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const SocketMessageType = {
4
+ ANFORDERUNG_STATUS_UPDATE: 'ANFORDERUNG_STATUS_UPDATE',
5
+ ABHOLUNG_STATUS_UPDATE: 'ABHOLUNG_STATUS_UPDATE',
6
+ LIEFERUNG_STATUS_UPDATE: 'LIEFERUNG_STATUS_UPDATE',
7
+ BESTELLUNG_INSERTED: 'BESTELLUNG_INSERTED',
8
+ BESTELLUNG_UPDATED: 'BESTELLUNG_UPDATED',
9
+ BESTELLUNG_STORNIERT: 'BESTELLUNG_STORNIERT',
10
+ SERVICE_INSERTED: 'SERVICE_INSERTED',
11
+ NACHBESTELLUNG_INSERTED: 'NACHBESTELLUNG_INSERTED',
12
+ VORBESTELLUNG_INSERTED: 'VORBESTELLUNG_INSERTED',
13
+ ARTIKELLISTE_INSERTED: 'ARTIKELLISTE_INSERTED',
14
+ KUECHENAUFGABE_INSERTED: 'KUECHENAUFGABE_INSERTED',
15
+ RESERVIERUNG_INSERTED: 'RESERVIERUNG_INSERTED',
16
+ BENACHRICHTIGUNG: 'BENACHRICHTIGUNG'
17
+ };
18
+ exports.default = SocketMessageType;
@@ -0,0 +1,8 @@
1
+ import Vue from 'vue';
2
+ export default class Swapper extends Vue {
3
+ static instance: Swapper;
4
+ pushUp(arr: any[], index: number): void;
5
+ pushDown(arr: any[], index: number): void;
6
+ private static swap;
7
+ swapElements(array: any, index: any, index2: any): void;
8
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vue_1 = require("vue");
4
+ class Swapper extends vue_1.default {
5
+ pushUp(arr, index) {
6
+ if (index === 0) {
7
+ return;
8
+ }
9
+ let priorIndex = index - 1;
10
+ let itemCopy = { ...arr[index] };
11
+ let priorItemCopy = { ...arr[priorIndex] };
12
+ // Swap array position with prior element
13
+ this.$set(arr, priorIndex, itemCopy);
14
+ this.$set(arr, index, priorItemCopy);
15
+ //this.swap(arr, index, 1)
16
+ }
17
+ pushDown(arr, index) {
18
+ if (index === arr.length - 1) {
19
+ return;
20
+ }
21
+ let subsequentIndex = index + 1;
22
+ let itemCopy = { ...arr[index] };
23
+ let subsequentItemCopy = { ...arr[subsequentIndex] };
24
+ // Swap array positions with subsequent element
25
+ this.$set(arr, subsequentIndex, itemCopy);
26
+ this.$set(arr, index, subsequentItemCopy);
27
+ }
28
+ static swap(array, index, index2) {
29
+ let rows = [array[index], array[index2]];
30
+ array.splice(index, 1, rows[1], rows[0]);
31
+ }
32
+ swapElements(array, index, index2) { }
33
+ }
34
+ Swapper.instance = new Swapper();
35
+ exports.default = Swapper;
@@ -0,0 +1,6 @@
1
+ export default class Validator {
2
+ static plzValidate: ((v: string) => true | "Bitte PLZ angeben" | "Bitte gültige PLZ angeben")[];
3
+ static emailValidate: ((v: string) => true | "Bitte E-Mail angeben" | "Bitte gültige E-Mail angeben")[];
4
+ static usernameRules: ((v: string) => true | "Bitte Benutzername angeben" | "Benutzername muss aus min. 5 Zeichen bestehen")[];
5
+ static strongPasswordRules: ((v: string) => string)[];
6
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Validator {
4
+ }
5
+ Validator.plzValidate = [
6
+ (v) => {
7
+ if (!!!v)
8
+ return "Bitte PLZ angeben";
9
+ var pattern = /^\d{5}$/;
10
+ return pattern.test(v) ? true : "Bitte gültige PLZ angeben";
11
+ },
12
+ ];
13
+ Validator.emailValidate = [
14
+ (v) => {
15
+ if (!!!v)
16
+ return "Bitte E-Mail angeben";
17
+ var pattern = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/g;
18
+ return pattern.test(v) ? true : "Bitte gültige E-Mail angeben";
19
+ },
20
+ ];
21
+ Validator.usernameRules = [
22
+ (v) => {
23
+ if (!!!v)
24
+ return "Bitte Benutzername angeben";
25
+ if (v.length < 5) {
26
+ return "Benutzername muss aus min. 5 Zeichen bestehen";
27
+ }
28
+ return true;
29
+ },
30
+ ];
31
+ Validator.strongPasswordRules = [
32
+ (v) => {
33
+ if (!!!v)
34
+ return "Bitte Passwort angeben";
35
+ var pattern = /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,20}$/;
36
+ },
37
+ ];
38
+ exports.default = Validator;
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "mangutil",
3
+ "version": "1.0.0",
4
+ "description": "Die Mangeroo DTO Library",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "scripts": {
11
+ "clean": "rimraf ./dist",
12
+ "build": "npm run clean && tsc"
13
+ },
14
+ "dependencies": {
15
+ "mangdto": "^1.2.10",
16
+ "rimraf": "^6.1.2",
17
+ "tsc": "^2.0.4",
18
+ "tsc-alias": "^1.8.16",
19
+ "typescript": "^5.9.3",
20
+ "vue-class-component": "^7.2.6"
21
+ }
22
+ }