Skip to content

Commit

Permalink
fix(projects): removed bug caused by project investors removal
Browse files Browse the repository at this point in the history
  • Loading branch information
AndySakov committed Nov 20, 2024
1 parent 8f93ba8 commit fa6419e
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { GoogleBigQueryModule } from "./google-bigquery/google-bigquery.module";
import { SearchModule } from "./search/search.module";
import { PaymentsModule } from "./payments/payments.module";
import { UserModule } from "./user/user.module";
import { Auth0Module } from './auth0/auth0.module';
import { Auth0Module } from "./auth0/auth0.module";

@Module({
imports: [
Expand Down
5 changes: 2 additions & 3 deletions src/projects/projects.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
RawProjectWebsite,
ResponseWithOptionalData,
Jobsite,
Investor,
} from "src/shared/types";
import { CustomLogger } from "src/shared/utils/custom-logger";
import * as Sentry from "@sentry/node";
Expand Down Expand Up @@ -132,6 +133,7 @@ export class ProjectsService {
orgNames: string[];
communities: string[];
aliases: string[];
investors: Investor[];
},
): boolean => {
const isValidSearchResult =
Expand Down Expand Up @@ -560,7 +562,6 @@ export class ProjectsService {
"chains",
"ecosystems",
"jobs",
"investors",
"repos",
"communities",
],
Expand Down Expand Up @@ -651,7 +652,6 @@ export class ProjectsService {
| "chains"
| "ecosystems"
| "jobs"
| "investors"
| "repos"
| "communities"
>
Expand All @@ -678,7 +678,6 @@ export class ProjectsService {
"chains",
"ecosystems",
"jobs",
"investors",
"repos",
"communities",
],
Expand Down
12 changes: 0 additions & 12 deletions src/shared/entities/all-jobs-list-result.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,6 @@ export class AllOrgJobsListResultEntity {
};
}) ?? [],
repos: project?.repos?.map(repo => ({ ...repo })) ?? [],
investors: Array.from(
uniqBy(
project?.investors ??
organization?.investors?.map(investor => ({
id: investor.id,
name: investor.name,
normalizedName: investor.normalizedName,
})) ??
[],
"id",
),
),
})) ?? [],
fundingRounds:
organization?.fundingRounds
Expand Down
12 changes: 0 additions & 12 deletions src/shared/entities/job-details.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,6 @@ export class JobDetailsEntity {
};
}) ?? [],
repos: project?.repos?.map(repo => ({ ...repo })) ?? [],
investors: Array.from(
uniqBy(
project?.investors ??
organization?.investors?.map(investor => ({
id: investor.id,
name: investor.name,
normalizedName: investor.normalizedName,
})) ??
[],
"id",
),
),
})) ?? [],
fundingRounds:
organization?.fundingRounds
Expand Down
12 changes: 0 additions & 12 deletions src/shared/entities/job-list-result.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,6 @@ export class JobListResultEntity {
};
}) ?? [],
repos: project?.repos?.map(repo => ({ ...repo })) ?? [],
investors: Array.from(
uniqBy(
project?.investors ??
organization?.investors?.map(investor => ({
id: investor.id,
name: investor.name,
normalizedName: investor.normalizedName,
})) ??
[],
"id",
),
),
})) ?? [],
fundingRounds:
organization?.fundingRounds
Expand Down
12 changes: 0 additions & 12 deletions src/shared/entities/org-details-result.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,6 @@ export class OrgDetailsResultEntity {
};
}) ?? [],
repos: project?.repos?.map(repo => ({ ...repo })) ?? [],
investors: Array.from(
uniqBy(
project?.investors ??
organization?.investors?.map(investor => ({
id: investor.id,
name: investor.name,
normalizedName: investor.normalizedName,
})) ??
[],
"id",
),
),
})) ?? [],
fundingRounds:
fundingRounds?.map(fr => ({
Expand Down
2 changes: 0 additions & 2 deletions src/shared/entities/organization-with-links.entity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { OrganizationWithLinks } from "../interfaces";
import { nonZeroOrNull, notStringOrNull } from "../helpers";
import { isAfter, isBefore } from "date-fns";
import { uniqBy } from "lodash";

export class OrganizationWithLinksEntity {
constructor(private readonly raw: OrganizationWithLinks) {}
Expand Down Expand Up @@ -120,7 +119,6 @@ export class OrganizationWithLinksEntity {
};
}) ?? [],
repos: project?.repos?.map(repo => ({ ...repo })) ?? [],
investors: Array.from(uniqBy(project?.investors ?? [], "id")),
})) ?? [],
communities: communities ?? [],
websites: websites ?? [],
Expand Down
21 changes: 0 additions & 21 deletions src/shared/entities/project.entity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { nonZeroOrNull, notStringOrNull } from "../helpers";
import { ProjectWithBaseRelations, ProjectWithRelations } from "../interfaces";
import { Node } from "neo4j-driver";
import { uniqBy } from "lodash";

export class ProjectWithBaseRelationsEntity {
constructor(private readonly raw: ProjectWithBaseRelations) {}
Expand Down Expand Up @@ -55,16 +54,6 @@ export class ProjectWithBaseRelationsEntity {
...chain,
logo: notStringOrNull(chain?.logo),
})) ?? [],
investors: Array.from(
uniqBy(
project?.investors?.map(investor => ({
id: investor.id,
name: investor.name,
normalizedName: investor.normalizedName,
})) ?? [],
"id",
),
),
jobs: project?.jobs ?? [],
repos: project?.repos ?? [],
description: notStringOrNull(project?.description),
Expand Down Expand Up @@ -125,16 +114,6 @@ export class ProjectWithRelationsEntity {
...chain,
logo: notStringOrNull(chain?.logo),
})) ?? [],
investors: Array.from(
uniqBy(
project?.investors?.map(investor => ({
id: investor.id,
name: investor.name,
normalizedName: investor.normalizedName,
})) ?? [],
"id",
),
),
jobs: project?.jobs ?? [],
repos: project?.repos ?? [],
description: notStringOrNull(project?.description),
Expand Down
9 changes: 0 additions & 9 deletions src/shared/interfaces/project-details-result.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ export class OrgProject extends ProjectMoreInfo {
jobs: t.array(
StructuredJobpostWithRelations.StructuredJobpostWithRelationsType,
),
investors: t.array(Investor.InvestorType),
repos: t.array(Repository.RepositoryType),
}),
]);
Expand Down Expand Up @@ -235,12 +234,6 @@ export class OrgProject extends ProjectMoreInfo {
})
jobs: StructuredJobpostWithRelations[];

@ApiProperty({
type: "array",
items: { $ref: getSchemaPath(Investor) },
})
investors: Investor[];

@ApiProperty({
type: "array",
items: { $ref: getSchemaPath(StructuredJobpostWithRelations) },
Expand All @@ -261,7 +254,6 @@ export class OrgProject extends ProjectMoreInfo {
chains,
ecosystems,
jobs,
investors,
repos,
...projectProperties
} = raw;
Expand All @@ -282,7 +274,6 @@ export class OrgProject extends ProjectMoreInfo {
this.chains = chains;
this.ecosystems = ecosystems;
this.jobs = jobs;
this.investors = investors;
this.repos = repos;

if (isLeft(result)) {
Expand Down

0 comments on commit fa6419e

Please sign in to comment.