Skip to main content

JodGig Company Sync

Sync Process

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

JodGig Company Sync

We'll sync using upsert to ensure that newly created companies are migrated automatically to JodApp's Org::Company. We need to ensure we're not overwriting existing company in JodApp with data from JodGig

Sync Script

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

company_upserts = updated_companies.each do | updated_company |
JodGig::Company::AttributeService.execute(jodgig_company: updated_company)
end
Org::Company.upsert_all(
company_upserts,
unique_by: :remote_id,
record_timestamp: true
)

# write to Gig::SyncLog
...
end

Org Company Attributes

Org::CompanyJodGig::Company
idnull
parent_company_idnull
country_idhard code to Singapore's geo_country id in jodapp
namename
primary_addressaddress
postal_codeextract postal code from address
emailuse HQ user's email address if available, else use placeholder
website_urlwebsite_url
descriptiondescription
registration_noregistration_no
is_enabledstatus
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?
is_deleted_atdeleted_at
address_geo_area_iddetermine general geo_area based on address
uuidSecureRandom.uuid
logo_original_filenamecompany_logo_filename
logo_s3_pathgenerate_s3_path for jodgig bucket
logo_extension::File.extname(company_logo_filename)
slugslug
remote_idJodGig::Company's original d