feat: reimport opportunity mutation to easily update an existing opp#3393
feat: reimport opportunity mutation to easily update an existing opp#3393
Conversation
- Remove sections parameter from reimportOpportunity mutation - Update all opportunity fields (title, tldr, content, keywords) on reimport - Simplify updateOpportunityFromParsedData to not require section selection - Add API tests for reimportOpportunity mutation
|
🍹 The Update (preview) for dailydotdev/api/prod (at 0a7d51a) was successful. Resource Changes Name Type Operation
~ vpc-native-personalized-digest-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-sync-subscription-with-cio-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-images-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-gifted-plus-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generic-referral-reminder-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-db-migration-2e39b777 kubernetes:batch/v1:Job create
~ vpc-native-generate-search-invites-cron kubernetes:batch/v1:CronJob update
~ vpc-native-calculate-top-readers-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-trending-cron kubernetes:batch/v1:CronJob update
~ vpc-native-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-history-day-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-user-companies-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-ws-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-source-tag-view-cron kubernetes:batch/v1:CronJob update
~ vpc-native-bg-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-deployment kubernetes:apps/v1:Deployment update
- vpc-native-api-db-migration-340dda3a kubernetes:batch/v1:Job delete
~ vpc-native-temporal-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-stale-user-transactions-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-opportunities-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-private-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-hourly-notification-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-current-streak-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-updated-sync-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-highlighted-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-source-public-threshold-cron kubernetes:batch/v1:CronJob update
~ vpc-native-check-analytics-report-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tags-str-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-clickhouse-migration-340dda3a kubernetes:batch/v1:Job delete
~ vpc-native-validate-active-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-clickhouse-migration-2e39b777 kubernetes:batch/v1:Job create
~ vpc-native-update-tag-recommendations-cron kubernetes:batch/v1:CronJob update
|
| ...(content.overview && { overview: content.overview }), | ||
| ...(content.responsibilities && { | ||
| responsibilities: content.responsibilities, | ||
| }), | ||
| ...(content.requirements && { requirements: content.requirements }), | ||
| ...(content.whatYoullDo && { whatYoullDo: content.whatYoullDo }), | ||
| ...(content.interviewProcess && { | ||
| interviewProcess: content.interviewProcess, | ||
| }), |
There was a problem hiding this comment.
Maybe use object.keys to avoid manually changing code here if new keys are added to content
| } | ||
|
|
||
| // Update keywords if present in parsed data | ||
| if (parsedOpportunity.keywords?.length) { |
There was a problem hiding this comment.
we have handleOpportunityKeywordsUpdate, think it could work here?
| } | ||
|
|
||
| // Fetch and return the updated opportunity | ||
| return entityManager.getRepository(OpportunityJob).findOneOrFail({ |
There was a problem hiding this comment.
why do we need to fetch it here, and we then again fetch through gql, seems wasteful, just returning id would be ok here since nothing else is used.
|
@claude review the comments and fix the issues |
|
Claude finished @idoshamun's task in 2m 45s —— View job Reviewing and fixing code review comments ✅
SummaryI've successfully addressed all three code review comments: 1. Dynamic content field handling (line 409)
2. Reuse keyword update helper (line 420)
3. Avoid wasteful opportunity fetch (line 436)
All changes have been committed and pushed to the PR branch. |
- Use Object.keys() for dynamic content field handling instead of manual listing - Reuse handleOpportunityKeywordsUpdate helper function for keyword updates - Return only opportunity ID from updateOpportunityFromParsedData to avoid wasteful fetch 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Ido Shamun <idoshamun@users.noreply.github.com>
|
@claude you duplicated |
|
Claude finished @idoshamun's task in 2m 4s —— View job Fixing duplication and lint errors
SummarySuccessfully fixed the code duplication issue: Changes made:
The lint should now pass as there's only one implementation of the function, properly shared between both files. --- | View commit |
- Export handleOpportunityKeywordsUpdate from parse.ts - Remove duplicate implementation from opportunity.ts - Add best practices section to AGENTS.md about avoiding duplication Co-authored-by: Ido Shamun <idoshamun@users.noreply.github.com>
| translation: post.translation | ||
| ? Object.entries( | ||
| typeof post.translation === 'string' | ||
| ? JSON.parse(post.translation) | ||
| : post.translation, | ||
| ).reduce( | ||
| (acc, [key, value]) => { | ||
| acc[key] = decodeJsonField({ | ||
| value: value as JsonValue, | ||
| decoder: new Translation(), | ||
| }); | ||
|
|
||
| return acc; | ||
| }, | ||
| {} as { [key: string]: Translation }, | ||
| ) | ||
| : undefined, |
There was a problem hiding this comment.
@idoshamun you or 🇫🇷 reverted my code for translation in content updated? 😆 #3388
There was a problem hiding this comment.
There was a problem hiding this comment.
@capJavert sorry!! i thought it was a flaky test because didn't realized what it has to do with my PR and I saw flaky tests in the past 🙈 i'll be more careful
There was a problem hiding this comment.
don't worry I blame the 🇫🇷 not you 🤣
As part of the effort to make it easier for recruiters to manage opportunities, we're introducing a reimport mutation