@lemoncloud/ssocio-kiosk-api 0.25.423
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 +4 -0
- package/dist/cores/types.d.ts +116 -0
- package/dist/lib/types.d.ts +36 -0
- package/dist/modules/cart/model.d.ts +125 -0
- package/dist/modules/cart/types.d.ts +35 -0
- package/dist/modules/cart/views.d.ts +53 -0
- package/dist/modules/category/categories-types.d.ts +33 -0
- package/dist/modules/category/model.d.ts +85 -0
- package/dist/modules/category/types.d.ts +47 -0
- package/dist/modules/category/views.d.ts +32 -0
- package/dist/modules/goods/model.d.ts +635 -0
- package/dist/modules/goods/types.d.ts +331 -0
- package/dist/modules/goods/views.d.ts +210 -0
- package/dist/modules/mock/model.d.ts +97 -0
- package/dist/modules/mock/types.d.ts +39 -0
- package/dist/modules/mock/views.d.ts +50 -0
- package/dist/modules/option/model.d.ts +185 -0
- package/dist/modules/option/options-types.d.ts +364 -0
- package/dist/modules/option/types.d.ts +112 -0
- package/dist/modules/shipping/model.d.ts +54 -0
- package/dist/modules/shipping/types.d.ts +26 -0
- package/dist/modules/shipping/views.d.ts +28 -0
- package/dist/modules/stock/model.d.ts +85 -0
- package/dist/modules/stock/stocks-types.d.ts +90 -0
- package/dist/modules/stock/types.d.ts +45 -0
- package/dist/modules/stock/views.d.ts +40 -0
- package/dist/service/backend-types.d.ts +65 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/view/types.d.ts +16 -0
- package/package.json +24 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mock/views.ts`
|
|
3
|
+
* - type of views used in `backend-proxy`
|
|
4
|
+
*
|
|
5
|
+
* @author Steve <steve@lemoncloud.io>
|
|
6
|
+
* @date 2022-08-29 initial version.
|
|
7
|
+
* @author Aiden <aiden@lemoncloud.io>
|
|
8
|
+
* @date 2025-04-16 refactoring for mock service.
|
|
9
|
+
* @Copyright (C) 2025 LemonCloud Co Ltd. - All Rights Reserved.
|
|
10
|
+
*/
|
|
11
|
+
import { View, Body } from 'lemon-model';
|
|
12
|
+
import $LUT from './types';
|
|
13
|
+
import { MockModel, TestModel } from './model';
|
|
14
|
+
export * from './types';
|
|
15
|
+
export default $LUT;
|
|
16
|
+
/**!SECTION */
|
|
17
|
+
/**
|
|
18
|
+
* type: `MockView`
|
|
19
|
+
* - usually same as post's body.
|
|
20
|
+
*/
|
|
21
|
+
export interface MockView extends View, Omit<Partial<MockModel>, 'required'> {
|
|
22
|
+
/**
|
|
23
|
+
* (optional) flag required.
|
|
24
|
+
*/
|
|
25
|
+
required?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Type `MockBody`
|
|
29
|
+
*/
|
|
30
|
+
export interface MockBody extends Body, Partial<MockView> {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* type: `TestView`
|
|
34
|
+
* - usually same as post's body.
|
|
35
|
+
*/
|
|
36
|
+
export interface TestView extends View, Omit<Partial<TestModel>, 'id' | 'required'> {
|
|
37
|
+
/**
|
|
38
|
+
* unique id of this type
|
|
39
|
+
*/
|
|
40
|
+
id: string;
|
|
41
|
+
/**
|
|
42
|
+
* (optional) flag required.
|
|
43
|
+
*/
|
|
44
|
+
required?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Type `TestBody`
|
|
48
|
+
*/
|
|
49
|
+
export interface TestBody extends Body, Partial<TestView> {
|
|
50
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `option/model.ts`
|
|
3
|
+
* - model definitions per account data
|
|
4
|
+
*
|
|
5
|
+
* @author Steve <steve@lemoncloud.io>
|
|
6
|
+
* @date 2022-08-29 initial version.
|
|
7
|
+
*
|
|
8
|
+
* @author Simon <wookeun@sl-platform.com>
|
|
9
|
+
* @date 2025-04-21 refactoring for product service.
|
|
10
|
+
*
|
|
11
|
+
* Copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
12
|
+
*/
|
|
13
|
+
import { CoreModel } from 'lemon-model';
|
|
14
|
+
import { ModelType } from '../../service/backend-types';
|
|
15
|
+
import { OptionStereo } from './types';
|
|
16
|
+
import { StockModel } from '../stock/model';
|
|
17
|
+
export { ModelType };
|
|
18
|
+
/**
|
|
19
|
+
* type: `Model`: common model
|
|
20
|
+
*/
|
|
21
|
+
export declare type Model = CoreModel<ModelType>;
|
|
22
|
+
/**
|
|
23
|
+
* type: boolean style number.
|
|
24
|
+
*/
|
|
25
|
+
export declare type BoolFlag = 0 | 1;
|
|
26
|
+
/**
|
|
27
|
+
* type: `OptionTypeName`
|
|
28
|
+
*/
|
|
29
|
+
export interface OptionTypeName {
|
|
30
|
+
/** type of option (ex: color) */
|
|
31
|
+
type: string;
|
|
32
|
+
/** (additional) name of option (ex: color) */
|
|
33
|
+
name?: string;
|
|
34
|
+
/** selectable option names (ex: blue,red) */
|
|
35
|
+
names?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* type: `OptionUnitName`
|
|
39
|
+
*/
|
|
40
|
+
export interface OptionUnitName {
|
|
41
|
+
/** id of option-unit */
|
|
42
|
+
id: string;
|
|
43
|
+
/** name of option */
|
|
44
|
+
name: string;
|
|
45
|
+
/** option inline-string */
|
|
46
|
+
option: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Type: `OptionHead`
|
|
50
|
+
*/
|
|
51
|
+
export interface OptionHead {
|
|
52
|
+
/** auto sequence */
|
|
53
|
+
id?: string;
|
|
54
|
+
/** 옵션(관리) 이름 */
|
|
55
|
+
name?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* type: `OptionModel` (옵션)
|
|
59
|
+
* - selectable option model
|
|
60
|
+
* - 주의) 1차원으로 펼쳐놓은듯 데이터를 관리함 (엑셀 호환되도록)
|
|
61
|
+
*/
|
|
62
|
+
export interface OptionModel extends Model, OptionHead {
|
|
63
|
+
/**
|
|
64
|
+
* local id of option
|
|
65
|
+
*/
|
|
66
|
+
id?: string;
|
|
67
|
+
/**
|
|
68
|
+
* stereo types.
|
|
69
|
+
*/
|
|
70
|
+
stereo?: OptionStereo;
|
|
71
|
+
/**
|
|
72
|
+
* parent-id (:= id of option-group)
|
|
73
|
+
*/
|
|
74
|
+
parent?: string;
|
|
75
|
+
/** option-id (which is unique in option-model) */
|
|
76
|
+
oid?: string;
|
|
77
|
+
/** (TODO) item-id linked */
|
|
78
|
+
iid?: string;
|
|
79
|
+
/** (TODO) prod-id linked */
|
|
80
|
+
pid?: string;
|
|
81
|
+
/**
|
|
82
|
+
* hidden(숨김) flag
|
|
83
|
+
*/
|
|
84
|
+
hidden?: BoolFlag;
|
|
85
|
+
/**
|
|
86
|
+
* soldout(품절) flag
|
|
87
|
+
*/
|
|
88
|
+
soldout?: BoolFlag;
|
|
89
|
+
/**
|
|
90
|
+
* invalid flag
|
|
91
|
+
*/
|
|
92
|
+
invalid?: BoolFlag;
|
|
93
|
+
/**
|
|
94
|
+
* required flag
|
|
95
|
+
*/
|
|
96
|
+
required?: BoolFlag;
|
|
97
|
+
/**
|
|
98
|
+
* combined flag (options in combination)
|
|
99
|
+
*/
|
|
100
|
+
combined?: BoolFlag;
|
|
101
|
+
/**
|
|
102
|
+
* type flag (option in classification)
|
|
103
|
+
*/
|
|
104
|
+
useType?: BoolFlag;
|
|
105
|
+
/** name of this model */
|
|
106
|
+
name?: string;
|
|
107
|
+
/** selected option names */
|
|
108
|
+
names?: string[];
|
|
109
|
+
/** single-line option-text */
|
|
110
|
+
option?: string;
|
|
111
|
+
/** selected options */
|
|
112
|
+
options?: string[];
|
|
113
|
+
/** (only for stereo/group) list of option-type */
|
|
114
|
+
types?: OptionTypeName[];
|
|
115
|
+
/** (only for stereo/group) list of option-unit (NOTE has only if `.id` is valid) */
|
|
116
|
+
units?: OptionUnitName[];
|
|
117
|
+
/**
|
|
118
|
+
* price in millis (integer := price * 1000)
|
|
119
|
+
*/
|
|
120
|
+
priceMillis?: number;
|
|
121
|
+
/** 재고 관리 id */
|
|
122
|
+
stockId?: string;
|
|
123
|
+
/**
|
|
124
|
+
* possible stocks (integer)
|
|
125
|
+
*/
|
|
126
|
+
stock?: number;
|
|
127
|
+
/**
|
|
128
|
+
* selected counts.
|
|
129
|
+
*/
|
|
130
|
+
count?: number;
|
|
131
|
+
/**
|
|
132
|
+
* limited maximum selections
|
|
133
|
+
* - default is same as `.stock` (or `999`)
|
|
134
|
+
*/
|
|
135
|
+
max?: number;
|
|
136
|
+
/**
|
|
137
|
+
* (optional) limited maximum selections
|
|
138
|
+
* - default is `1`
|
|
139
|
+
*/
|
|
140
|
+
min?: number;
|
|
141
|
+
/**
|
|
142
|
+
* (optinal) max selectable count of this option.
|
|
143
|
+
* - 옵션선택수: 같은 옵션 그룹을 추가할 수 있는 개수.
|
|
144
|
+
*/
|
|
145
|
+
maxSelect?: number;
|
|
146
|
+
/**
|
|
147
|
+
* (optinal) flag to use `maxLimit`
|
|
148
|
+
*/
|
|
149
|
+
useLimit?: number;
|
|
150
|
+
/**
|
|
151
|
+
* (optinal) max limitation to buy
|
|
152
|
+
* - 구매제한수: 옵션 선택하고, 구매할 수 있는 재고수
|
|
153
|
+
*/
|
|
154
|
+
maxLimit?: number;
|
|
155
|
+
/**
|
|
156
|
+
* (optional) internal last error.
|
|
157
|
+
*/
|
|
158
|
+
error?: string;
|
|
159
|
+
/** 재고 모델 */
|
|
160
|
+
readonly stock$?: StockModel;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* extract field names from models
|
|
164
|
+
* - only fields start with lowercase, or all upper.
|
|
165
|
+
*/
|
|
166
|
+
export declare const filterFields: (fields: string[], base?: string[]) => string[];
|
|
167
|
+
/** field names from head */
|
|
168
|
+
export declare const $HEAD: {
|
|
169
|
+
option: string[];
|
|
170
|
+
};
|
|
171
|
+
export declare const $FIELD: {
|
|
172
|
+
option: string[];
|
|
173
|
+
mock: string[];
|
|
174
|
+
};
|
|
175
|
+
/** must export default as below */
|
|
176
|
+
declare const _default: {
|
|
177
|
+
$HEAD: {
|
|
178
|
+
option: string[];
|
|
179
|
+
};
|
|
180
|
+
$FIELD: {
|
|
181
|
+
option: string[];
|
|
182
|
+
mock: string[];
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
export default _default;
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `lib/options-types.ts`
|
|
3
|
+
* - types for option support
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @author Steve <steve@lemoncloud.io>
|
|
7
|
+
* @date 2022-10-18 initial version
|
|
8
|
+
*
|
|
9
|
+
* @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
10
|
+
*/
|
|
11
|
+
import { WeekDayNumType } from './types';
|
|
12
|
+
import { GenericNode } from '../../lib/types';
|
|
13
|
+
/**
|
|
14
|
+
* defines the possible types
|
|
15
|
+
*/
|
|
16
|
+
export declare const $OptionLUT: {
|
|
17
|
+
/**
|
|
18
|
+
* 옵션 항목의 종류들
|
|
19
|
+
*/
|
|
20
|
+
OptionStereo: {
|
|
21
|
+
/** 기본형 */
|
|
22
|
+
'': string;
|
|
23
|
+
/** 옵션그룹 */
|
|
24
|
+
group: string;
|
|
25
|
+
/** 종류 */
|
|
26
|
+
type: string;
|
|
27
|
+
/** 옵션명 */
|
|
28
|
+
name: string;
|
|
29
|
+
/** 옵션단위 */
|
|
30
|
+
unit: string;
|
|
31
|
+
/** 사용자정의 옵션 */
|
|
32
|
+
input: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* 사용자 정의 항목 형식
|
|
36
|
+
*/
|
|
37
|
+
OptionInputType: {
|
|
38
|
+
'': string;
|
|
39
|
+
/** 한줄텍스트 */
|
|
40
|
+
text: string;
|
|
41
|
+
/** 날짜 */
|
|
42
|
+
date: string;
|
|
43
|
+
/** 주소 */
|
|
44
|
+
address: string;
|
|
45
|
+
/** 전화번호 */
|
|
46
|
+
phone: string;
|
|
47
|
+
/** 단일선택 */
|
|
48
|
+
single: string;
|
|
49
|
+
/** 이미지(첨부파일) */
|
|
50
|
+
image: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* 옵션 분류 항목
|
|
54
|
+
*/
|
|
55
|
+
OptionCategoryType: {
|
|
56
|
+
/** 선택없음 */
|
|
57
|
+
'': string;
|
|
58
|
+
/** 카테고리 */
|
|
59
|
+
category: string;
|
|
60
|
+
/** 요일별 */
|
|
61
|
+
day: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* stereo-type in option
|
|
66
|
+
*/
|
|
67
|
+
export declare type OptionStereo = keyof typeof $OptionLUT.OptionStereo;
|
|
68
|
+
/**
|
|
69
|
+
* input type in option
|
|
70
|
+
*/
|
|
71
|
+
export declare type OptionInputType = keyof typeof $OptionLUT.OptionInputType;
|
|
72
|
+
/**
|
|
73
|
+
* category-type in option
|
|
74
|
+
*/
|
|
75
|
+
export declare type OptionCategoryType = keyof typeof $OptionLUT.OptionCategoryType;
|
|
76
|
+
/**
|
|
77
|
+
* type: `OptionState`
|
|
78
|
+
* - internal state of each option elements
|
|
79
|
+
*/
|
|
80
|
+
export interface OptionState {
|
|
81
|
+
/**
|
|
82
|
+
* hidden for user. (non-display)
|
|
83
|
+
*/
|
|
84
|
+
hidden?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* internally invalidated. (like deleted)
|
|
87
|
+
*/
|
|
88
|
+
invalid?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* soldout not for sale. (displayed but soldout)
|
|
91
|
+
*/
|
|
92
|
+
soldout?: boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* type: `Option`
|
|
96
|
+
* - common class for option sub-class
|
|
97
|
+
*/
|
|
98
|
+
export interface Option<T extends OptionStereo = OptionStereo> extends OptionState {
|
|
99
|
+
/**
|
|
100
|
+
* local id of option
|
|
101
|
+
*/
|
|
102
|
+
id: string;
|
|
103
|
+
/**
|
|
104
|
+
* stereo types.
|
|
105
|
+
*/
|
|
106
|
+
stereo?: T;
|
|
107
|
+
/** option-id (which is unique in option-model) */
|
|
108
|
+
oid?: string;
|
|
109
|
+
/** item-id linked */
|
|
110
|
+
iid?: string;
|
|
111
|
+
/** prod-id linked */
|
|
112
|
+
pid?: string;
|
|
113
|
+
/**
|
|
114
|
+
* (optional) internal last error.
|
|
115
|
+
*/
|
|
116
|
+
error?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* type: `OptionGroup`
|
|
120
|
+
* --------------
|
|
121
|
+
* 1. (requred) independant selectables (ex: free-gift)
|
|
122
|
+
* - stock is seperated from main selection. but it should be selected.
|
|
123
|
+
* 2. (required) combinational selection (ex: color + size)
|
|
124
|
+
* - option-unit is specified by combination.
|
|
125
|
+
* 3. (optional) additional options to order more (ex: accessories, packages)
|
|
126
|
+
* - additions in ordering.
|
|
127
|
+
*
|
|
128
|
+
* **[Option-Structure]**
|
|
129
|
+
* 1. in group by `OptionGroup`
|
|
130
|
+
* - required: 필수 선택항목
|
|
131
|
+
* - (tbd) conditional required.
|
|
132
|
+
* 2. 각 그룹내에서 옵션선택(단건/조합)을 선택하도록
|
|
133
|
+
* - 각 옵션은 고유의 재고단위로 매핑될 수 있어야함
|
|
134
|
+
* 3. 각 옵션 선택은 옵션그룹에 종속되며, 옵션그룹이 다르면 같은 조건이라도 다른 인스턴스임
|
|
135
|
+
* - group.childs := list of units.
|
|
136
|
+
* - unit.parent := parent.id
|
|
137
|
+
*
|
|
138
|
+
* => Goods(1) -> Groups(N) -> Units(M)
|
|
139
|
+
*/
|
|
140
|
+
export interface OptionGroup extends Option<'group'> {
|
|
141
|
+
/**
|
|
142
|
+
* name of group
|
|
143
|
+
* ex) 옵션1
|
|
144
|
+
*/
|
|
145
|
+
name: string | null;
|
|
146
|
+
/**
|
|
147
|
+
* it should be selected. (or can be additional options)
|
|
148
|
+
*/
|
|
149
|
+
required?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* (optional) no need to make all option instances (option-id would be null)
|
|
152
|
+
*/
|
|
153
|
+
virtual?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* flag of combination types
|
|
156
|
+
* - if true, the possible combination := count(types[0]) x count(types[1]) x ....
|
|
157
|
+
* - if false, each option-type can be selectable exclusively.
|
|
158
|
+
*
|
|
159
|
+
* ex.A) 신발 컬러 + 사이즈 선택하기 (조합에 따른 고유 재고 단위).
|
|
160
|
+
* ex.B) 비스포크 냉장고, 4문 각기 다른 색상 선택 (4개 한꺼번에 선택 필수).
|
|
161
|
+
*/
|
|
162
|
+
combined?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* (optinal) max selectable count of this option.
|
|
165
|
+
* - 옵션선택수: 같은 옵션 그룹을 추가할 수 있는 개수.
|
|
166
|
+
*/
|
|
167
|
+
maxSelect?: number;
|
|
168
|
+
/**
|
|
169
|
+
* (optinal) flag to use `maxLimit`
|
|
170
|
+
*/
|
|
171
|
+
useLimit?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* (optinal) max limitation to buy
|
|
174
|
+
* - 구매제한수: 옵션 선택하고, 구매할 수 있는 재고수
|
|
175
|
+
*/
|
|
176
|
+
maxLimit?: number;
|
|
177
|
+
/**
|
|
178
|
+
* flag of classification
|
|
179
|
+
*/
|
|
180
|
+
useType?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* classification of option
|
|
183
|
+
* - 옵션 분류
|
|
184
|
+
*/
|
|
185
|
+
category?: OptionCategoryType;
|
|
186
|
+
/**
|
|
187
|
+
* 요일별 시각시각
|
|
188
|
+
*/
|
|
189
|
+
dayT1?: string;
|
|
190
|
+
/**
|
|
191
|
+
* 요일별 종료시각
|
|
192
|
+
*/
|
|
193
|
+
dayT2?: string;
|
|
194
|
+
/**
|
|
195
|
+
* 요일별 정보
|
|
196
|
+
*/
|
|
197
|
+
weekDays?: WeekDayNumType[];
|
|
198
|
+
/**
|
|
199
|
+
* list of types
|
|
200
|
+
* - in summary of options.
|
|
201
|
+
*/
|
|
202
|
+
types?: OptionType[];
|
|
203
|
+
/**
|
|
204
|
+
* selectable unit of options.
|
|
205
|
+
*/
|
|
206
|
+
units?: OptionUnit[];
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* type: `option-type`
|
|
210
|
+
* - describe each possble type and selectable names.
|
|
211
|
+
*/
|
|
212
|
+
export interface OptionType extends Option<'type'> {
|
|
213
|
+
/**
|
|
214
|
+
* parent-id (= id of option-group)
|
|
215
|
+
*/
|
|
216
|
+
parent?: string;
|
|
217
|
+
/**
|
|
218
|
+
* type of option
|
|
219
|
+
* ex) `color`
|
|
220
|
+
*/
|
|
221
|
+
type?: string;
|
|
222
|
+
/**
|
|
223
|
+
* (optional) name of option-type
|
|
224
|
+
* ex) `color`
|
|
225
|
+
*/
|
|
226
|
+
name?: string;
|
|
227
|
+
/**
|
|
228
|
+
* option-names in possible (or selectable).
|
|
229
|
+
* - help to give hint of selectable names.
|
|
230
|
+
* ex) `red,blue`
|
|
231
|
+
*/
|
|
232
|
+
names: string[];
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* type: `option-name`
|
|
236
|
+
* - describe the selected `option-name` for `option-type`.
|
|
237
|
+
*/
|
|
238
|
+
export interface OptionName extends Omit<Option<'name'>, 'id' | 'stereo'> {
|
|
239
|
+
/**
|
|
240
|
+
* stereo types.
|
|
241
|
+
*/
|
|
242
|
+
stereo?: 'name';
|
|
243
|
+
/**
|
|
244
|
+
* type of option
|
|
245
|
+
* ex) color
|
|
246
|
+
*/
|
|
247
|
+
type?: string;
|
|
248
|
+
/**
|
|
249
|
+
* name of option
|
|
250
|
+
* ex) red
|
|
251
|
+
*/
|
|
252
|
+
name?: string;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* type: `option-unit`
|
|
256
|
+
* - single element which can be selected from option.
|
|
257
|
+
* - 기본적으로 판메 `가격`과 `재고`를 가지고 있는 단위.
|
|
258
|
+
*/
|
|
259
|
+
export interface OptionUnit extends Option<'unit'> {
|
|
260
|
+
/**
|
|
261
|
+
* name of this unit
|
|
262
|
+
*/
|
|
263
|
+
name?: string;
|
|
264
|
+
/**
|
|
265
|
+
* parent-id (= id of option-group)
|
|
266
|
+
*/
|
|
267
|
+
parent?: string;
|
|
268
|
+
/**
|
|
269
|
+
* selections(names) per each option-types
|
|
270
|
+
* - `null` means `non-selection`
|
|
271
|
+
*/
|
|
272
|
+
types?: OptionName[];
|
|
273
|
+
/**
|
|
274
|
+
* in-line option text in display (:= ['<type>: <name>', ...].join('\n'))
|
|
275
|
+
* - ex: `color: red\n size: 220ms`
|
|
276
|
+
* - default delimter: `: ` (type delim) and `\n` (option delim)
|
|
277
|
+
* - `null` means not prepared.
|
|
278
|
+
*/
|
|
279
|
+
option: string | null;
|
|
280
|
+
/**
|
|
281
|
+
* price of option (float -> use priceMillis)
|
|
282
|
+
*/
|
|
283
|
+
price?: number;
|
|
284
|
+
/**
|
|
285
|
+
* (flag) `option.price` is added to `prod.price` as final sales price.
|
|
286
|
+
*/
|
|
287
|
+
isPriceAdd?: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* original price in millis (integer := price * 1000)
|
|
290
|
+
*/
|
|
291
|
+
priceMillis?: number;
|
|
292
|
+
/**
|
|
293
|
+
* possible stocks (integer)
|
|
294
|
+
*/
|
|
295
|
+
stock?: number;
|
|
296
|
+
/**
|
|
297
|
+
* selected counts.
|
|
298
|
+
*/
|
|
299
|
+
count?: number;
|
|
300
|
+
/**
|
|
301
|
+
* limited maximum selections
|
|
302
|
+
* - default is same as `.stock` (or `999`)
|
|
303
|
+
*/
|
|
304
|
+
max?: number;
|
|
305
|
+
/**
|
|
306
|
+
* (optional) limited maximum selections
|
|
307
|
+
* - default is `1`
|
|
308
|
+
*/
|
|
309
|
+
min?: number;
|
|
310
|
+
/**
|
|
311
|
+
* it should be selected. (or can be additional options)
|
|
312
|
+
*/
|
|
313
|
+
required?: boolean;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* type: `option-input`
|
|
317
|
+
* - `가격`이나 `재고` 정보가 없으며, 주문시 사용자의 입력을 받는다.
|
|
318
|
+
* - 필수/선택에 따라 입력 필수 여부를 결정한다.
|
|
319
|
+
*/
|
|
320
|
+
export interface OptionInput extends Option<'input'> {
|
|
321
|
+
/**
|
|
322
|
+
* name of option
|
|
323
|
+
*/
|
|
324
|
+
name: string | null;
|
|
325
|
+
/**
|
|
326
|
+
* (optional) parent-id (= id of option-input)
|
|
327
|
+
* - 아직 뚜렷한 사용성이 정의되지 않음 @230823
|
|
328
|
+
*/
|
|
329
|
+
parent?: string;
|
|
330
|
+
/**
|
|
331
|
+
* 사용자정의 항목형식
|
|
332
|
+
*/
|
|
333
|
+
type?: OptionInputType;
|
|
334
|
+
/**
|
|
335
|
+
* it should be selected. (or can be additional options)
|
|
336
|
+
*/
|
|
337
|
+
required?: boolean;
|
|
338
|
+
/** 입력 도움말 (가이드문구) */
|
|
339
|
+
placeholder?: string;
|
|
340
|
+
/** 날짜 선택 제한값 */
|
|
341
|
+
dayLimit?: number;
|
|
342
|
+
/** (optional) 텍스트 입력 항목들 (ex: 옵션 항목) */
|
|
343
|
+
extras?: string[];
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* types in option-root.
|
|
347
|
+
*/
|
|
348
|
+
export declare type OptionRoots = OptionGroup | OptionInput;
|
|
349
|
+
/**
|
|
350
|
+
* option's hyper modeling
|
|
351
|
+
* - supporting all stereo into single option data.
|
|
352
|
+
*
|
|
353
|
+
* NOTE
|
|
354
|
+
* - 옵션 생성 설정과 각 옵션별 재고 인스턴스를 분리할 필요가 있음. (재고 없으면 인스턴스 생성 할필요 없을듯!!)
|
|
355
|
+
* - 설정이 변경시, 옵션타입:이름이 같은것들은 살리고, 다르면 날림.
|
|
356
|
+
*/
|
|
357
|
+
export interface OptionNode extends GenericNode {
|
|
358
|
+
/** option id */
|
|
359
|
+
id?: string;
|
|
360
|
+
/** this name */
|
|
361
|
+
name?: string;
|
|
362
|
+
/** single-line option-text */
|
|
363
|
+
option?: string;
|
|
364
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `option/types.ts`
|
|
3
|
+
* - types used in `backed-proxy`
|
|
4
|
+
*
|
|
5
|
+
* @author Steve <steve@lemoncloud.io>
|
|
6
|
+
* @date 2022-08-29 initial version.
|
|
7
|
+
*
|
|
8
|
+
* @author Simon <wookeun@sl-platform.com>
|
|
9
|
+
* @date 2025-04-21 refactoring for option service.
|
|
10
|
+
*
|
|
11
|
+
* Copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
12
|
+
*/
|
|
13
|
+
import { SimpleSet } from 'lemon-model';
|
|
14
|
+
import { PaginateParam } from '../../cores/types';
|
|
15
|
+
export { SimpleSet };
|
|
16
|
+
/**
|
|
17
|
+
* type: boolean style number.
|
|
18
|
+
*/
|
|
19
|
+
export declare type BoolFlag = 0 | 1;
|
|
20
|
+
/**
|
|
21
|
+
* Lookup Table
|
|
22
|
+
*
|
|
23
|
+
* WARN! DO NOT EXPORT AS `$LUT`. use default export instead.
|
|
24
|
+
*/
|
|
25
|
+
export declare const $LUT: {
|
|
26
|
+
/**
|
|
27
|
+
* Possible type of model.
|
|
28
|
+
*/
|
|
29
|
+
ModelType: {
|
|
30
|
+
/** option model */
|
|
31
|
+
option: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 옵션 항목의 종류들
|
|
35
|
+
*/
|
|
36
|
+
OptionStereo: {
|
|
37
|
+
/** 기본형 */
|
|
38
|
+
'': string;
|
|
39
|
+
/** 옵션그룹 */
|
|
40
|
+
group: string;
|
|
41
|
+
/** 종류 */
|
|
42
|
+
type: string;
|
|
43
|
+
/** 옵션명 */
|
|
44
|
+
name: string;
|
|
45
|
+
/** 옵션단위 */
|
|
46
|
+
unit: string;
|
|
47
|
+
/** 사용자정의 옵션 */
|
|
48
|
+
input: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* 요일 (WeekDay)의 number 타입
|
|
52
|
+
* - Date 객체와 호환을 위함.
|
|
53
|
+
* */
|
|
54
|
+
WeekDayNumType: {
|
|
55
|
+
/** sun (Sunday): 0 */
|
|
56
|
+
sun: number;
|
|
57
|
+
/** mon (Monday): 1 */
|
|
58
|
+
mon: number;
|
|
59
|
+
/** tue (Tuesday): 2 */
|
|
60
|
+
tue: number;
|
|
61
|
+
/** wed (Wednesday): 3 */
|
|
62
|
+
wed: number;
|
|
63
|
+
/** thu (Thursday): 4 */
|
|
64
|
+
thu: number;
|
|
65
|
+
/** fri (Friday): 5 */
|
|
66
|
+
fri: number;
|
|
67
|
+
/** sat (Saturday): 6 */
|
|
68
|
+
sat: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* 요일 (WeekDay)의 한국어 타입
|
|
72
|
+
* */
|
|
73
|
+
WeekDayKorType: {
|
|
74
|
+
/** 일요일 */
|
|
75
|
+
sun: string;
|
|
76
|
+
/** 월요일 */
|
|
77
|
+
mon: string;
|
|
78
|
+
/** 화요일 */
|
|
79
|
+
tue: string;
|
|
80
|
+
/** 수요일 */
|
|
81
|
+
wed: string;
|
|
82
|
+
/** 목요일 */
|
|
83
|
+
thu: string;
|
|
84
|
+
/** 금요일 */
|
|
85
|
+
fri: string;
|
|
86
|
+
/** 토요일 */
|
|
87
|
+
sat: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* type: `OptionStereo`
|
|
92
|
+
*/
|
|
93
|
+
export declare type OptionStereo = keyof typeof $LUT.OptionStereo;
|
|
94
|
+
/**
|
|
95
|
+
* type: `WeekDayNumType`
|
|
96
|
+
*/
|
|
97
|
+
export declare type WeekDayNumType = keyof typeof $LUT.WeekDayNumType;
|
|
98
|
+
/**
|
|
99
|
+
* type: `WeekDayKorType`
|
|
100
|
+
*/
|
|
101
|
+
export declare type WeekDayKorType = keyof typeof $LUT.WeekDayKorType;
|
|
102
|
+
/**
|
|
103
|
+
* query param for options-list
|
|
104
|
+
*/
|
|
105
|
+
export interface OptionListParam extends PaginateParam {
|
|
106
|
+
/** sort selection (default latest) */
|
|
107
|
+
sort?: 'latest' | 'popular' | 'lowPrice' | 'highPrice' | 'ranking';
|
|
108
|
+
/** stereo */
|
|
109
|
+
stereo?: string | OptionStereo;
|
|
110
|
+
}
|
|
111
|
+
/** must export $LUT as default */
|
|
112
|
+
export default $LUT;
|