Skip to main content

JodGig Location Sync

Sync Process

we'll schedule the sync job to run DAILY and write it to Gig::SyncLog

JodGig Location Sync

We'll sync using upsert to ensure that newly created locations are migrated automatically to JodApp's Org::Outlet. Org::Outlet is simpler because this is a whole new table in JodApp so we can just sync it without checking whether data exists or not

Sync Script

...
# remember that JodGig's DB is using naive SGT time for it's datetime fields
updated_outlets = JodGig::Location.where(updated_at > last_updated_at)

outlet_upserts = updated_outlets.each do | updated_outlet |
JodGig::Location::AttributeService.execute(jodgig_location: updated_outlet)
end
Org::Outlet.upsert_all(
outlet_upserts,
unique_by: :remote_id,
record_timestamp: true
)

# write to Gig::SyncLog
...
end

Org Outlet Attributes

Org::OutletJodGig::Location
idnull
company_idOrg::Company id that have remote_id same as jodgig_locations.company_id
area_user_idnull
address_geo_area_idfind geo_area_id by checking which address_geo_area_id is located by comparing jodgig locations' lat,lon and geo_area's boundaries
slugslug
namename
addressaddress
postal_codepostal_code
latitudelatitude
longitudelongitude
logo_original_filenamelocation_logo_filename
logo_s3_pathgenerate s3 path from jodgig bucket + folder + location logo filename
logo_extension::File.extname(location_logo_filename)
is_activestatus
job_sourcejob_source
job_approval_requiredjob_approval_required\
create_template_onlycreate_template_only
auto_job_postingauto_job_posting
location_manager_can_create_joblocation_manager_can_create_job
job_credit_deductionjob_credit_deduction
is_credit_negative_validationis_credit_negative_validation
available_creditsavailable_credits
consumed_creditsconsumed_credits
min_credit_limitmin_credit_limit
raterate
created_bynull, @todo: update this after user is migrated
updated_bynull, @todo: update this after user is migrated
created_atcreated_at
updated_atupdated_at
is_deleteddeleted_at.present?
deleted_atdeleted_at
is_auto_select_applicantis_auto_select_applicant
remote_idJodGig::Location's original id