spotcharge-types 1.0.360 → 1.0.362

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.
Files changed (73) hide show
  1. package/dist/consts/catalog/catalog-error.const.d.ts +6 -0
  2. package/dist/consts/catalog/catalog-error.const.d.ts.map +1 -0
  3. package/dist/consts/catalog/catalog-error.const.js +8 -0
  4. package/dist/consts/catalog/catalog-error.const.js.map +1 -0
  5. package/dist/consts/catalog/vehicle-type.const.d.ts +8 -0
  6. package/dist/consts/catalog/vehicle-type.const.d.ts.map +1 -0
  7. package/dist/consts/catalog/vehicle-type.const.js +10 -0
  8. package/dist/consts/catalog/vehicle-type.const.js.map +1 -0
  9. package/dist/consts/index.d.ts +3 -0
  10. package/dist/consts/index.d.ts.map +1 -1
  11. package/dist/consts/index.js +7 -1
  12. package/dist/consts/index.js.map +1 -1
  13. package/dist/consts/marketing/campaign-scope-type.const.d.ts +6 -0
  14. package/dist/consts/marketing/campaign-scope-type.const.d.ts.map +1 -0
  15. package/dist/consts/marketing/campaign-scope-type.const.js +8 -0
  16. package/dist/consts/marketing/campaign-scope-type.const.js.map +1 -0
  17. package/dist/consts/marketing/index.d.ts +2 -0
  18. package/dist/consts/marketing/index.d.ts.map +1 -0
  19. package/dist/consts/marketing/index.js +18 -0
  20. package/dist/consts/marketing/index.js.map +1 -0
  21. package/dist/consts/permission-config.d.ts +4 -4
  22. package/dist/consts/permission-config.js +12 -12
  23. package/dist/consts/permission-config.js.map +1 -1
  24. package/dist/enum/index.d.ts +2 -1
  25. package/dist/enum/index.d.ts.map +1 -1
  26. package/dist/enum/index.js +3 -2
  27. package/dist/enum/index.js.map +1 -1
  28. package/dist/enum/marketing/index.d.ts +2 -0
  29. package/dist/enum/marketing/index.d.ts.map +1 -0
  30. package/dist/enum/marketing/index.js +6 -0
  31. package/dist/enum/marketing/index.js.map +1 -0
  32. package/dist/models/api/brand/brand.api.model.d.ts +45 -0
  33. package/dist/models/api/brand/brand.api.model.d.ts.map +1 -0
  34. package/dist/models/api/{pricing/promotion.api.model.js → brand/brand.api.model.js} +1 -1
  35. package/dist/models/api/brand/brand.api.model.js.map +1 -0
  36. package/dist/models/api/catalog/index.d.ts +3 -0
  37. package/dist/models/api/catalog/index.d.ts.map +1 -0
  38. package/dist/models/api/catalog/index.js +3 -0
  39. package/dist/models/api/catalog/index.js.map +1 -0
  40. package/dist/models/api/catalog/vehicle-brand.api.model.d.ts +43 -0
  41. package/dist/models/api/catalog/vehicle-brand.api.model.d.ts.map +1 -0
  42. package/dist/models/api/catalog/vehicle-brand.api.model.js +3 -0
  43. package/dist/models/api/catalog/vehicle-brand.api.model.js.map +1 -0
  44. package/dist/models/api/catalog/vehicle.api.model.d.ts +70 -0
  45. package/dist/models/api/catalog/vehicle.api.model.d.ts.map +1 -0
  46. package/dist/models/api/catalog/vehicle.api.model.js +3 -0
  47. package/dist/models/api/catalog/vehicle.api.model.js.map +1 -0
  48. package/dist/models/api/index.d.ts +2 -1
  49. package/dist/models/api/index.d.ts.map +1 -1
  50. package/dist/models/api/index.js +1 -0
  51. package/dist/models/api/index.js.map +1 -1
  52. package/dist/models/api/marketing/campaign.api.model.d.ts +88 -0
  53. package/dist/models/api/marketing/campaign.api.model.d.ts.map +1 -0
  54. package/dist/models/api/marketing/campaign.api.model.js +3 -0
  55. package/dist/models/api/marketing/campaign.api.model.js.map +1 -0
  56. package/package.json +1 -1
  57. package/src/consts/catalog/catalog-error.const.ts +7 -0
  58. package/src/consts/catalog/vehicle-type.const.ts +9 -0
  59. package/src/consts/index.ts +4 -1
  60. package/src/consts/marketing/campaign-scope-type.const.ts +7 -0
  61. package/src/consts/marketing/index.ts +1 -0
  62. package/src/consts/permission-config.ts +12 -12
  63. package/src/enum/index.ts +1 -1
  64. package/src/enum/marketing/index.ts +1 -0
  65. package/src/models/api/brand/brand.api.model.ts +53 -0
  66. package/src/models/api/catalog/index.ts +22 -0
  67. package/src/models/api/catalog/vehicle-brand.api.model.ts +52 -0
  68. package/src/models/api/catalog/vehicle.api.model.ts +83 -0
  69. package/src/models/api/index.ts +14 -8
  70. package/src/models/api/marketing/campaign.api.model.ts +106 -0
  71. package/sync-types-to-repos.sh +268 -42
  72. package/dist/models/api/pricing/promotion.api.model.d.ts +0 -75
  73. package/src/models/api/pricing/promotion.api.model.ts +0 -88
