@lucaapp/service-utils 1.32.1 → 1.34.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.
@@ -1,8 +1,7 @@
1
- type Consumer = {
1
+ export type Consumer = {
2
2
  uuid: string;
3
3
  username: string;
4
4
  createdAt: Date;
5
5
  updatedAt: Date;
6
6
  deletedAt: Date | null;
7
7
  };
8
- export type { Consumer };
@@ -1,7 +1,6 @@
1
- type Location = {
1
+ export type Location = {
2
2
  uuid: string;
3
3
  groupId?: string;
4
4
  createdAt: Date;
5
5
  updatedAt: Date;
6
6
  };
7
- export type { Location };
@@ -1,7 +1,6 @@
1
- type LocationGroup = {
1
+ export type LocationGroup = {
2
2
  uuid: string;
3
3
  operatorId: string;
4
4
  createdAt: Date;
5
5
  updatedAt: Date;
6
6
  };
7
- export type { LocationGroup };
@@ -1,4 +1,4 @@
1
- type LocationGroupEmployees = {
1
+ export type LocationGroupEmployees = {
2
2
  uuid: string;
3
3
  firstName: string;
4
4
  lastName: string | null;
@@ -9,4 +9,3 @@ type LocationGroupEmployees = {
9
9
  createdAt: Date;
10
10
  updatedAt: Date;
11
11
  };
12
- export type { LocationGroupEmployees };
@@ -0,0 +1,6 @@
1
+ export type LocationMenu = {
2
+ locationId: string;
3
+ menu: object;
4
+ createdAt: Date;
5
+ updatedAt: Date;
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- type Operator = {
1
+ export type Operator = {
2
2
  uuid: string;
3
3
  firstName: string;
4
4
  lastName: string;
@@ -14,4 +14,3 @@ type Operator = {
14
14
  createdAt: Date;
15
15
  updatedAt: Date;
16
16
  };
17
- export type { Operator };
@@ -1,4 +1,4 @@
1
- type Payment = {
1
+ export type Payment = {
2
2
  uuid: string;
3
3
  locationId: string;
4
4
  locationName: string | null;
@@ -26,4 +26,3 @@ type Payment = {
26
26
  statusNewAt: Date | null;
27
27
  statusReversedAt?: Date | null;
28
28
  };
29
- export type { Payment };
@@ -1,6 +1,5 @@
1
- type WsEvent = {
1
+ export type WsEvent = {
2
2
  subId: string;
3
3
  type: string;
4
4
  data: any;
5
5
  };
6
- export type { WsEvent };
@@ -1,6 +1,7 @@
1
1
  import type { Payment } from './events/payment';
2
2
  import type { Consumer } from './events/consumer';
3
3
  import type { Operator } from './events/operator';
4
+ import type { LocationMenu } from './events/locationMenu';
4
5
  import type { LocationGroupEmployees } from './events/locationGroupEmployees';
5
6
  import type { WsEvent } from './events/wsEvent';
6
7
  import { Service } from '../serviceIdentity';
@@ -11,6 +12,7 @@ declare enum KafkaTopic {
11
12
  CONSUMERS = "consumers",
12
13
  OPERATORS = "operators",
13
14
  LOCATIONS = "locations",
15
+ LOCATION_MENUS = "location_menus",
14
16
  LOCATION_GROUPS = "location_groups",
15
17
  LOCATION_GROUP_EMPLOYEES = "location_group_employees",
16
18
  WS_EVENT_backend = "wsevent_backend",
@@ -22,6 +24,7 @@ type MessageFormats = {
22
24
  [KafkaTopic.CONSUMERS]: Consumer;
23
25
  [KafkaTopic.OPERATORS]: Operator;
24
26
  [KafkaTopic.LOCATIONS]: Location;
27
+ [KafkaTopic.LOCATION_MENUS]: LocationMenu;
25
28
  [KafkaTopic.LOCATION_GROUPS]: LocationGroup;
26
29
  [KafkaTopic.LOCATION_GROUP_EMPLOYEES]: LocationGroupEmployees;
27
30
  [KafkaTopic.WS_EVENT_backend]: WsEvent;
@@ -33,6 +36,7 @@ declare const MessageIssuer: {
33
36
  consumers: Service;
34
37
  operators: Service;
35
38
  locations: Service;
39
+ location_menus: Service;
36
40
  location_groups: Service;
37
41
  location_group_employees: Service;
38
42
  wsevent_backend: Service;
@@ -8,6 +8,7 @@ var KafkaTopic;
8
8
  KafkaTopic["CONSUMERS"] = "consumers";
9
9
  KafkaTopic["OPERATORS"] = "operators";
10
10
  KafkaTopic["LOCATIONS"] = "locations";
11
+ KafkaTopic["LOCATION_MENUS"] = "location_menus";
11
12
  KafkaTopic["LOCATION_GROUPS"] = "location_groups";
12
13
  KafkaTopic["LOCATION_GROUP_EMPLOYEES"] = "location_group_employees";
13
14
  KafkaTopic["WS_EVENT_backend"] = "wsevent_backend";
@@ -20,6 +21,7 @@ const MessageIssuer = {
20
21
  [KafkaTopic.CONSUMERS]: serviceIdentity_1.Service.BACKEND,
21
22
  [KafkaTopic.OPERATORS]: serviceIdentity_1.Service.BACKEND,
22
23
  [KafkaTopic.LOCATIONS]: serviceIdentity_1.Service.BACKEND,
24
+ [KafkaTopic.LOCATION_MENUS]: serviceIdentity_1.Service.BACKEND,
23
25
  [KafkaTopic.LOCATION_GROUPS]: serviceIdentity_1.Service.BACKEND,
24
26
  [KafkaTopic.LOCATION_GROUP_EMPLOYEES]: serviceIdentity_1.Service.BACKEND,
25
27
  [KafkaTopic.WS_EVENT_backend]: serviceIdentity_1.Service.BACKEND,
@@ -22,7 +22,11 @@ declare class Money implements Money {
22
22
  private constructor();
23
23
  clone(): Money;
24
24
  getEuroAmount(): number;
25
+ /**
26
+ * @deprecated Use getFormattedString in place of getEuroString
27
+ */
25
28
  getEuroString(): string;
29
+ getFormattedString(locale: string): string;
26
30
  percentage(percentage: number): Money;
27
31
  min(comparator: Money): Money;
28
32
  max(comparator: Money): Money;
@@ -34,9 +34,23 @@ class Money {
34
34
  getEuroAmount() {
35
35
  return amountToEuro(this.value);
36
36
  }
37
+ /**
38
+ * @deprecated Use getFormattedString in place of getEuroString
39
+ */
37
40
  getEuroString() {
38
41
  return this.getEuroAmount().toFixed(2);
39
42
  }
43
+ getFormattedString(locale) {
44
+ const transactionalLanguage = locale === 'de' ? 'de-DE' : 'en-US';
45
+ return new Intl.NumberFormat(transactionalLanguage, {
46
+ style: 'currency',
47
+ currency: 'EUR',
48
+ minimumFractionDigits: 2,
49
+ maximumFractionDigits: 2,
50
+ })
51
+ .format(this.getEuroAmount())
52
+ .replace(/\s/, ' ');
53
+ }
40
54
  add(addend) {
41
55
  return Money.fromAmount(this.value + (addend?.value || 0));
42
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucaapp/service-utils",
3
- "version": "1.32.1",
3
+ "version": "1.34.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [