feat: add user flags, profile experiences and autocomplete for profile interim#2944
feat: add user flags, profile experiences and autocomplete for profile interim#2944
Conversation
|
🍹 The Update (preview) for dailydotdev/api/prod (at 35ff63b) was successful. Resource Changes Name Type Operation
~ vpc-native-validate-active-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-current-streak-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generic-referral-reminder-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-hourly-notification-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-migration-14d5c9f5 kubernetes:batch/v1:Job create
~ vpc-native-bg-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-zombie-user-companies-cron kubernetes:batch/v1:CronJob update
~ vpc-native-check-analytics-report-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-stale-user-transactions-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generate-search-invites-cron kubernetes:batch/v1:CronJob update
~ vpc-native-sync-subscription-with-cio-cron kubernetes:batch/v1:CronJob update
~ vpc-native-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tag-recommendations-cron kubernetes:batch/v1:CronJob update
~ vpc-native-calculate-top-readers-cron kubernetes:batch/v1:CronJob update
~ vpc-native-ws-deployment kubernetes:apps/v1:Deployment update
- vpc-native-api-migration-c7950645 kubernetes:batch/v1:Job delete
~ vpc-native-update-tags-str-cron kubernetes:batch/v1:CronJob update
~ vpc-native-temporal-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-highlighted-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-gifted-plus-cron kubernetes:batch/v1:CronJob update
~ vpc-native-private-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-source-public-threshold-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-source-tag-view-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-trending-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-images-cron kubernetes:batch/v1:CronJob update
|
There was a problem hiding this comment.
Pull Request Overview
This PR implements a comprehensive user profile system with experience tracking and autocomplete functionality. It adds user experience entities for work, education, certifications, awards, publications, courses, and projects, along with job preferences and skills management. A new GraphQL autocomplete endpoint enables searching across various profile fields like job titles, companies, skills, and educational institutions.
- Introduces multiple user experience entity types with a hierarchical structure using TypeORM table inheritance
- Adds user job preferences with compensation tracking and work location preferences
- Implements a flexible autocomplete system supporting 10 different search types with proper validation
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/schema/profileAutocomplete.ts | Core autocomplete implementation with GraphQL schema, resolvers, and query mapping |
| src/graphql.ts | Registers the new autocomplete schema and resolvers with the GraphQL server |
| src/entity/user/experiences/*.ts | Defines experience entity hierarchy with base UserExperience and specialized child entities |
| src/entity/user/UserSkill.ts | User skills entity with auto-generated slug and many-to-many relationship to experiences |
| src/entity/user/UserJobPreferences.ts | Job preferences including compensation, location type, and role preferences |
| src/entity/user/User.ts | Extends User entity with new relationships and location flags |
| src/entity/Company.ts | Adds company type enum to distinguish between businesses and schools |
| tests/profileAutocomplete.ts | Comprehensive test suite covering validation, skills, job titles, and company autocomplete |
Comments suppressed due to low confidence (1)
src/entity/user/UserJobPreferences.ts:39
- The TODO comment references a different ticket (MI-958) than the one mentioned in the PR description (MI-953). This could cause confusion about which ticket handles the sensitive data protection.
// todo: never send this field to FE while implementing MI-953
src/schema/profileAutocomplete.ts
Outdated
| queryRunner.manager | ||
| .getRepository(entity) | ||
| .createQueryBuilder('entity') | ||
| .select(select ?? ['id', propertyName]) |
There was a problem hiding this comment.
The select clause uses propertyName directly which may not work correctly with TypeORM's select method. TypeORM expects column names prefixed with the alias. This should be entity.${propertyName} to match the query builder pattern.
| .select(select ?? ['id', propertyName]) | |
| .select(select ?? [`entity.id`, `entity.${propertyName}`]) |
src/schema/profileAutocomplete.ts
Outdated
| [AutocompleteType.CertificationName]: UserCertificationExperience; | ||
| [AutocompleteType.CertificationIssuer]: Company; | ||
| [AutocompleteType.AwardName]: UserAwardExperience; | ||
| [AutocompleteType.AwardIssuer]: UserAwardExperience; |
There was a problem hiding this comment.
The mapping for AwardIssuer points to UserAwardExperience but queries the 'issuer' field which is a string property, not a company entity. This is inconsistent with other issuer types like CertificationIssuer which correctly map to Company entity.
| [AutocompleteType.AwardIssuer]: UserAwardExperience; | |
| [AutocompleteType.AwardIssuer]: Company; |
| default: ExperienceStatus.Draft, | ||
| }) | ||
| status: ExperienceStatus; | ||
|
|
There was a problem hiding this comment.
The flags field lacks documentation explaining its purpose, expected structure, or usage patterns. Given its generic type, documentation would help developers understand what kind of flags can be stored.
| /** | |
| * A JSON object to store additional metadata or flags related to the user experience. | |
| * | |
| * This field is flexible and can store various key-value pairs. Examples of possible keys: | |
| * - "isFeatured": A boolean indicating if the experience is featured. | |
| * - "priority": A number representing the priority level of the experience. | |
| * - "tags": An array of strings for categorization or tagging. | |
| * | |
| * Developers should ensure that the keys and values stored in this field are consistent | |
| * with the application's requirements and properly validated before use. | |
| */ |
capJavert
left a comment
There was a problem hiding this comment.
Should be good to go once comments are addressed 👌
src/schema/profileAutocomplete.ts
Outdated
| queryRunner.manager | ||
| .getRepository(entity) | ||
| .createQueryBuilder('entity') | ||
| .select(select ?? ['id', propertyName]) |
src/schema/profileAutocomplete.ts
Outdated
| query, | ||
| limit, | ||
| hits: hits.map((hit) => ({ | ||
| __typename: typeNameByEntity[entity.name], |
There was a problem hiding this comment.
why do we need __typename?
There was a problem hiding this comment.
I've added one endpoint for Company, UserSkill and UserExperience.
GQL requires to add the typename in order to understand what I'm returning, I don't know how to avoid it (also linked to #2944 (comment) )
There was a problem hiding this comment.
Hmm this is weird, lets take a look tomorrow, I don't think we do this anywhere (at least not manually like this), I see __typename in some old parts of code but just on types not actual returns.
…lt value for description column
…953-profile-interim # Conflicts: # __tests__/profileAutocomplete.ts # src/migration/1753885628500-UserExperiences.ts
Added user profile user experiences, skills, flags, job preferences, and a new autocomplete endopoint.
Jira ticket
MI-953