@lemoncloud/clipbiz-goods-api 0.25.1028 → 0.25.1125

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.
@@ -10,7 +10,6 @@
10
10
  */
11
11
  import { CoreModel } from 'lemon-model';
12
12
  import $LUT, { RecommendState, RecommendStereo, ReferencedContent, ReferencedUsage } from './types';
13
- import { GenModelType } from '../../lib/openai/openai-types';
14
13
  /**
15
14
  * type: `ModelType`
16
15
  */
@@ -52,7 +51,7 @@ export interface RecommendModel extends Model, RecommendHead {
52
51
  /** name of recommend */
53
52
  name?: string;
54
53
  /** type of llm model */
55
- modelType?: GenModelType;
54
+ modelType?: string;
56
55
  /** system prompt to use */
57
56
  promptId?: string;
58
57
  /** state of recommend */
@@ -62,4 +62,9 @@ export interface RecommendPostItemsParam extends RecommendCommonParam {
62
62
  * - if true, return immediately after make notify()
63
63
  */
64
64
  async?: boolean | string;
65
+ /**
66
+ * (optional) id of connection-id
67
+ * - send the result of the change to a WebSocket
68
+ */
69
+ connId?: string;
65
70
  }
@@ -0,0 +1,157 @@
1
+ /**
2
+ * `model.ts`
3
+ * - model definitions per contract data
4
+ *
5
+ * @author Steve <steve@lemoncloud.io>
6
+ * @date 2022-08-29 initial version.
7
+ * @author Aiden <aiden@lemoncloud.io>
8
+ * @date 2025-11-30 implement a contract service.
9
+ *
10
+ * Copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
11
+ */
12
+ import { CoreModel } from 'lemon-model';
13
+ import $LUT, { ContractStereo, ContractState, DeliveryStereo, DeliveryState, ContractAgreement } from './types';
14
+ import { DealHead, DealModel } from '../deals/model';
15
+ import { Cores } from 'lemon-core';
16
+ /**
17
+ * type: `ModelType`
18
+ */
19
+ export declare type ModelType = keyof typeof $LUT.ModelType;
20
+ /**
21
+ * type: `Model`: common model interface
22
+ * - modifier 정보 저장을 위해 확장됨 @251124
23
+ *
24
+ * TODO [Steve] 아래의 `$` 부분은 추후 `lemon-model` 쪽으로 이전 검토 필요. @251124
25
+ */
26
+ export interface Model extends CoreModel<ModelType> {
27
+ /**
28
+ * the modifier information
29
+ * - can't update manually.
30
+ */
31
+ readonly $?: Cores;
32
+ }
33
+ /**
34
+ * type: `ContractHead`
35
+ */
36
+ export interface ContractHead {
37
+ /** id of model */
38
+ id?: string;
39
+ /** name of model */
40
+ name?: string;
41
+ }
42
+ /**
43
+ * type: `ContractModel`
44
+ * - 매칭(deal)에 대한 계약 정보를 관리함.
45
+ */
46
+ export interface ContractModel extends ContractHead, Model {
47
+ /** name of model */
48
+ name?: string;
49
+ /** stereo of model */
50
+ stereo?: ContractStereo;
51
+ /** state of model */
52
+ state?: ContractState;
53
+ /** (linked) id of deal */
54
+ dealId?: string;
55
+ /** (linked) parital of deal */
56
+ deal$?: DealHead;
57
+ /** 총 주문수량 */
58
+ totalQuantity?: number;
59
+ /** 단가 */
60
+ unitPrice?: number;
61
+ /** 총 계약금액 */
62
+ totalAmount?: number;
63
+ /** 계약 시작 시각 */
64
+ startedAt?: number;
65
+ /** 계약 만료 시각 */
66
+ expiredAt?: number;
67
+ /** 특이사항 (for 기업) */
68
+ notes?: string;
69
+ /** 메모 (for 사업장) */
70
+ memo?: string;
71
+ /** 반려사유 (for 사업장) */
72
+ reasons?: string[];
73
+ /**
74
+ * no of revision
75
+ * - [parent] no-of-revision
76
+ * - [child] no-in-revision
77
+ */
78
+ revisionNo?: number;
79
+ /**
80
+ * no of delivery (원자적 증가)
81
+ * - 마지막 생성된 납기 번호
82
+ */
83
+ deliveryNo?: number;
84
+ /** (optional) id of parent */
85
+ parentId?: string;
86
+ /** (optional) partial of parent */
87
+ parent$?: ContractHead;
88
+ /**
89
+ * 약관 동의 기록
90
+ * - 기업, 표준사업장 동의 기록 관리
91
+ */
92
+ agreed$?: ContractAgreement;
93
+ /**
94
+ * (internal) detail info of deal
95
+ */
96
+ readonly $deal?: DealModel;
97
+ }
98
+ /**
99
+ * interface: `DeliveryHead`
100
+ * - common head of `DeliveryModel`
101
+ */
102
+ export interface DeliveryHead {
103
+ /** id of model */
104
+ id?: string;
105
+ /** name of model */
106
+ name?: string;
107
+ }
108
+ /**
109
+ * interface: `DeliveryModel`
110
+ * - 계약(contract)애 대헌 회차/납기 정보를 관리함.
111
+ */
112
+ export interface DeliveryModel extends DeliveryHead, Model {
113
+ /** name of model */
114
+ name?: string;
115
+ /** stereo of model */
116
+ stereo?: DeliveryStereo;
117
+ /** state of model */
118
+ state?: DeliveryState;
119
+ /** (linked) id of contract */
120
+ contractId?: string;
121
+ /** (linked) partial of contract */
122
+ contract$?: ContractHead;
123
+ /** (internal) 납기 번호 (:= Contract.deliveryNo) */
124
+ no?: number;
125
+ /** 납기 수량 */
126
+ quantity?: number;
127
+ /** 납기 단가 */
128
+ unitPrice?: number;
129
+ /** 납기 금액 */
130
+ amount?: number;
131
+ /** 예정 납기일 */
132
+ scheduledAt?: number;
133
+ /** 실제 납품일 */
134
+ deliveredAt?: number;
135
+ /** 메모 */
136
+ memo?: string;
137
+ }
138
+ export declare const filterFields: (fields: string[], base?: string[]) => string[];
139
+ export declare const $HEAD: {
140
+ contract: string[];
141
+ delivery: string[];
142
+ };
143
+ export declare const $FIELD: {
144
+ contract: string[];
145
+ delivery: string[];
146
+ };
147
+ declare const _default: {
148
+ $HEAD: {
149
+ contract: string[];
150
+ delivery: string[];
151
+ };
152
+ $FIELD: {
153
+ contract: string[];
154
+ delivery: string[];
155
+ };
156
+ };
157
+ export default _default;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * `types.ts`
3
+ * - view types used in API controllers and transformer
4
+ *
5
+ * @author Steve <steve@lemoncloud.io>
6
+ * @date 2022-06-21 optimized w/ `abstract-services`
7
+ * @author Aiden <aiden@lemoncloud.io>
8
+ * @date 2025-11-30 implement a contract service.
9
+ *
10
+ * @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
11
+ */
12
+ declare const $LUT: {
13
+ ModelType: {
14
+ contract: string;
15
+ delivery: string;
16
+ };
17
+ /** ContractStereo **/
18
+ ContractStereo: {
19
+ '': string;
20
+ '#': string;
21
+ '#revision': string;
22
+ };
23
+ /** ContractState */
24
+ ContractState: {
25
+ '': string;
26
+ draft: string;
27
+ pending: string;
28
+ approved: string;
29
+ active: string;
30
+ completed: string;
31
+ expired: string;
32
+ rejected: string;
33
+ cancelled: string;
34
+ };
35
+ /** DeliveryStereo */
36
+ DeliveryStereo: {
37
+ '': string;
38
+ };
39
+ /** DeliveryState */
40
+ DeliveryState: {
41
+ '': string;
42
+ };
43
+ };
44
+ /**
45
+ * type: `ContractStereo`
46
+ */
47
+ export declare type ContractStereo = keyof typeof $LUT.ContractStereo;
48
+ /**
49
+ * type: `ContractState`
50
+ */
51
+ export declare type ContractState = keyof typeof $LUT.ContractState;
52
+ /**
53
+ * type: `DeliveryStereo`
54
+ */
55
+ export declare type DeliveryStereo = keyof typeof $LUT.DeliveryStereo;
56
+ /**
57
+ * type: `DeliveryState`
58
+ */
59
+ export declare type DeliveryState = keyof typeof $LUT.DeliveryState;
60
+ /**
61
+ * type: `Agreement`
62
+ */
63
+ export interface Agreement {
64
+ /**
65
+ * 동적 약관 동의 기록
66
+ * - key: 약관 ID
67
+ * - value: 약관 정보
68
+ */
69
+ [key: string]: {
70
+ /** 약관(term) ID */
71
+ id: string;
72
+ /** 약관(term)명 */
73
+ name: string;
74
+ /** 동의 시각 */
75
+ ts?: number;
76
+ };
77
+ }
78
+ /**
79
+ * type: `ContractAgreement`
80
+ * - 계약서별 약관 동의 기록
81
+ */
82
+ export interface ContractAgreement {
83
+ /** 구매업체(기업) 약관 기록 */
84
+ seller?: Agreement;
85
+ /** 판매업체(표준사업장) 약관 기록 */
86
+ buyer?: Agreement;
87
+ }
88
+ export default $LUT;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * `contracts/views.ts`
3
+ * - types used in `backed-proxy`
4
+ *
5
+ * @author Steve <steve@lemoncloud.io>
6
+ * @date 2022-08-29 initial version.
7
+ * @author Aiden <aiden@lemoncloud.io>
8
+ * @date 2025-11-30 implement a contract service.
9
+ *
10
+ * @copyright (C) lemoncloud.io 2022 - All Rights Reserved.
11
+ */
12
+ import { View, Body } from 'lemon-model';
13
+ import { ContractModel, DeliveryModel } from './model';
14
+ import $LUT from './types';
15
+ import { DealView } from '../deals/views';
16
+ export * from './types';
17
+ export default $LUT;
18
+ /**!SECTION */
19
+ /**
20
+ * type: `ContractView`
21
+ * - usually same as post's body.
22
+ */
23
+ export interface ContractView extends View, Omit<Partial<ContractModel>, 'deal$'> {
24
+ /**
25
+ * (readonly) 매칭 정보
26
+ */
27
+ readonly deal$?: DealView;
28
+ }
29
+ export interface ContractBody extends Body, Partial<ContractView> {
30
+ }
31
+ /**
32
+ * type: `DeliveryView`
33
+ * - usually same as post's body.
34
+ */
35
+ export interface DeliveryView extends View, Omit<Partial<DeliveryModel>, 'contract$'> {
36
+ /**
37
+ * (readonly) 계약서 정보
38
+ */
39
+ readonly contract$?: ContractView;
40
+ }
41
+ /**
42
+ * type: `DeliveryBody`
43
+ */
44
+ export interface DeliveryBody extends Body, Partial<DeliveryView> {
45
+ }
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
9
9
  */
10
- import { CoreModel } from 'lemon-model';
10
+ import { CoreModel, Cores } from 'lemon-model';
11
11
  import $LUT, { DealStereo, DealStatus, DealStatusSet } from './types';
12
12
  import { ProdHead } from '../goods/model';
13
13
  import { ItemHead } from '../goods/model';
@@ -17,9 +17,18 @@ import { SiteHead } from '../sites/model';
17
17
  */
18
18
  export declare type ModelType = keyof typeof $LUT.ModelType;
19
19
  /**
20
- * type: `Model`: common model
20
+ * type: `Model`: common model interface
21
+ * - modifier 정보 저장을 위해 확장됨 @251124
22
+ *
23
+ * TODO [Steve] 아래의 `$` 부분은 추후 `lemon-model` 쪽으로 이전 검토 필요. @251124
21
24
  */
22
- export declare type Model = CoreModel<ModelType>;
25
+ export interface Model extends CoreModel<ModelType> {
26
+ /**
27
+ * the modifier information
28
+ * - can't update manually.
29
+ */
30
+ readonly $?: Cores;
31
+ }
23
32
  /**
24
33
  * interface: `DealHead`
25
34
  * - common head of deal-model
@@ -29,6 +38,23 @@ export interface DealHead {
29
38
  id?: string;
30
39
  /** name of deal */
31
40
  name?: string;
41
+ /** ==== 계약 시점의 스냅샷 ==== */
42
+ /** (linked) 상품(희망상품) ID */
43
+ prodId?: string;
44
+ /** (linked) 상품(희망상품) 정보 */
45
+ prod$?: ProdHead;
46
+ /** (linked) 품목 ID */
47
+ itemId?: string;
48
+ /** (linked) 품목 정보 */
49
+ item$?: ItemHead;
50
+ /** (linked) 신청 기업(업체) ID */
51
+ buyerSiteId?: string;
52
+ /** (linked) 신청 기업(업체) 정보 */
53
+ buyerSite$?: SiteHead;
54
+ /** (linked) 공급 기업(표준사업장) ID */
55
+ sellerSiteId?: string;
56
+ /** (linked) 공급 기업(표준사업장) 정보 */
57
+ sellerSite$?: SiteHead;
32
58
  }
