From 4fe2ccccfab5b265c49441d2cd9316e336be72a2 Mon Sep 17 00:00:00 2001 From: Nattapon Wongpaet Date: Thu, 27 Jul 2023 15:12:37 +0700 Subject: [PATCH] update sgl api --- account-api.js | 2 +- app.js | 2 ++ company-api.js | 305 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 308 insertions(+), 1 deletion(-) create mode 100644 company-api.js diff --git a/account-api.js b/account-api.js index f78ed4e..a738a00 100644 --- a/account-api.js +++ b/account-api.js @@ -27,7 +27,7 @@ module.exports.accountPayables = async (req, res) => { "tradingPartner": "", "branch": "00000", "taxId": "0105556143098", - "memberId": "75EzpNZ0Twt", + "memberId": "BKAz9K097bT", "createdBy": "System", "createdDate": "2022-06-20T08:52:08.655Z", "updatedBy": "System", diff --git a/app.js b/app.js index 1cd6427..2dd0c98 100644 --- a/app.js +++ b/app.js @@ -456,6 +456,8 @@ app.post('/api/authen/application', require('./cmsp-authen').authen); app.post('/graphql', require('./cirr').graphql); app.get('/sgl/api/v1/accounting-management/accountpayables', require('./account-api').accountPayables); +app.get('/sgl/api/v1/company-management/companies', require('./company-api').getCompanies); +app.get('/sgl/api/v1/company-management/contactpersons', require('./company-api').contactPersons); app.get('/api/random/leader', function (req, res) { const months = ["เกมส์", "โน๊ต setup", "โน๊ต วัศรุต", "แบงค์", "มอส", "ปิ๊ค", "เต้นพอไม่ต้องตื่น", "เปา", "นัท", "kik", "new", "ann","na", "boky", "eve", "miki", "pla", "sugar"]; diff --git a/company-api.js b/company-api.js new file mode 100644 index 0000000..2470c5f --- /dev/null +++ b/company-api.js @@ -0,0 +1,305 @@ + +module.exports.getCompanies = async (req, res) => { + console.log('===== GET getCompanies =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', req.body); + + let response = { + "link": { + "prev": "ip:port/partner/api/v1/Companies?taxId=$taxId&keyword=$keyword&page=$page&limit=$limit&sortby=$sortby", + "next": "ip:port/partner/api/v1/Companies?taxId=$taxId&keyword=$keyword&page=$page&limit=$limit&sortby=$sortby" + }, + "meta": { + "currentPage": 1, + "totalPages": 1, + "limit": 1 + }, + "total": 2, + "results": [ + { + "_id": "ifd0zgjzzbw", + "taxId": "0101620010053", + "titleId": "201", + "title": "โครงการ", + "companyNameEn": "provisioning pack", + "companyNameTh": "โปรวิชชั่นนิง แพ็ค", + "companyLogo": "Shiba.jpg", + "files": [ + { + "fileId": "9GSI21SAEGy", + "fileLabel": "สำเนาบัตรประชาชนผู้ทำรายการ", + "fileValue": "ContactIdCard", + "fileName": "9GSI21SAEGy.png" + }, + { + "fileId": "jwgu2rnctcu", + "fileLabel": "หนังสือรับรองบริษัท (อายุไม่เกิน 1 ปี) พร้อมประทับตราบริษัท", + "fileValue": "Certificate", + "fileName": "jwgu2rnctcu.jpg" + } + ], + "businessType": [ + { + "_id": "9GSI21SAEGy", + "businessTypeName": "B2C", + "sortOrder": "1" + }, + { + "_id": "jwgu2rnctcu", + "businessTypeName": "B2B", + "sortOrder": "2" + } + ], + "businessTypeOther": "B2B2C", + "businessIndustries": [ + { + "_id": "9GSI21SAEGy", + "industryName": "Smart Office", + "sortOrder": "1" + }, + { + "_id": "jwgu2rnctcu", + "industryName": "Smart Health", + "sortOrder": "2" + } + ], + "businessIndustryOther": "Education", + "numberOfEmployee": "20", + "socialChannels": [ + { + "socialChannelId": "Xuk6d43LvS5", + "channel": "facebook", + "link": "www.facebook.com" + }, + { + "socialChannelId": "Zuk6d43LvS6", + "channel": "instagram", + "link": "www.instagram.com/dlwlrma" + } + ], + "companyAddress": { + "addressNo": "222/77", + "moo": "1", + "mooban": "Siri Place Rachaphuk-Rattanatibek", + "soi": "5", + "building": "D", + "room": "1", + "floor": "1", + "street": "Rattanatibek", + "provinceCode": "10", + "provinceName": "นนทบุรี/Nonthaburi", + "districtCode": "1014", + "districtName": "บางบัวทอง/Bangbuathong", + "subDistrictCode": "101401", + "subDisstrictName": "บางรักพัฒนา/Bangrakpattana", + "postalCode": "11110" + }, + "companyBillingAddress": { + "addressNo": "222/77", + "moo": "1", + "mooban": "Siri Place Rachaphuk-Rattanatibek", + "soi": "5", + "building": "D", + "room": "1", + "floor": "1", + "street": "Rattanatibek", + "provinceCode": "10", + "provinceName": "นนทบุรี/Nonthaburi", + "districtCode": "1014", + "districtName": "บางบัวทอง/Bangbuathong", + "subDistrictCode": "101401", + "subDisstrictName": "บางรักพัฒนา/Bangrakpattana", + "postalCode": "11110" + }, + "yearOfEstablishment": "1990", + "authorizedCapital": "13000000", + "createdBy": "Natnichh@gmail.com", + "createdDate": "2020-08-31T09:13:30.326Z", + "updatedBy": "Natnichh@gmail.com", + "updatedDate": "2020-08-31T09:13:30.326Z" + }, { + "_id": "ifd0zgjzzbz", + "taxId": "0101620010053", + "titleId": "201", + "title": "โครงการ", + "companyNameEn": "provisioning pack", + "companyNameTh": "โปรวิชชั่นนิง แพ็ค", + "companyLogo": "Shiba.jpg", + "files": [ + { + "fileId": "9GSI21SAEGy", + "fileLabel": "สำเนาบัตรประชาชนผู้ทำรายการ", + "fileValue": "ContactIdCard", + "fileName": "9GSI21SAEGy.png" + }, + { + "fileId": "jwgu2rnctcu", + "fileLabel": "หนังสือรับรองบริษัท (อายุไม่เกิน 1 ปี) พร้อมประทับตราบริษัท", + "fileValue": "Certificate", + "fileName": "jwgu2rnctcu.jpg" + } + ], + "businessType": [ + { + "_id": "9GSI21SAEGy", + "businessTypeName": "B2C", + "sortOrder": "1" + }, + { + "_id": "jwgu2rnctcu", + "businessTypeName": "B2B", + "sortOrder": "2" + } + ], + "businessTypeOther": "B2B2C", + "businessIndustries": [ + { + "_id": "9GSI21SAEGy", + "industryName": "Smart Office", + "sortOrder": "1" + }, + { + "_id": "jwgu2rnctcu", + "industryName": "Smart Health", + "sortOrder": "2" + } + ], + "businessIndustryOther": "Education", + "numberOfEmployee": "20", + "socialChannels": [ + { + "socialChannelId": "Xuk6d43LvS5", + "channel": "facebook", + "link": "www.facebook.com" + }, + { + "socialChannelId": "Zuk6d43LvS6", + "channel": "instagram", + "link": "www.instagram.com/dlwlrma" + } + ], + "companyAddress": { + "addressNo": "222/77", + "moo": "1", + "mooban": "Siri Place Rachaphuk-Rattanatibek", + "soi": "5", + "building": "D", + "room": "1", + "floor": "1", + "street": "Rattanatibek", + "provinceCode": "10", + "provinceName": "นนทบุรี/Nonthaburi", + "districtCode": "1014", + "districtName": "บางบัวทอง/Bangbuathong", + "subDistrictCode": "101401", + "subDisstrictName": "บางรักพัฒนา/Bangrakpattana", + "postalCode": "11110" + }, + "companyBillingAddress": { + "addressNo": "222/77", + "moo": "1", + "mooban": "Siri Place Rachaphuk-Rattanatibek", + "soi": "5", + "building": "D", + "room": "1", + "floor": "1", + "street": "Rattanatibek", + "provinceCode": "10", + "provinceName": "นนทบุรี/Nonthaburi", + "districtCode": "1014", + "districtName": "บางบัวทอง/Bangbuathong", + "subDistrictCode": "101401", + "subDisstrictName": "บางรักพัฒนา/Bangrakpattana", + "postalCode": "11110" + }, + "yearOfEstablishment": "1990", + "authorizedCapital": "13000000", + "createdBy": "Natnichh@gmail.com", + "createdDate": "2020-08-31T09:13:30.326Z", + "updatedBy": "Natnichh@gmail.com", + "updatedDate": "2020-08-31T09:13:30.326Z" + } + ] + } + + res.send(response) +} + +module.exports.contactPersons = async (req, res) => { + console.log('===== GET contactPersons =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', req.body); + + let response = { + "link": { + "prev": "ip:port/partner/api/v1/contactperson-management/contactpersons?companyId=$companyId&contactFirstname=$contactFirstname&contactLastname=$contactLastname&idCardNo=$idCardNo&page=$page&limit=$limit&sortby=$sortby", + "next": "ip:port/partner/api/v1/contactperson-management/contactpersons?companyId=$companyId&contactFirstname=$contactFirstname&contactLastname=$contactLastname&idCardNo=$idCardNo&page=$page&limit=$limit&sortby=$sortby" + }, + "meta": { + "currentPage": 1, + "totalPages": 1, + "limit": 1 + }, + "total": 2, + "results": [ + { + "_id": "ifd0zgjzzbw", + "companyId": "15BYQiQOXff", + "email": "aron.olson@gmail.com", + "titleId": "002", + "title": "Mr.", + "contactFirstname": "Aron", + "contactLastname": "Olson", + "contactMobileNo": "0938871199", + "contactBirthday": "20180302000000+0700", + "idCardNo": "1250112345678", + "listBy": "Non Grantee", + "createdBy": "Natnichh@gmail.com", + "createdDate": "2020-08-31T09:13:30.326Z", + "updatedBy": "Natnichh@gmail.com", + "updatedDate": "2020-08-31T09:13:30.326Z", + "files": [ + { + "fileId": "9GSI21SAEGy", + "fileLabel": "สำเนาบัตรประชาชนผู้ทำรายการ", + "fileValue": "ContactIdCard", + "fileName": "9GSI21SAEGy.png" + } + ] + }, + { + "_id": "ifd0zgjzzbw", + "companyId": "15BYQiQOXff", + "email": "aron.olson@gmail.com", + "titleId": "002", + "title": "Mr.", + "contactFirstname": "Aron", + "contactLastname": "Olson", + "contactMobileNo": "0938871199", + "contactBirthday": "20180302000000+0700", + "idCardNo": "1250112345678", + "listBy": "Non Grantee", + "createdBy": "Natnichh@gmail.com", + "createdDate": "2020-08-31T09:13:30.326Z", + "updatedBy": "Natnichh@gmail.com", + "updatedDate": "2020-08-31T09:13:30.326Z", + "files": [ + { + "fileId": "9GSI21SAEGy", + "fileLabel": "สำเนาบัตรประชาชนผู้ทำรายการ", + "fileValue": "ContactIdCard", + "fileName": "9GSI21SAEGy.png" + } + ] + } + ] + } + + res.send(response) +} \ No newline at end of file -- libgit2 0.21.2