Search code examples
google-bigquerygoogle-cloud-functionsgoogle-tag-manager

How to store and serve coupons with Google tools and javascript


I'll get a list of coupons by mail. That needs to be stored somewhere somehow (bigquery?) where I can request and send it to the user. The user should only be able to get 1 unique code, that was not used beforehand.

I need the ability to get a code and write, that it was used, so the next request gets the next code...

I know it is a completely vague question but I'm not sure how to implement that, anyone has any ideas?

thanks in advance


Solution

  • Thr can be multiples solution for same requirement, one of them is given below :-

    Step 1. Try to get coupons over a file (CSV, JSON, and etc) as per your preference/requirement.

    Step 2. Load Source file to GCS (storage).

    Step 3. Write a Dataflow code which read data from GCS (file) an load data to a different Bigquery table (tentative name: New_data). Sample code.

    Step 4. Create a Dataflow code to read data from Bigquery table New_data and compare it with History_data and identify new coupons and write data to a file on GCS or Bigquery table. Sample code.

    Step 5. Schedule entire process over an orchestrator/Cloud scheduler/Cron tab job.

    Step 6. Once you have data you can send it to consumers through any communication channel.