Commit 4fe2ccccfab5b265c49441d2cd9316e336be72a2
1 parent
aba3e198
Exists in
develop
update sgl api
Showing
3 changed files
with
308 additions
and
1 deletions
Show diff stats
account-api.js
@@ -27,7 +27,7 @@ module.exports.accountPayables = async (req, res) => { | @@ -27,7 +27,7 @@ module.exports.accountPayables = async (req, res) => { | ||
27 | "tradingPartner": "", | 27 | "tradingPartner": "", |
28 | "branch": "00000", | 28 | "branch": "00000", |
29 | "taxId": "0105556143098", | 29 | "taxId": "0105556143098", |
30 | - "memberId": "75EzpNZ0Twt", | 30 | + "memberId": "BKAz9K097bT", |
31 | "createdBy": "System", | 31 | "createdBy": "System", |
32 | "createdDate": "2022-06-20T08:52:08.655Z", | 32 | "createdDate": "2022-06-20T08:52:08.655Z", |
33 | "updatedBy": "System", | 33 | "updatedBy": "System", |
app.js
@@ -456,6 +456,8 @@ app.post('/api/authen/application', require('./cmsp-authen').authen); | @@ -456,6 +456,8 @@ app.post('/api/authen/application', require('./cmsp-authen').authen); | ||
456 | app.post('/graphql', require('./cirr').graphql); | 456 | app.post('/graphql', require('./cirr').graphql); |
457 | 457 | ||
458 | app.get('/sgl/api/v1/accounting-management/accountpayables', require('./account-api').accountPayables); | 458 | app.get('/sgl/api/v1/accounting-management/accountpayables', require('./account-api').accountPayables); |
459 | +app.get('/sgl/api/v1/company-management/companies', require('./company-api').getCompanies); | ||
460 | +app.get('/sgl/api/v1/company-management/contactpersons', require('./company-api').contactPersons); | ||
459 | 461 | ||
460 | app.get('/api/random/leader', function (req, res) { | 462 | app.get('/api/random/leader', function (req, res) { |
461 | const months = ["เกมส์", "โน๊ต setup", "โน๊ต วัศรุต", "แบงค์", "มอส", "ปิ๊ค", "เต้นพอไม่ต้องตื่น", "เปา", "นัท", "kik", "new", "ann","na", "boky", "eve", "miki", "pla", "sugar"]; | 463 | const months = ["เกมส์", "โน๊ต setup", "โน๊ต วัศรุต", "แบงค์", "มอส", "ปิ๊ค", "เต้นพอไม่ต้องตื่น", "เปา", "นัท", "kik", "new", "ann","na", "boky", "eve", "miki", "pla", "sugar"]; |
@@ -0,0 +1,305 @@ | @@ -0,0 +1,305 @@ | ||
1 | + | ||
2 | +module.exports.getCompanies = async (req, res) => { | ||
3 | + console.log('===== GET getCompanies =====') | ||
4 | + console.log('url', req.originalUrl); | ||
5 | + console.log('headers', req.headers); | ||
6 | + console.log('query', req.query); | ||
7 | + console.log('params', req.params); | ||
8 | + console.log('body', req.body); | ||
9 | + | ||
10 | + let response = { | ||
11 | + "link": { | ||
12 | + "prev": "ip:port/partner/api/v1/Companies?taxId=$taxId&keyword=$keyword&page=$page&limit=$limit&sortby=$sortby", | ||
13 | + "next": "ip:port/partner/api/v1/Companies?taxId=$taxId&keyword=$keyword&page=$page&limit=$limit&sortby=$sortby" | ||
14 | + }, | ||
15 | + "meta": { | ||
16 | + "currentPage": 1, | ||
17 | + "totalPages": 1, | ||
18 | + "limit": 1 | ||
19 | + }, | ||
20 | + "total": 2, | ||
21 | + "results": [ | ||
22 | + { | ||
23 | + "_id": "ifd0zgjzzbw", | ||
24 | + "taxId": "0101620010053", | ||
25 | + "titleId": "201", | ||
26 | + "title": "โครงการ", | ||
27 | + "companyNameEn": "provisioning pack", | ||
28 | + "companyNameTh": "โปรวิชชั่นนิง แพ็ค", | ||
29 | + "companyLogo": "Shiba.jpg", | ||
30 | + "files": [ | ||
31 | + { | ||
32 | + "fileId": "9GSI21SAEGy", | ||
33 | + "fileLabel": "สำเนาบัตรประชาชนผู้ทำรายการ", | ||
34 | + "fileValue": "ContactIdCard", | ||
35 | + "fileName": "9GSI21SAEGy.png" | ||
36 | + }, | ||
37 | + { | ||
38 | + "fileId": "jwgu2rnctcu", | ||
39 | + "fileLabel": "หนังสือรับรองบริษัท (อายุไม่เกิน 1 ปี) พร้อมประทับตราบริษัท", | ||
40 | + "fileValue": "Certificate", | ||
41 | + "fileName": "jwgu2rnctcu.jpg" | ||
42 | + } | ||
43 | + ], | ||
44 | + "businessType": [ | ||
45 | + { | ||
46 | + "_id": "9GSI21SAEGy", | ||
47 | + "businessTypeName": "B2C", | ||
48 | + "sortOrder": "1" | ||
49 | + }, | ||
50 | + { | ||
51 | + "_id": "jwgu2rnctcu", | ||
52 | + "businessTypeName": "B2B", | ||
53 | + "sortOrder": "2" | ||
54 | + } | ||
55 | + ], | ||
56 | + "businessTypeOther": "B2B2C", | ||
57 | + "businessIndustries": [ | ||
58 | + { | ||
59 | + "_id": "9GSI21SAEGy", | ||
60 | + "industryName": "Smart Office", | ||
61 | + "sortOrder": "1" | ||
62 | + }, | ||
63 | + { | ||
64 | + "_id": "jwgu2rnctcu", | ||
65 | + "industryName": "Smart Health", | ||
66 | + "sortOrder": "2" | ||
67 | + } | ||
68 | + ], | ||
69 | + "businessIndustryOther": "Education", | ||
70 | + "numberOfEmployee": "20", | ||
71 | + "socialChannels": [ | ||
72 | + { | ||
73 | + "socialChannelId": "Xuk6d43LvS5", | ||
74 | + "channel": "facebook", | ||
75 | + "link": "www.facebook.com" | ||
76 | + }, | ||
77 | + { | ||
78 | + "socialChannelId": "Zuk6d43LvS6", | ||
79 | + "channel": "instagram", | ||
80 | + "link": "www.instagram.com/dlwlrma" | ||
81 | + } | ||
82 | + ], | ||
83 | + "companyAddress": { | ||
84 | + "addressNo": "222/77", | ||
85 | + "moo": "1", | ||
86 | + "mooban": "Siri Place Rachaphuk-Rattanatibek", | ||
87 | + "soi": "5", | ||
88 | + "building": "D", | ||
89 | + "room": "1", | ||
90 | + "floor": "1", | ||
91 | + "street": "Rattanatibek", | ||
92 | + "provinceCode": "10", | ||
93 | + "provinceName": "นนทบุรี/Nonthaburi", | ||
94 | + "districtCode": "1014", | ||
95 | + "districtName": "บางบัวทอง/Bangbuathong", | ||
96 | + "subDistrictCode": "101401", | ||
97 | + "subDisstrictName": "บางรักพัฒนา/Bangrakpattana", | ||
98 | + "postalCode": "11110" | ||
99 | + }, | ||
100 | + "companyBillingAddress": { | ||
101 | + "addressNo": "222/77", | ||
102 | + "moo": "1", | ||
103 | + "mooban": "Siri Place Rachaphuk-Rattanatibek", | ||
104 | + "soi": "5", | ||
105 | + "building": "D", | ||
106 | + "room": "1", | ||
107 | + "floor": "1", | ||
108 | + "street": "Rattanatibek", | ||
109 | + "provinceCode": "10", | ||
110 | + "provinceName": "นนทบุรี/Nonthaburi", | ||
111 | + "districtCode": "1014", | ||
112 | + "districtName": "บางบัวทอง/Bangbuathong", | ||
113 | + "subDistrictCode": "101401", | ||
114 | + "subDisstrictName": "บางรักพัฒนา/Bangrakpattana", | ||
115 | + "postalCode": "11110" | ||
116 | + }, | ||
117 | + "yearOfEstablishment": "1990", | ||
118 | + "authorizedCapital": "13000000", | ||
119 | + "createdBy": "Natnichh@gmail.com", | ||
120 | + "createdDate": "2020-08-31T09:13:30.326Z", | ||
121 | + "updatedBy": "Natnichh@gmail.com", | ||
122 | + "updatedDate": "2020-08-31T09:13:30.326Z" | ||
123 | + }, { | ||
124 | + "_id": "ifd0zgjzzbz", | ||
125 | + "taxId": "0101620010053", | ||
126 | + "titleId": "201", | ||
127 | + "title": "โครงการ", | ||
128 | + "companyNameEn": "provisioning pack", | ||
129 | + "companyNameTh": "โปรวิชชั่นนิง แพ็ค", | ||
130 | + "companyLogo": "Shiba.jpg", | ||
131 | + "files": [ | ||
132 | + { | ||
133 | + "fileId": "9GSI21SAEGy", | ||
134 | + "fileLabel": "สำเนาบัตรประชาชนผู้ทำรายการ", | ||
135 | + "fileValue": "ContactIdCard", | ||
136 | + "fileName": "9GSI21SAEGy.png" | ||
137 | + }, | ||
138 | + { | ||
139 | + "fileId": "jwgu2rnctcu", | ||
140 | + "fileLabel": "หนังสือรับรองบริษัท (อายุไม่เกิน 1 ปี) พร้อมประทับตราบริษัท", | ||
141 | + "fileValue": "Certificate", | ||
142 | + "fileName": "jwgu2rnctcu.jpg" | ||
143 | + } | ||
144 | + ], | ||
145 | + "businessType": [ | ||
146 | + { | ||
147 | + "_id": "9GSI21SAEGy", | ||
148 | + "businessTypeName": "B2C", | ||
149 | + "sortOrder": "1" | ||
150 | + }, | ||
151 | + { | ||
152 | + "_id": "jwgu2rnctcu", | ||
153 | + "businessTypeName": "B2B", | ||
154 | + "sortOrder": "2" | ||
155 | + } | ||
156 | + ], | ||
157 | + "businessTypeOther": "B2B2C", | ||
158 | + "businessIndustries": [ | ||
159 | + { | ||
160 | + "_id": "9GSI21SAEGy", | ||
161 | + "industryName": "Smart Office", | ||
162 | + "sortOrder": "1" | ||
163 | + }, | ||
164 | + { | ||
165 | + "_id": "jwgu2rnctcu", | ||
166 | + "industryName": "Smart Health", | ||
167 | + "sortOrder": "2" | ||
168 | + } | ||
169 | + ], | ||
170 | + "businessIndustryOther": "Education", | ||
171 | + "numberOfEmployee": "20", | ||
172 | + "socialChannels": [ | ||
173 | + { | ||
174 | + "socialChannelId": "Xuk6d43LvS5", | ||
175 | + "channel": "facebook", | ||
176 | + "link": "www.facebook.com" | ||
177 | + }, | ||
178 | + { | ||
179 | + "socialChannelId": "Zuk6d43LvS6", | ||
180 | + "channel": "instagram", | ||
181 | + "link": "www.instagram.com/dlwlrma" | ||
182 | + } | ||
183 | + ], | ||
184 | + "companyAddress": { | ||
185 | + "addressNo": "222/77", | ||
186 | + "moo": "1", | ||
187 | + "mooban": "Siri Place Rachaphuk-Rattanatibek", | ||
188 | + "soi": "5", | ||
189 | + "building": "D", | ||
190 | + "room": "1", | ||
191 | + "floor": "1", | ||
192 | + "street": "Rattanatibek", | ||
193 | + "provinceCode": "10", | ||
194 | + "provinceName": "นนทบุรี/Nonthaburi", | ||
195 | + "districtCode": "1014", | ||
196 | + "districtName": "บางบัวทอง/Bangbuathong", | ||
197 | + "subDistrictCode": "101401", | ||
198 | + "subDisstrictName": "บางรักพัฒนา/Bangrakpattana", | ||
199 | + "postalCode": "11110" | ||
200 | + }, | ||
201 | + "companyBillingAddress": { | ||
202 | + "addressNo": "222/77", | ||
203 | + "moo": "1", | ||
204 | + "mooban": "Siri Place Rachaphuk-Rattanatibek", | ||
205 | + "soi": "5", | ||
206 | + "building": "D", | ||
207 | + "room": "1", | ||
208 | + "floor": "1", | ||
209 | + "street": "Rattanatibek", | ||
210 | + "provinceCode": "10", | ||
211 | + "provinceName": "นนทบุรี/Nonthaburi", | ||
212 | + "districtCode": "1014", | ||
213 | + "districtName": "บางบัวทอง/Bangbuathong", | ||
214 | + "subDistrictCode": "101401", | ||
215 | + "subDisstrictName": "บางรักพัฒนา/Bangrakpattana", | ||
216 | + "postalCode": "11110" | ||
217 | + }, | ||
218 | + "yearOfEstablishment": "1990", | ||
219 | + "authorizedCapital": "13000000", | ||
220 | + "createdBy": "Natnichh@gmail.com", | ||
221 | + "createdDate": "2020-08-31T09:13:30.326Z", | ||
222 | + "updatedBy": "Natnichh@gmail.com", | ||
223 | + "updatedDate": "2020-08-31T09:13:30.326Z" | ||
224 | + } | ||
225 | + ] | ||
226 | + } | ||
227 | + | ||
228 | + res.send(response) | ||
229 | +} | ||
230 | + | ||
231 | +module.exports.contactPersons = async (req, res) => { | ||
232 | + console.log('===== GET contactPersons =====') | ||
233 | + console.log('url', req.originalUrl); | ||
234 | + console.log('headers', req.headers); | ||
235 | + console.log('query', req.query); | ||
236 | + console.log('params', req.params); | ||
237 | + console.log('body', req.body); | ||
238 | + | ||
239 | + let response = { | ||
240 | + "link": { | ||
241 | + "prev": "ip:port/partner/api/v1/contactperson-management/contactpersons?companyId=$companyId&contactFirstname=$contactFirstname&contactLastname=$contactLastname&idCardNo=$idCardNo&page=$page&limit=$limit&sortby=$sortby", | ||
242 | + "next": "ip:port/partner/api/v1/contactperson-management/contactpersons?companyId=$companyId&contactFirstname=$contactFirstname&contactLastname=$contactLastname&idCardNo=$idCardNo&page=$page&limit=$limit&sortby=$sortby" | ||
243 | + }, | ||
244 | + "meta": { | ||
245 | + "currentPage": 1, | ||
246 | + "totalPages": 1, | ||
247 | + "limit": 1 | ||
248 | + }, | ||
249 | + "total": 2, | ||
250 | + "results": [ | ||
251 | + { | ||
252 | + "_id": "ifd0zgjzzbw", | ||
253 | + "companyId": "15BYQiQOXff", | ||
254 | + "email": "aron.olson@gmail.com", | ||
255 | + "titleId": "002", | ||
256 | + "title": "Mr.", | ||
257 | + "contactFirstname": "Aron", | ||
258 | + "contactLastname": "Olson", | ||
259 | + "contactMobileNo": "0938871199", | ||
260 | + "contactBirthday": "20180302000000+0700", | ||
261 | + "idCardNo": "1250112345678", | ||
262 | + "listBy": "Non Grantee", | ||
263 | + "createdBy": "Natnichh@gmail.com", | ||
264 | + "createdDate": "2020-08-31T09:13:30.326Z", | ||
265 | + "updatedBy": "Natnichh@gmail.com", | ||
266 | + "updatedDate": "2020-08-31T09:13:30.326Z", | ||
267 | + "files": [ | ||
268 | + { | ||
269 | + "fileId": "9GSI21SAEGy", | ||
270 | + "fileLabel": "สำเนาบัตรประชาชนผู้ทำรายการ", | ||
271 | + "fileValue": "ContactIdCard", | ||
272 | + "fileName": "9GSI21SAEGy.png" | ||
273 | + } | ||
274 | + ] | ||
275 | + }, | ||
276 | + { | ||
277 | + "_id": "ifd0zgjzzbw", | ||
278 | + "companyId": "15BYQiQOXff", | ||
279 | + "email": "aron.olson@gmail.com", | ||
280 | + "titleId": "002", | ||
281 | + "title": "Mr.", | ||
282 | + "contactFirstname": "Aron", | ||
283 | + "contactLastname": "Olson", | ||
284 | + "contactMobileNo": "0938871199", | ||
285 | + "contactBirthday": "20180302000000+0700", | ||
286 | + "idCardNo": "1250112345678", | ||
287 | + "listBy": "Non Grantee", | ||
288 | + "createdBy": "Natnichh@gmail.com", | ||
289 | + "createdDate": "2020-08-31T09:13:30.326Z", | ||
290 | + "updatedBy": "Natnichh@gmail.com", | ||
291 | + "updatedDate": "2020-08-31T09:13:30.326Z", | ||
292 | + "files": [ | ||
293 | + { | ||
294 | + "fileId": "9GSI21SAEGy", | ||
295 | + "fileLabel": "สำเนาบัตรประชาชนผู้ทำรายการ", | ||
296 | + "fileValue": "ContactIdCard", | ||
297 | + "fileName": "9GSI21SAEGy.png" | ||
298 | + } | ||
299 | + ] | ||
300 | + } | ||
301 | + ] | ||
302 | + } | ||
303 | + | ||
304 | + res.send(response) | ||
305 | +} | ||
0 | \ No newline at end of file | 306 | \ No newline at end of file |