@@ -1,30 +1,25 @@
1
1
  #!/usr/bin/env bash
2
2
  #
3
- # Build local spotcharge-types and reinstall it into sibling project node_modules.
4
- # Tries a normal npm install first; retries with --legacy-peer-deps on failure.
3
+ # Build local spotcharge-types and copy it into sibling project node_modules.
4
+ # Never runs `npm install file:...` — that writes file:../spotcharge-types into
5
+ # package.json and lockfiles, and some npm versions ignore --no-save.
6
+ #
7
+ # Bumps the local patch version first so unpublished work is not stuck on an
8
+ # already-published number (npm install / IDEs treat that as "already have it").
9
+ # Skip the bump with SYNC_NO_BUMP=1.
10
+ #
11
+ # Discovers sibling packages that depend on spotcharge-types (skips git/gitlab
12
+ # specs). Pins each package.json to ^<version> and copies dist + src.
5
13
  #
6
14
  # Usage (from spotcharge-types):
7
15
  # ./sync-types-to-repos.sh
8
16
  # npm run sync-repos
9
17
 
10
- set -u
18
+ set -euo pipefail
11
19
 
12
20
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13
21
  TYPES_DIR="$SCRIPT_DIR"
14
22
  PROJECTS_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
15
- TYPES_VERSION="$(node -p "require('$TYPES_DIR/package.json').version")"
16
- TYPES_SPEC="file:${TYPES_DIR}"
17
-
18
- TARGETS=(
19
- "spotcharge-node-ocpp"
20
- "spotcharge.co.in_mobile-app"
21
- "spotcharge-superadmin"
22
- "spotcharge-superadmin/functions"
23
- "spotcharge-fleet-mobile-app"
24
- "spotcharge-client-portal"
25
- "spotcharge-script"
26
- "spotcharge-script/scripts"
27
- )
28
23
 
29
24
  RED='\033[0;31m'
30
25
  GREEN='\033[0;32m'
@@ -40,9 +35,232 @@ fail() {
40
35
  exit 1
41
36
  }
42
37
 