33
59
  /**
34
60
  * interface: `DealModel`
@@ -63,6 +89,8 @@ export interface DealModel extends DealHead, Model {
63
89
  sellerSite$?: SiteHead;
64
90
  /** 전체 상태 */
65
91
  status?: DealStatus;
92
+ /** 상태 순서 (1-7) */
93
+ stateNo?: number;
66
94
  /** 상태 세트 (inner object) */
67
95
  status$?: DealStatusSet;
68
96
  /** 요청 정보 */
@@ -27,20 +27,87 @@ declare const $LUT: {
27
27
  DealStatus: {
28
28
  /** 상태없음 */
29
29
  '': string;
30
- /** 승인 대기 */
30
+ /**
31
+ * 승인 대기
32
+ * @deprecated 기획 변경에 따른 타입 수정. 제거 필요함
33
+ */
31
34
  pending: string;
32
- /** 준비 단계 */
35
+ /**
36
+ * 준비 단계
37
+ * @deprecated 기획 변경에 따른 타입 수정. 제거 필요함
38
+ */
33
39
  preparing: string;
34
- /** 진행 단계 */
40
+ /**
41
+ * 진행 단계
42
+ * @deprecated 기획 변경에 따른 타입 수정. 제거 필요함
43
+ */
35
44
  inProgress: string;
36
- /** 완료 */
45
+ /**
46
+ * 완료
47
+ * @deprecated 기획 변경에 따른 타입 수정. 제거 필요함
48
+ */
37
49
  completed: string;
38
- /** 반려 (재신청 가능) */
50
+ /**
51
+ * 반려 (재신청 가능)
52
+ * @deprecated 기획 변경에 따른 타입 수정. 제거 필요함
53
+ */
39
54
  rejected: string;
40
- /** 취소 (재신청 가능) */
55
+ /**
56
+ * 취소 (재신청 가능)
57
+ * @deprecated 기획 변경에 따른 타입 수정. 제거 필요함
58
+ */
41
59
  cancelled: string;
42
- /** 취소요청 */
60
+ /**
61
+ * 취소요청
62
+ * @deprecated 기획 변경에 따른 타입 수정. 제거 필요함
63
+ */
43
64
  toCancel: string;
65
+ /** [step1] 우수사업장 선정 */
66
+ select: string;
67
+ /** [step2] 품목 매핑 */
68
+ mapping: string;
69
+ /** [step3] 사용부서 협의 */
70
+ agreement: string;
71
+ /** [step4] 업체평 (선택) */
72
+ review: string;
73
+ /** [step5] 샘플 테스트 */
74
+ sample: string;
75
+ /** [step6] 업체 등록 */
76
+ register: string;
77
+ /** [step7] 단가 계약 */
78
+ contract: string;
79
+ };
80
+ /**
81
+ * DealWorkflowState
82
+ */
83
+ DealWorkflowState: {
84
+ /** 상태없음 */
85
+ '': string;
86
+ /** 초기상태 */
87
+ init: string;
88
+ /** 처리중(진행중) */
89
+ busy: string;
90
+ /** 완료 */
91
+ completed: string;
92
+ };
93
+ /**
94
+ * DealStatusOrder
95
+ */
96
+ DealStatusOrder: {
97
+ /** [step1] 우수사업장 선정 */
98
+ select: number;
99
+ /** [step2] 품목 매핑 */
100
+ mapping: number;
101
+ /** [step3] 사용부서 협의 */
102
+ agreement: number;
103
+ /** [step4] 업체평 (선택) */
104
+ review: number;
105
+ /** [step5] 샘플 테스트 */
106
+ sample: number;
107
+ /** [step6] 업체 등록 */
108
+ register: number;
109
+ /** [step7] 단가 계약 */
110
+ contract: number;
44
111
  };
45
112
  };
