RobertCzaja / it-offers-api

Analyzing IT job offers scraped from web job board (justjoin.it)
0 stars 0 forks source link

Migrate all offer salaries to PLN #44

Closed RobertCzaja closed 2 weeks ago

RobertCzaja commented 1 month ago

I've got that data in MongoDB. When there is no salary in PLN - just save null or recalculate it based on curse from external service.

  1. Create new table salary with columns:

    • id (UUID)
    • offer_id (UUID)
    • employment_type (string)
    • from (int)
    • to (int)
    • currency
    • is original
  2. ✅ Start saving salary in the new table (always stor PLN and in original currency) ✅ supposed to save only one isOriginal record for on OfferId

  3. ✅ Migrate to new salary structure all already saved Offers (added before adding that one)

  4. ✅ Start using new salary structure all over the repo 6.✅ Remove old salary fields from Offer entity

  5. ✅ Remove old salary columns from db offer table (salary_*)

RobertCzaja commented 1 month ago
RobertCzaja commented 1 month ago

Split to tickets that can be done in the next steps:

  1. https://github.com/RobertCzaja/it-offers/issues/46
  2. https://github.com/RobertCzaja/it-offers/issues/48
  3. https://github.com/RobertCzaja/it-offers/issues/49
  4. https://github.com/RobertCzaja/it-offers/issues/52
RobertCzaja commented 2 weeks ago

Fin out why that MongoDB query doesn't find related JJITOffers for a lot o Postgres Offers

@Query("{ $and: [ { \"offer.title\": ?0, \"offer.slug\": ?1, \"offer.companyName\": ?2,  \"offer.publishedAt\": ?3} ] }")
    List<JustJoinItRawOffer> findDuplicatedOffers(String title, String slug, String companyName, String publishedAt);

Because publishedAt dateTime was filled incorrectly

To fix in: https://github.com/RobertCzaja/it-offers/issues/52

RobertCzaja commented 2 weeks ago

Migration

2024-10-12T10:57:22.607Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Processed offers: 1000
2024-10-12T10:57:22.607Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Migrated offers: 537
2024-10-12T10:57:22.607Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Empty salaries: 462

2024-10-12T10:59:34.376Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Processed offers: 1000
2024-10-12T10:59:34.376Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Migrated offers: 332
2024-10-12T10:59:34.376Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Empty salaries: 667

2024-10-12T11:04:38.409Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Processed offers: 3377
2024-10-12T11:04:38.409Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Migrated offers: 1003
2024-10-12T11:04:38.409Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Empty salaries: 2374

2024-10-12T11:08:16.219Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Processed offers: 2374
2024-10-12T11:08:16.219Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Migrated offers: 0
2024-10-12T11:08:16.219Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Empty salaries: 2374

2024-10-12T11:11:37.521Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Processed offers: 2374
2024-10-12T11:11:37.521Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Migrated offers: 0
2024-10-12T11:11:37.521Z  INFO 1 --- [it-offers] [           main] o.u.c.MigrateOfferSalariesToNewFormatCli : Empty salaries: 2374

🟢 All Salaries successfully migrated 🟢

RobertCzaja commented 2 weeks ago

done