Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions __tests__/common/profile/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ describe('UserExperienceType work import', () => {
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
flags: {},
customLocation: {
city: 'New York',
country: 'USA',
},
});
const skills = await con
.getRepository(UserExperienceSkill)
Expand Down Expand Up @@ -98,6 +102,10 @@ describe('UserExperienceType work import', () => {
userId: 'user-work-2',
verified: false,
flags: {},
customLocation: {
city: 'Wahkkauppp',
country: 'Mars',
},
});
});
});
Expand Down Expand Up @@ -134,6 +142,9 @@ describe('UserExperienceType education import', () => {
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
flags: {},
customLocation: {
country: 'Colombia',
},
});
});

Expand Down Expand Up @@ -167,6 +178,9 @@ describe('UserExperienceType education import', () => {
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
flags: {},
customLocation: {
country: 'NowhereLand',
},
});
});
});
Expand Down Expand Up @@ -205,6 +219,7 @@ describe('UserExperienceType certification import', () => {
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
flags: {},
customLocation: {},
});
});

Expand Down Expand Up @@ -241,6 +256,7 @@ describe('UserExperienceType certification import', () => {
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
flags: {},
customLocation: {},
});
});
});
Expand Down Expand Up @@ -280,6 +296,7 @@ describe('UserExperienceType project import', () => {
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
flags: {},
customLocation: {},
});
expect(skills.map((s) => s.value).sort()).toEqual(
['GraphQL', 'Node.js'].sort(),
Expand Down Expand Up @@ -316,6 +333,7 @@ describe('UserExperienceType project import', () => {
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
flags: {},
customLocation: {},
});
});
});
6 changes: 4 additions & 2 deletions src/common/profile/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const resolveUserLocationPart = async ({
} | null;
con: EntityManager;
threshold?: number;
}): Promise<Partial<Pick<UserExperience, 'locationId'>>> => {
}): Promise<Partial<Pick<UserExperience, 'locationId' | 'customLocation'>>> => {
if (!location) {
return {};
}
Expand Down Expand Up @@ -125,7 +125,9 @@ const resolveUserLocationPart = async ({
};
}

return {};
return {
customLocation: location,
};
};

export const importUserExperienceWork = async ({
Expand Down
7 changes: 7 additions & 0 deletions src/entity/user/experiences/UserExperience.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ export class UserExperience {
@Column({ type: 'text', default: null })
locationId: string | null;

@Column({ type: 'jsonb', default: {} })
customLocation: Partial<{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will expose this column and connect to frontend for readonly display on profile in different PR.

Copy link
Contributor Author

@capJavert capJavert Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write should always go to locationId

city: string | null;
subdivision: string | null;
country: string | null;
}>;

@ManyToOne('DatasetLocation', { lazy: true, onDelete: 'SET NULL' })
@JoinColumn({
name: 'locationId',
Expand Down
19 changes: 19 additions & 0 deletions src/migration/1764076115716-UserExperienceCustomLocation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class UserExperienceCustomLocation1764076115716
implements MigrationInterface
{
name = 'UserExperienceCustomLocation1764076115716';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_experience" ADD "customLocation" jsonb NOT NULL DEFAULT '{}'`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_experience" DROP COLUMN "customLocation"`,
);
}
}
Loading