46
113
  /**
@@ -51,32 +118,58 @@ export declare type DealStereo = keyof typeof $LUT.DealStereo;
51
118
  * type: `DealStatus`
52
119
  */
53
120
  export declare type DealStatus = keyof typeof $LUT.DealStatus;
121
+ /**
122
+ * type: `DealWorkflowState`
123
+ */
124
+ export declare type DealWorkflowState = keyof typeof $LUT.DealWorkflowState;
125
+ /**
126
+ * type: `DealStatusOrder`
127
+ */
128
+ export declare type DealStatusOrder = keyof typeof $LUT.DealStatusOrder;
54
129
  /**
55
130
  * interface: `DealStatusSet`
56
131
  * - 상태 세트
57
132
  */
58
- export interface DealStatusSet {
59
- /** 신청 정보 */
133
+ export interface DealStatusSet extends DealWorkflowSet {
134
+ /**
135
+ * 신청 정보
136
+ * @deprecated don't use it anymore.
137
+ */
60
138
  requestedAt?: number;
61
139
  requestedBy?: string;
62
140
  requestMemo?: string;
63
- /** 승인 정보 */
141
+ /**
142
+ * 승인 정보
143
+ * @deprecated don't use it anymore.
144
+ */
64
145
  approvedAt?: number;
65
146
  approvedBy?: string;
66
147
  approvalMemo?: string;
67
- /** 진행 정보 */
148
+ /**
149
+ * 진행 정보
150
+ * @deprecated don't use it anymore.
151
+ */
68
152
  progressedAt?: number;
69
153
  progressedBy?: string;
70
154
  progressedMemo?: string;
71
- /** 완료 시각 */
155
+ /**
156
+ * 완료 정보
157
+ * @deprecated don't use it anymore.
158
+ */
72
159
  completedAt?: number;
73
160
  completedBy?: string;
74
161
  completedMemo?: string;
75
- /** 반려 정보 */
162
+ /**
163
+ * 반려 정보
164
+ * @deprecated don't use it anymore.
165
+ */
76
166
  rejectedAt?: number;
77
167
  rejectedBy?: string;
78
168
  rejectionReason?: string;
79
- /** 취소 정보 */
169
+ /**
170
+ * 취소 정보
171
+ * @deprecated don't use it anymore.
172
+ */
80
173
  cancelledAt?: number;
81
174
  cancelledBy?: string;
82
175
  cancelReason?: string;
@@ -85,5 +178,25 @@ export interface DealStatusSet {
85
178
  /** (internal) last udpated time */
86
179
  updatedAt?: number;
87
180
  }
181
+ /**
182
+ * type: `DealWorkflowSet`
183
+ * - 매칭상품의 진행 상태를 관리함
184
+ */
185
+ export interface DealWorkflowSet {
186
+ /** [step1] 우수사업장 선정 */
187
+ select?: DealWorkflowState;
188
+ /** [step2] 품목 매핑 */
189
+ mapping?: DealWorkflowState;
190
+ /** [step3] 사용부서 협의 */
191
+ agreement?: DealWorkflowState;
192
+ /** [step4] 업체평 (선택) */
193
+ review?: DealWorkflowState;
194
+ /** [step5] 샘플 테스트 */
195
+ sample?: DealWorkflowState;
196
+ /** [step6] 업체 등록 */
197
+ register?: DealWorkflowState;
198
+ /** [step7] 단가 계약 */
199
+ contract?: DealWorkflowState;
200
+ }
88
201
  /** must export $LUT as default */
89
202
  export default $LUT;
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * Copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
11
11
  */
12
- import { CoreModel } from 'lemon-model';
12
+ import { CoreModel, Cores } from 'lemon-model';
13
13
  import $LUT, { ItemStereo, ItemUnitType, ProdStereo } from './types';
14
14
  /**
15
15
  * type: boolean style number.
@@ -22,9 +22,18 @@ import { SiteHead } from '../sites/model';
22
22
  */
23
23
  export declare type ModelType = keyof typeof $LUT.ModelType;
24
24
  /**
25
- * type: `Model`: common model
25
+ * type: `Model`: common model interface
26
+ * - modifier 정보 저장을 위해 확장됨 @251124
27
+ *
28
+ * TODO [Steve] 아래의 `$` 부분은 추후 `lemon-model` 쪽으로 이전 검토 필요. @251124
26
29
  */
27
- export declare type Model = CoreModel<ModelType>;
30
+ export interface Model extends CoreModel<ModelType> {
31
+ /**
32
+ * the modifier information
33
+ * - can't update manually.
34
+ */
35
+ readonly $?: Cores;
36
+ }
28
37
  /**
29
38
  * interface: `ItemHead`
30
39
  * - common head of item-model.
@@ -24,12 +24,17 @@ declare const $LUT: {
24
24
  callback: string;
25
25
  category: string;
26
26
  site: string;
27
+ /**
28
+ * Lookup Table
29
+ *
30
+ * WARN! DO NOT EXPORT AS `$LUT`. use default export instead.
31
+ */
27
32
  user: string;
28
33
  exam: string;
34
+ contract: string;
35
+ delivery: string;
29
36
  deal: string;
30
- item: string; /**
31
- * Possible type of model.
32
- */
37
+ item: string;
33
38
  prod: string;
34
39
  recommend: string;
35
40
  };