Advertisement
nubooya

Untitled

Dec 9th, 2021
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1.  
  2.  
  3. Format Date: YYYY-MM-DD
  4.  
  5. Schedule 1
  6. - Hit API ke MCCP dengan params:
  7. {
  8. "start_date": "",
  9. "end_date": ""
  10. }
  11. - Response API {
  12. "meta": {
  13. "limit": 10, --> JUmlah data per halaman
  14. "offset": 0,
  15. "page": 1,
  16. "total": 1,
  17. "total_page": 1, --> Jumlah banyaknya halaman
  18. "sort": [
  19. {
  20. "column": "created_at",
  21. "order": "desc"
  22. }
  23. ]
  24. }
  25. }
  26. - Insert Data ke log_schedule
  27. - table log_schedule {
  28. id uuid [pk] --> UUID
  29. log_start_date timestamptz --> Tanggal Proses sync
  30. log_end_date timestamptz --> Tanggal Proses sync
  31. log_info jsonb {
  32. "limit": 10,
  33. "page": 1,
  34. "total": 1,
  35. "total_page": 1,
  36. "current_page": 0
  37. }
  38. log_isrun: false
  39. log_iserror: false
  40. log_count: 0
  41. log_maxcount: 3
  42. log_response text --> jika ada error/success
  43. created_at timestamptz [not null, default: `CURRENT_TIMESTAMP`]
  44. updated_at timestamptz [not null, default: `CURRENT_TIMESTAMP`]
  45. }
  46.  
  47.  
  48. Schedule 2
  49. - Membaca table log_schedule
  50. - Check (log_isrun = false && log_iserror == false && total datanya > 0), jika true jalankan Schedule
  51. - JIka akses API MCCP ada Error (mati), maka sistem akan update log_count += 1
  52. - Jika log_count == log_maxcount, update log_iserror = true, log_response = "API tidak dapat di Akses"
  53.  
  54. - Jika API MCCP Running Well, sistem akan call API dengan params :
  55. {
  56. log_start_date: "",
  57. log_end_date: "",
  58. page: current_page+1
  59. limit: limit
  60. }
  61.  
  62. Looping sebanyak total_page {
  63. - Dapat response dari API MCCP
  64. - Looping Proses Insert/Update Data dari jumlah data API
  65. {
  66. Search data berdasarkan id pada table partner_catalogs
  67. if Found() {
  68. Update ke table partner_catalogs
  69. } else
  70. {
  71. Insert ke table partner_catalogs
  72. }
  73. }
  74. - Jika proses looping diatas telah selesai, call
  75. }
  76.  
  77.  
  78. - Jika proses looping diatas telah selesai, maka update log_isrun = true
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement