Commit c2912bec9418dad5994be518f092b967b0a07be7
1 parent
cdfd02d8
Exists in
master
and in
1 other branch
update mock d01
Showing
1 changed file
with
126 additions
and
10 deletions
Show diff stats
d01.js
| ... | ... | @@ -300,16 +300,17 @@ module.exports.getMasterMember = async (req, res) => { |
| 300 | 300 | let data = [] |
| 301 | 301 | |
| 302 | 302 | for (let i = 0; i < 30; i++) { |
| 303 | - data.push({ | |
| 304 | - "enterpriseId": "$enterpriseId", | |
| 305 | - "memberId": (i + 1), | |
| 306 | - "memberType": "$memberType", | |
| 307 | - "subMemberType": "$subMemberType", | |
| 308 | - "memberDescription": "$memberDescription", | |
| 309 | - "updatedBy": "$updatedBy", | |
| 310 | - "updatedDate": "$updatedDate", | |
| 311 | - "createdBy": "$createdBy", | |
| 312 | - "createdDate": "$createdDate" }) | |
| 303 | + data.push({ | |
| 304 | + "enterpriseId": "$enterpriseId", | |
| 305 | + "memberId": (i + 1), | |
| 306 | + "memberType": "$memberType", | |
| 307 | + "subMemberType": "$subMemberType", | |
| 308 | + "memberDescription": "$memberDescription", | |
| 309 | + "updatedBy": "$updatedBy", | |
| 310 | + "updatedDate": "$updatedDate", | |
| 311 | + "createdBy": "$createdBy", | |
| 312 | + "createdDate": "$createdDate" | |
| 313 | + }) | |
| 313 | 314 | } |
| 314 | 315 | |
| 315 | 316 | if (req.query.fields) { |
| ... | ... | @@ -493,4 +494,119 @@ module.exports.deleteGender = async (req, res) => { |
| 493 | 494 | } |
| 494 | 495 | |
| 495 | 496 | res.send(response) |
| 497 | +} | |
| 498 | + | |
| 499 | +module.exports.getAddressType = async (req, res) => { | |
| 500 | + console.log('===== GET AddressType =====') | |
| 501 | + console.log('url', req.originalUrl); | |
| 502 | + console.log('headers', req.headers); | |
| 503 | + console.log('query', req.query); | |
| 504 | + console.log('params', req.params); | |
| 505 | + | |
| 506 | + let data = [ | |
| 507 | + { | |
| 508 | + "enterpriseId": "$enterpriseId", | |
| 509 | + "addressTypeId": "1", | |
| 510 | + "addressType": "$addressType", | |
| 511 | + "typeName": "$typeName", | |
| 512 | + "createdBy": "$createdBy", | |
| 513 | + "createdDate": "$createdDate", | |
| 514 | + "updatedDate": "$updatedDate" | |
| 515 | + }, | |
| 516 | + { | |
| 517 | + "enterpriseId": "$enterpriseId", | |
| 518 | + "addressTypeId": "2", | |
| 519 | + "addressType": "$addressType", | |
| 520 | + "typeName": "$typeName", | |
| 521 | + "createdBy": "$createdBy", | |
| 522 | + "createdDate": "$createdDate", | |
| 523 | + "updatedDate": "$updatedDate" | |
| 524 | + }, | |
| 525 | + { | |
| 526 | + "enterpriseId": "$enterpriseId", | |
| 527 | + "addressTypeId": "3", | |
| 528 | + "addressType": "$addressType", | |
| 529 | + "typeName": "$typeName", | |
| 530 | + "createdBy": "$createdBy", | |
| 531 | + "createdDate": "$createdDate", | |
| 532 | + "updatedDate": "$updatedDate" | |
| 533 | + } | |
| 534 | + ] | |
| 535 | + | |
| 536 | + if (req.query.fields) { | |
| 537 | + let filteredFields = req.query.fields.split(',') | |
| 538 | + for (let d of data) { | |
| 539 | + for (key in d) { | |
| 540 | + if (!filteredFields.includes(key)) { | |
| 541 | + delete d[key] | |
| 542 | + } | |
| 543 | + } | |
| 544 | + } | |
| 545 | + } | |
| 546 | + | |
| 547 | + let resultData = data | |
| 548 | + | |
| 549 | + if (req.query.offset) { | |
| 550 | + resultData = resultData.slice(+req.query.offset) | |
| 551 | + } | |
| 552 | + | |
| 553 | + if (req.query.limit) { | |
| 554 | + resultData = resultData.slice(0, +req.query.limit) | |
| 555 | + } | |
| 556 | + | |
| 557 | + let response = { | |
| 558 | + "resultCode": "20000", | |
| 559 | + "resultDescription": "Success", | |
| 560 | + "resultData": resultData, | |
| 561 | + "rowCount": '' + data.length | |
| 562 | + } | |
| 563 | + res.send(response) | |
| 564 | +} | |
| 565 | + | |
| 566 | +module.exports.postAddressType = async (req, res) => { | |
| 567 | + console.log('===== POST AddressType =====') | |
| 568 | + console.log('url', req.originalUrl); | |
| 569 | + console.log('headers', req.headers); | |
| 570 | + console.log('query', req.query); | |
| 571 | + console.log('params', req.params); | |
| 572 | + console.log('body', req.body); | |
| 573 | + | |
| 574 | + let response = { | |
| 575 | + "resultCode": "20000", | |
| 576 | + "resultDescription": "Success" | |
| 577 | + } | |
| 578 | + | |
| 579 | + res.send(response) | |
| 580 | +} | |
| 581 | + | |
| 582 | +module.exports.putAddressType = async (req, res) => { | |
| 583 | + console.log('===== PUT AddressType =====') | |
| 584 | + console.log('url', req.originalUrl); | |
| 585 | + console.log('headers', req.headers); | |
| 586 | + console.log('query', req.query); | |
| 587 | + console.log('params', req.params); | |
| 588 | + console.log('body', req.body); | |
| 589 | + | |
| 590 | + let response = { | |
| 591 | + "resultCode": "20000", | |
| 592 | + "resultDescription": "Success" | |
| 593 | + } | |
| 594 | + | |
| 595 | + res.send(response) | |
| 596 | +} | |
| 597 | + | |
| 598 | +module.exports.deleteAddressType = async (req, res) => { | |
| 599 | + console.log('===== DELETE AddressType =====') | |
| 600 | + console.log('url', req.originalUrl); | |
| 601 | + console.log('headers', req.headers); | |
| 602 | + console.log('query', req.query); | |
| 603 | + console.log('params', req.params); | |
| 604 | + console.log('body', req.body); | |
| 605 | + | |
| 606 | + let response = { | |
| 607 | + "resultCode": "20000", | |
| 608 | + "resultDescription": "Success" | |
| 609 | + } | |
| 610 | + | |
| 611 | + res.send(response) | |
| 496 | 612 | } |
| 497 | 613 | \ No newline at end of file | ... | ... |