38
+ read_types_version() {
39
+ node -p "require('$TYPES_DIR/package.json').version"
40
+ }
41
+
42
+ bump_local_patch() {
43
+ if [[ "${SYNC_NO_BUMP:-}" == "1" ]]; then
44
+ log "SYNC_NO_BUMP=1 — keeping spotcharge-types@$(read_types_version)"
45
+ return 0
46
+ fi
47
+
48
+ local before after
49
+ before="$(read_types_version)"
50
+ log "Bumping patch ${before} → next (unpublished local sync)..."
51
+ cd "$TYPES_DIR" || fail "cannot cd to $TYPES_DIR"
52
+ npm version patch --no-git-tag-version >/dev/null
53
+ after="$(read_types_version)"
54
+ log " ${GREEN}${before} → ${after}${NC}"
55
+ }
56
+
57
+ # Sibling packages with a semver/file: spotcharge-types dep. Skips git hosts.
58
+ discover_targets() {
59
+ node - "$PROJECTS_ROOT" "$TYPES_DIR" <<'EOF'
60
+ const fs = require('fs');
61
+ const path = require('path');
62
+
63
+ const root = process.argv[2];
64
+ const typesDir = process.argv[3];
65
+ const skipNames = new Set(['node_modules', 'dist', '.git', 'coverage']);
66
+ const gitSpec = /^(gitlab:|github:|git\+|https?:|ssh:)/;
67
+ const out = [];
68
+
69
+ function specOf(pkg) {
70
+ return (
71
+ (pkg.dependencies && pkg.dependencies['spotcharge-types']) ||
72
+ (pkg.devDependencies && pkg.devDependencies['spotcharge-types']) ||
73
+ null
74
+ );
75
+ }
76
+
77
+ function walk(dir, depth) {
78
+ if (depth > 3) {
79
+ return;
80
+ }
81
+ let entries;
82
+ try {
83
+ entries = fs.readdirSync(dir, { withFileTypes: true });
84
+ } catch {
85
+ return;
86
+ }
87
+
88
+ const pkgPath = path.join(dir, 'package.json');
89
+ if (fs.existsSync(pkgPath) && path.resolve(dir) !== path.resolve(typesDir)) {
90
+ try {
91
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
92
+ const spec = specOf(pkg);
93
+ if (spec && !gitSpec.test(spec)) {
94
+ out.push(path.relative(root, dir));
95
+ }
96
+ } catch {
97
+ // ignore unreadable package.json
98
+ }
99
+ }
100
+
101
+ for (const entry of entries) {
102
+ if (!entry.isDirectory() || skipNames.has(entry.name) || entry.name.startsWith('.')) {
103
+ continue;
104
+ }
105
+ walk(path.join(dir, entry.name), depth + 1);
106
+ }
107
+ }
108
+
109
+ walk(root, 0);
110
+ out.sort();
111
+ process.stdout.write(out.join('\n') + (out.length ? '\n' : ''));
112
+ EOF
113
+ }
114
+
115
+ # Surgical string replace — do not JSON.parse/stringify lockfiles (preserves formatting).
116
+ pin_types_spec() {
117
+ local project_dir="$1"
118
+ local published_spec="$2"
119
+ local types_version="$3"
120
+ node - "$project_dir" "$published_spec" "$types_version" <<'EOF'
121
+ const fs = require('fs');
122
+ const path = require('path');
123
+
124
+ const projectDir = process.argv[2];
125
+ const publishedSpec = process.argv[3];
126
+ const typesVersion = process.argv[4];
127
+ const files = ['package.json', 'package-lock.json', 'npm-shrinkwrap.json'];
128
+
129
+ const pinSpecs = (raw) =>
130
+ raw
131
+ .replace(/("spotcharge-types"\s*:\s*)"(file:[^"]+|\^?\d+\.\d+\.\d+)"/g, `$1"${publishedSpec}"`)
132
+ .replace(/\n "\.\.(?:\/\.\.)*\/spotcharge-types": \{[\s\S]*?\n \},/g, '')
133
+ .replace(
134
+ / "node_modules\/spotcharge-types": \{\s*"resolved": "(?:\.\.\/)+spotcharge-types",\s*"link": true\s*\}/g,
135
+ [
136
+ ' "node_modules/spotcharge-types": {',
137
+ ` "version": "${typesVersion}",`,
138
+ ' "license": "ISC"',
139
+ ' }',
140
+ ].join('\n')
141
+ );
142
+
143
+ const changed = [];
144
+ for (const name of files) {
145
+ const filePath = path.join(projectDir, name);
146
+ if (!fs.existsSync(filePath)) {
147
+ continue;
148
+ }
149
+ const raw = fs.readFileSync(filePath, 'utf8');
150
+ const next = pinSpecs(raw);
151
+ if (next !== raw) {
152
+ fs.writeFileSync(filePath, next);
153
+ changed.push(name);
154
+ }
155
+ }
156
+
157
+ if (changed.length) {
158
+ process.stdout.write(`pinned spotcharge-types@${publishedSpec} in ${changed.join(', ')}\n`);
159
+ }
160
+ EOF
161
+ }
162
+
163
+ has_file_spec() {
164
+ local file_path="$1"
165
+ [[ -f "$file_path" ]] && grep -qE '"spotcharge-types"[[:space:]]*:[[:space:]]*"file:' "$file_path"
166
+ }
167
+
168
+ copy_types_into_node_modules() {
169
+ local project_dir="$1"
170
+ local dest="$project_dir/node_modules/spotcharge-types"
171
+ local tmp="${dest}.syncing.$$"
172
+
173
+ mkdir -p "$project_dir/node_modules"
174
+ rm -rf "$tmp"
175
+ mkdir -p "$tmp/dist"
176
+ cp "$TYPES_DIR/package.json" "$tmp/package.json"
177
+ cp -R "$TYPES_DIR/dist/." "$tmp/dist/"
178
+ if [[ -d "$TYPES_DIR/src" ]]; then
179
+ mkdir -p "$tmp/src"
180
+ cp -R "$TYPES_DIR/src/." "$tmp/src/"
181
+ fi
182
+
183
+ mkdir -p "$dest"
184
+ # Replace package files in place. Ignore leftover .cursor/.idea — those get
185
+ # copied into node_modules when dest was once a full-repo copy, and the
186
+ # sandbox/IDE often locks them so `rm -rf dest` cannot finish.
187
+ if command -v rsync >/dev/null 2>&1; then
188
+ rsync -a --delete --exclude '.cursor/' --exclude '.idea/' "$tmp/" "$dest/"
189
+ else
190
+ rm -rf "$dest/dist" "$dest/src" "$dest/package.json"
191
+ cp "$tmp/package.json" "$dest/package.json"
192
+ cp -R "$tmp/dist" "$dest/dist"
193
+ if [[ -d "$tmp/src" ]]; then
194
+ cp -R "$tmp/src" "$dest/src"
195
+ fi
196
+ fi
197
+ rm -rf "$tmp"
198
+ rm -rf "$dest/.cursor" "$dest/.idea" 2>/dev/null || true
199
+ }
200
+
201
+ verify_copy() {
202
+ local project_dir="$1"
203
+ local label="$2"
204
+ local types_version="$3"
205
+ local published_spec="$4"
206
+ node - "$project_dir" "$label" "$types_version" "$published_spec" "$TYPES_DIR" <<'EOF'
207
+ const fs = require('fs');
208
+ const path = require('path');
209
+
210
+ const projectDir = process.argv[2];
211
+ const label = process.argv[3];
212
+ const typesVersion = process.argv[4];
213
+ const publishedSpec = process.argv[5];
214
+ const typesDir = process.argv[6];
215
+ const dest = path.join(projectDir, 'node_modules', 'spotcharge-types');
216
+ const issues = [];
217
+
218
+ const pkg = JSON.parse(fs.readFileSync(path.join(projectDir, 'package.json'), 'utf8'));
219
+ const spec =
220
+ (pkg.dependencies && pkg.dependencies['spotcharge-types']) ||
221
+ (pkg.devDependencies && pkg.devDependencies['spotcharge-types']);
222
+ if (spec !== publishedSpec) {
223
+ issues.push(`package.json spec is ${spec}, expected ${publishedSpec}`);
224
+ }
225
+
226
+ if (!fs.existsSync(path.join(dest, 'package.json'))) {
227
+ issues.push('node_modules/spotcharge-types missing');
228
+ } else {
229
+ const copied = JSON.parse(fs.readFileSync(path.join(dest, 'package.json'), 'utf8'));
230
+ if (copied.version !== typesVersion) {
231
+ issues.push(`copied version ${copied.version} != ${typesVersion}`);
232
+ }
233
+ }
234
+
235
+ for (const rel of ['dist/index.js', 'dist/index.d.ts']) {
236
+ if (!fs.existsSync(path.join(dest, rel))) {
237
+ issues.push(`missing ${rel}`);
238
+ }
239
+ }
240
+
241
+ if (fs.existsSync(path.join(typesDir, 'src')) && !fs.existsSync(path.join(dest, 'src'))) {
242
+ issues.push('missing src (needed for declaration maps)');
243
+ }
244
+
245
+ const catalogSrc = path.join(typesDir, 'dist', 'models', 'api', 'catalog', 'index.d.ts');
246
+ const catalogDest = path.join(dest, 'dist', 'models', 'api', 'catalog', 'index.d.ts');
247
+ if (fs.existsSync(catalogSrc) && !fs.existsSync(catalogDest)) {
248
+ issues.push('missing catalog d.ts');
249
+ }
250
+
251
+ if (issues.length) {
252
+ process.stderr.write(`${label}: ${issues.join('; ')}\n`);
253
+ process.exit(1);
254
+ }
255
+ EOF
256
+ }
257
+
43
258
  install_types_in() {
44
259
  local project_dir="$1"
45
260
  local label="$2"
261
+ local types_version="$3"
262
+ local published_spec="$4"
263
+ local pin_out
46
264
 
47
265
  if [[ ! -d "$project_dir" ]]; then
48
266
  log "${YELLOW}SKIP${NC} $label — directory not found: $project_dir"
@@ -55,47 +273,54 @@ install_types_in() {
55
273
  fi
56
274
 
57
275
  log "\n${GREEN}==>${NC} $label"
58
- cd "$project_dir" || fail "cannot cd to $project_dir"
59
276
 
60
- if [[ -d node_modules/spotcharge-types ]]; then
61
- log " removing node_modules/spotcharge-types"
62
- rm -rf node_modules/spotcharge-types
63
- fi
64
-
65
- log " installing spotcharge-types@${TYPES_VERSION} (${TYPES_SPEC})"
66
-
67
- if npm install "$TYPES_SPEC"; then
68
- log " ${GREEN}ok${NC} (standard install)"
69
- return 0
277
+ pin_out="$(pin_types_spec "$project_dir" "$published_spec" "$types_version")"
278
+ if [[ -n "$pin_out" ]]; then
279
+ log " ${YELLOW}${pin_out}${NC}"
70
280
  fi
71
281
 
72
- log " ${YELLOW}retrying with --legacy-peer-deps${NC}"
73
- if npm install --legacy-peer-deps "$TYPES_SPEC"; then
74
- log " ${GREEN}ok${NC} (legacy peer deps)"
75
- return 0
282
+ if has_file_spec "$project_dir/package.json"; then
283
+ log " ${RED}file: spec still present in package.json${NC}"
284
+ return 1
76
285
  fi
77
286
 
78
- log " ${RED}failed${NC} in $project_dir"
79
- return 1
287
+ log " copying spotcharge-types@${types_version} into node_modules"
288
+ copy_types_into_node_modules "$project_dir"
289
+ verify_copy "$project_dir" "$label" "$types_version" "$published_spec"
290
+ log " ${GREEN}ok${NC}"
80
291
  }
81
292
 
82
293
  main() {
83
- log "Building spotcharge-types@${TYPES_VERSION}..."
84
294
  cd "$TYPES_DIR" || fail "cannot cd to $TYPES_DIR"
295
+ bump_local_patch
296
+
297
+ local types_version published_spec
298
+ types_version="$(read_types_version)"
299
+ published_spec="^${types_version}"
300
+
301
+ log "Building spotcharge-types@${types_version}..."
85
302
  npm start || fail "types build failed (npm start)"
86
303
 
87
304
  if [[ ! -f "$TYPES_DIR/dist/index.js" ]]; then
88
305
  fail "build output missing: dist/index.js — run npm start in spotcharge-types first"
89
306
  fi
90
307
 
91
- local failed=0
92
- local target rel_path project_dir label
308
+ local targets=()
309
+ local line
310
+ while IFS= read -r line; do
311
+ [[ -n "$line" ]] && targets+=("$line")
312
+ done < <(discover_targets)
93
313
 
94
- for target in "${TARGETS[@]}"; do
95
- rel_path="$target"
96
- project_dir="$PROJECTS_ROOT/$rel_path"
97
- label="$rel_path"
98
- install_types_in "$project_dir" "$label" || failed=$((failed + 1))
314
+ if [[ "${#targets[@]}" -eq 0 ]]; then
315
+ fail "no sibling packages depend on spotcharge-types"
316
+ fi
317
+
318
+ log "Targets: ${targets[*]}"
319
+
320
+ local failed=0
321
+ local target
322
+ for target in "${targets[@]}"; do
323
+ install_types_in "$PROJECTS_ROOT/$target" "$target" "$types_version" "$published_spec" || failed=$((failed + 1))
99
324
  done
100
325
 
101
326
  log ""
@@ -103,7 +328,8 @@ main() {
103
328
  fail "$failed project(s) failed to install spotcharge-types"
104
329
  fi
105
330
 
106
- log "${GREEN}Done.${NC} spotcharge-types@${TYPES_VERSION} synced to all targets."
331
+ log "${GREEN}Done.${NC} spotcharge-types@${types_version} synced."
332
+ log "package.json uses ${published_spec}. Do not npm install in consumers until this version is published, or re-run sync-repos after."
107
333
  }
108
334
 
109
335
  main "$@"
@@ -1,75 +0,0 @@
1
- import { ConnectorOutputType, PromotionAdjustmentType, PromotionAppliesTo, PromotionScopeType } from '../../../enum/pricing';
2
- import { AuditActor } from '../../audit-actor.model';
3
- import { AuditTimestampsApiModel, IsoDateTime } from '../users/shared.api.model';
4
- import { ApiSortDirection } from '../users/admin-user.api.model';
5
- export interface PromotionAdjustmentApiModel {
6
- type: PromotionAdjustmentType;
7
- value: number;
8
- }
9
- /** GET /api/promotions */
10
- export type PromotionListOrderBy = 'validFrom' | 'createdAt' | 'name';
11
- export interface PromotionListItemApiModel {
12
- id: string;
13
- name: string;
14
- label: string | null;
15
- scopeType: PromotionScopeType;
16
- stationId: string | null;
17
- stationName: string | null;
18
- chargerId: string | null;
19
- connectorId: string | null;
20
- outputType: ConnectorOutputType | null;
21
- appliesTo: PromotionAppliesTo;
22
- energyAdjustment: PromotionAdjustmentApiModel | null;
23
- sessionAdjustment: PromotionAdjustmentApiModel | null;
24
- validFrom: IsoDateTime;
25
- validTo: IsoDateTime | null;
26
- priority: number;
27
- isActive: boolean;
28
- createdAt: IsoDateTime;
29
- }
30
- export interface PromotionListApiModel {
31
- rows: PromotionListItemApiModel[];
32
- totalCount: number;
33
- pageIndex: number;
34
- pageSize: number;
35
- orderBy: PromotionListOrderBy;
36
- sortDirection: ApiSortDirection;
37
- }
38
- export interface PromotionDetailApiModel extends PromotionListItemApiModel, AuditTimestampsApiModel {
39
- isDeleted: boolean;
40
- createdBy: AuditActor | null;
41
- updatedBy: AuditActor | null;
42
- deletedBy: AuditActor | null;
43
- }
44
- export interface CreatePromotionRequest {
45
- name: string;
46
- label?: string | null;
47
- scopeType: PromotionScopeType;
48
- stationId?: string | null;
49
- chargerId?: string | null;
50
- connectorId?: string | null;
51
- outputType?: ConnectorOutputType | null;
52
- appliesTo: PromotionAppliesTo;
53
- energyAdjustment?: PromotionAdjustmentApiModel | null;
54
- sessionAdjustment?: PromotionAdjustmentApiModel | null;
55
- validFrom?: IsoDateTime;
56
- validTo?: IsoDateTime | null;
57
- priority?: number;
58
- isActive?: boolean;
59
- }
60
- export interface UpdatePromotionRequest {
61
- name?: string;
62
- label?: string | null;
63
- stationId?: string | null;
64
- chargerId?: string | null;
65
- connectorId?: string | null;
66
- outputType?: ConnectorOutputType | null;
67
- appliesTo?: PromotionAppliesTo;
68
- energyAdjustment?: PromotionAdjustmentApiModel | null;
69
- sessionAdjustment?: PromotionAdjustmentApiModel | null;
70
- validFrom?: IsoDateTime;
71
- validTo?: IsoDateTime | null;
72
- priority?: number;
73
- isActive?: boolean;
74
- }
75
- //# sourceMappingURL=promotion.api.model.d.ts.map
@@ -1,88 +0,0 @@
1
- import {
2
- ConnectorOutputType,
3
- PromotionAdjustmentType,
4
- PromotionAppliesTo,
5
- PromotionScopeType,
6
- } from '../../../enum/pricing';
7
- import { AuditActor } from '../../audit-actor.model';
8
- import { AuditTimestampsApiModel, IsoDateTime } from '../users/shared.api.model';
9
- import { ApiSortDirection } from '../users/admin-user.api.model';
10
-
11
- export interface PromotionAdjustmentApiModel {
12
- type: PromotionAdjustmentType;
13
- value: number;
14
- }
15
-
16
- /** GET /api/promotions */
17
- export type PromotionListOrderBy = 'validFrom' | 'createdAt' | 'name';
18
-
19
- export interface PromotionListItemApiModel {
20
- id: string;
21
- name: string;
22
- label: string | null;
23
- scopeType: PromotionScopeType;
24
- stationId: string | null;
25
- stationName: string | null;
26
- chargerId: string | null;
27
- connectorId: string | null;
28
- outputType: ConnectorOutputType | null;
29
- appliesTo: PromotionAppliesTo;
30
- energyAdjustment: PromotionAdjustmentApiModel | null;
31
- sessionAdjustment: PromotionAdjustmentApiModel | null;
32
- validFrom: IsoDateTime;
33
- validTo: IsoDateTime | null;
34
- priority: number;
35
- isActive: boolean;
36
- createdAt: IsoDateTime;
37
- }
38
-
39
- export interface PromotionListApiModel {
40
- rows: PromotionListItemApiModel[];
41
- totalCount: number;
42
- pageIndex: number;
43
- pageSize: number;
44
- orderBy: PromotionListOrderBy;
45
- sortDirection: ApiSortDirection;
46
- }
47
-
48
- export interface PromotionDetailApiModel
49
- extends PromotionListItemApiModel,
50
- AuditTimestampsApiModel {
51
- isDeleted: boolean;
52
- createdBy: AuditActor | null;
53
- updatedBy: AuditActor | null;
54
- deletedBy: AuditActor | null;
55
- }
56
-
57
- export interface CreatePromotionRequest {
58
- name: string;
59
- label?: string | null;
60
- scopeType: PromotionScopeType;
61
- stationId?: string | null;
62
- chargerId?: string | null;
63
- connectorId?: string | null;
64
- outputType?: ConnectorOutputType | null;
65
- appliesTo: PromotionAppliesTo;
66
- energyAdjustment?: PromotionAdjustmentApiModel | null;
67
- sessionAdjustment?: PromotionAdjustmentApiModel | null;
68
- validFrom?: IsoDateTime;
69
- validTo?: IsoDateTime | null;
70
- priority?: number;
71
- isActive?: boolean;
72
- }
73
-
74
- export interface UpdatePromotionRequest {
75
- name?: string;
76
- label?: string | null;
77
- stationId?: string | null;
78
- chargerId?: string | null;
79
- connectorId?: string | null;
80
- outputType?: ConnectorOutputType | null;
81
- appliesTo?: PromotionAppliesTo;
82
- energyAdjustment?: PromotionAdjustmentApiModel | null;
83
- sessionAdjustment?: PromotionAdjustmentApiModel | null;
84
- validFrom?: IsoDateTime;
85
- validTo?: IsoDateTime | null;
86
- priority?: number;
87
- isActive?: boolean;
88
- }