# Tools and Lambdas for Datafy

# Dump Remote

## PostGres
pg_dump -h aws-0-eu-central-1.pooler.supabase.com -p 6543 -d postgres -U postgres.natpyffafbqetnbeoctm -F c -b -v -f /tmp/remote_db_backup.dump

## Supabase - Schema
npx supabase db dump -f schema.sql
## Supabase - Data
npx supabase db dump --data-only -f schema_data.sql

# Restore local
## PostGres - Schema
psql -h localhost -p 54322 -U postgres -d postgres -a -f schema.sql 
## PostGres - Data
psql -h localhost -p 54322 -U postgres -d postgres -a -f schema_data.sql


# System importing
## SJ Report (Spinning Jenny Report)
## /file_processing/
### Callsheet / schedule is uploaded once a month and contains details of the reps and is added to table.
datafy_lambda\file_processing\1_parse_callsheet_files.js
### Once a week uploaded by client , this and runs code after the file is uploaded from frontend
datafy_lambda\file_processing\2_parse_sjreport_files.js
datafy_lambda\file_processing\signup_users.js

### After any of these files is uploaded task_parse script is run , to build tasks per store per user
datafy_lambda\file_processing\3_parse_task.js

### Store parse file is executed when uploaded
datafy_lambda\file_processing\parse_store_files.js

### Store products parse
datafy_lambda\file_processing\parse_store_product_files.js




