@sales-planner/shared 0.7.0 → 0.8.1

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 CHANGED
@@ -81,6 +81,13 @@ import type {
81
81
  } from '@sales-planner/shared';
82
82
  ```
83
83
 
84
+ ## Marketplace IDs vs Codes
85
+
86
+ The API uses **numeric IDs** internally for referential integrity:
87
+ - `CreateSalesHistoryRequest.marketplace_id: number` - API uses numeric foreign keys
88
+ - Import/Export use **marketplace codes** (strings) for user convenience
89
+ - This pattern matches SKUs: IDs internally, codes for import/export
90
+
84
91
  ## Types Reference
85
92
 
86
93
  ### Entities
@@ -92,11 +99,11 @@ import type {
92
99
  | `Shop` | Store within a tenant |
93
100
  | `Sku` | Stock keeping unit (product variant) |
94
101
  | `Brand` | Product brand (shop-scoped) |
95
- | `SalesHistory` | Sales record for a period |
102
+ | `SalesHistory` | Sales record for a period (uses numeric marketplace_id) |
96
103
  | `Role` | Access role |
97
104
  | `UserRole` | User-role assignment |
98
105
  | `ApiKey` | API authentication key |
99
- | `Marketplace` | E-commerce platform |
106
+ | `Marketplace` | E-commerce platform (numeric ID, shop-scoped) |
100
107
 
101
108
  ### Query Types
102
109
 
@@ -2,7 +2,7 @@ export interface CreateSalesHistoryRequest {
2
2
  sku_id: number;
3
3
  period: string;
4
4
  quantity: number;
5
- marketplace_id: string;
5
+ marketplace_id: number;
6
6
  }
7
7
  export interface CreateSalesHistoryDto {
8
8
  sku_id: number;
@@ -10,7 +10,7 @@ export interface CreateSalesHistoryDto {
10
10
  tenant_id: number;
11
11
  period: string;
12
12
  quantity: number;
13
- marketplace_id: string;
13
+ marketplace_id: number;
14
14
  }
15
15
  export interface UpdateSalesHistoryDto {
16
16
  quantity?: number;
package/dist/dto.d.ts CHANGED
@@ -8,133 +8,133 @@
8
8
  * - UpdateXRequest: HTTP update request (typically same as DTO)
9
9
  */
10
10
  export interface CreateUserDto {
11
- email: string;
12
- name: string;
13
- default_shop_id?: number;
11
+ email: string;
12
+ name: string;
13
+ default_shop_id?: number;
14
14
  }
15
15
  export type CreateUserRequest = CreateUserDto;
16
16
  export interface UpdateUserDto {
17
- email?: string;
18
- name?: string;
19
- default_shop_id?: number | null;
17
+ email?: string;
18
+ name?: string;
19
+ default_shop_id?: number | null;
20
20
  }
21
21
  export type UpdateUserRequest = UpdateUserDto;
22
22
  export interface CreateTenantDto {
23
- title: string;
24
- owner_id?: number;
25
- created_by?: number;
23
+ title: string;
24
+ owner_id?: number;
25
+ created_by?: number;
26
26
  }
27
27
  export interface CreateTenantRequest {
28
- title: string;
29
- owner_id?: number;
28
+ title: string;
29
+ owner_id?: number;
30
30
  }
31
31
  export interface UpdateTenantDto {
32
- title?: string;
33
- owner_id?: number | null;
32
+ title?: string;
33
+ owner_id?: number | null;
34
34
  }
35
35
  export type UpdateTenantRequest = UpdateTenantDto;
36
36
  export interface CreateTenantWithShopDto {
37
- tenantTitle: string;
38
- shopTitle?: string;
39
- userEmail: string;
40
- userName: string;
37
+ tenantTitle: string;
38
+ shopTitle?: string;
39
+ userEmail: string;
40
+ userName: string;
41
41
  }
42
42
  export interface CreateShopDto {
43
- title: string;
44
- tenant_id: number;
43
+ title: string;
44
+ tenant_id: number;
45
45
  }
46
46
  export type CreateShopRequest = CreateShopDto;
47
47
  export interface UpdateShopDto {
48
- title?: string;
48
+ title?: string;
49
49
  }
50
50
  export type UpdateShopRequest = UpdateShopDto;
51
51
  export interface CreateSkuRequest {
52
- code: string;
53
- title: string;
52
+ code: string;
53
+ title: string;
54
54
  }
55
55
  export interface CreateSkuDto {
56
- code: string;
57
- title: string;
58
- shop_id: number;
59
- tenant_id: number;
56
+ code: string;
57
+ title: string;
58
+ shop_id: number;
59
+ tenant_id: number;
60
60
  }
61
61
  export interface UpdateSkuDto {
62
- code?: string;
63
- title?: string;
62
+ code?: string;
63
+ title?: string;
64
64
  }
65
65
  export type UpdateSkuRequest = UpdateSkuDto;
66
66
  export interface CreateSalesHistoryRequest {
67
- sku_id: number;
68
- period: string;
69
- quantity: number;
70
- marketplace_id: string;
67
+ sku_id: number;
68
+ period: string;
69
+ quantity: number;
70
+ marketplace_id: number;
71
71
  }
72
72
  export interface CreateSalesHistoryDto {
73
- sku_id: number;
74
- shop_id: number;
75
- tenant_id: number;
76
- period: string;
77
- quantity: number;
78
- marketplace_id: string;
73
+ sku_id: number;
74
+ shop_id: number;
75
+ tenant_id: number;
76
+ period: string;
77
+ quantity: number;
78
+ marketplace_id: number;
79
79
  }
80
80
  export interface UpdateSalesHistoryDto {
81
- quantity?: number;
81
+ quantity?: number;
82
82
  }
83
83
  export type UpdateSalesHistoryRequest = UpdateSalesHistoryDto;
84
84
  export interface CreateMarketplaceRequest {
85
- id: string;
86
- title: string;
85
+ id: string;
86
+ title: string;
87
87
  }
88
88
  export interface CreateMarketplaceDto {
89
- id: string;
90
- title: string;
91
- shop_id: number;
92
- tenant_id: number;
89
+ id: string;
90
+ title: string;
91
+ shop_id: number;
92
+ tenant_id: number;
93
93
  }
94
94
  export interface UpdateMarketplaceDto {
95
- title?: string;
95
+ title?: string;
96
96
  }
97
97
  export type UpdateMarketplaceRequest = UpdateMarketplaceDto;
98
98
  export interface CreateApiKeyDto {
99
- user_id: number;
100
- name?: string;
101
- expires_at?: string;
99
+ user_id: number;
100
+ name?: string;
101
+ expires_at?: string;
102
102
  }
103
103
  export type CreateApiKeyRequest = CreateApiKeyDto;
104
104
  export interface UpdateApiKeyDto {
105
- name?: string | null;
106
- expires_at?: string | null;
105
+ name?: string | null;
106
+ expires_at?: string | null;
107
107
  }
108
108
  export type UpdateApiKeyRequest = UpdateApiKeyDto;
109
109
  export interface CreateRoleDto {
110
- name: string;
111
- description?: string;
110
+ name: string;
111
+ description?: string;
112
112
  }
113
113
  export type CreateRoleRequest = CreateRoleDto;
114
114
  export interface UpdateRoleDto {
115
- name?: string;
116
- description?: string | null;
115
+ name?: string;
116
+ description?: string | null;
117
117
  }
118
118
  export type UpdateRoleRequest = UpdateRoleDto;
119
119
  export interface CreateUserRoleDto {
120
- user_id: number;
121
- role_id: number;
122
- tenant_id?: number;
123
- shop_id?: number;
120
+ user_id: number;
121
+ role_id: number;
122
+ tenant_id?: number;
123
+ shop_id?: number;
124
124
  }
125
125
  export type CreateUserRoleRequest = CreateUserRoleDto;
126
126
  export interface ImportSkuItem {
127
- code: string;
128
- title: string;
127
+ code: string;
128
+ title: string;
129
129
  }
130
130
  export interface ImportSalesHistoryItem {
131
- sku_code: string;
132
- period: string;
133
- quantity: number;
134
- marketplace: string;
131
+ sku_code: string;
132
+ period: string;
133
+ quantity: number;
134
+ marketplace: string;
135
135
  }
136
136
  export interface ImportMarketplaceItem {
137
- id: string;
138
- title: string;
137
+ id: string;
138
+ title: string;
139
139
  }
140
- //# sourceMappingURL=dto.d.ts.map
140
+ //# sourceMappingURL=dto.d.ts.map
@@ -48,7 +48,7 @@ export interface SalesHistory {
48
48
  tenant_id: number;
49
49
  period: string;
50
50
  quantity: number;
51
- marketplace_id: string | null;
51
+ marketplace_id: number;
52
52
  created_at: Date;
53
53
  updated_at: Date;
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI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version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "Shared types and DTOs for Sales Planner API",
5
5
  "author": "Damir Manapov",
6
6
  "license": "MIT",