Skip to content

Commit

Permalink
fix(orgs): updated org interface to use new leaner project interface
Browse files Browse the repository at this point in the history
  • Loading branch information
AndySakov committed Nov 19, 2024
1 parent 6caa12f commit 903d414
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/shared/interfaces/org-details-result.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class OrgDetailsResult extends Organization {
type: "array",
items: { $ref: getSchemaPath(ProjectWithRelations) },
})
projects: Omit<ProjectWithRelations, "detectedJobsites" | "jobsites">[];
projects: OrgProject[];

@ApiProperty({
type: "array",
Expand Down
38 changes: 5 additions & 33 deletions src/shared/interfaces/organization.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ import { FundingRound } from "./funding-round.interface";
import { Investor } from "./investor.interface";
import { isLeft } from "fp-ts/lib/Either";
import { report } from "io-ts-human-reporter";
import { ProjectWithRelations } from "./project-with-relations.interface";
import { ProjectWithBaseRelations } from "./project-with-relations.interface";
import { OrgReview } from "./org-review.interface";
import { OrgRating } from "./org-ratings.interface";
import { Audit } from "./audit.interface";
import { Hack } from "./hack.interface";
import { Repository } from "./repository.interface";
import { StructuredJobpostWithRelations } from "./structured-jobpost-with-relations.interface";
import { Chain } from "./chain.interface";
import { ProjectMoreInfo } from "./project-more-info.interface";

export class Organization {
public static readonly OrganizationType = t.strict({
Expand Down Expand Up @@ -106,7 +100,7 @@ export class Organization {
}
}

@ApiExtraModels(ProjectWithRelations, FundingRound)
@ApiExtraModels(ProjectWithBaseRelations, FundingRound)
export class OrganizationWithRelations extends Organization {
public static readonly OrganizationWithRelationsType = t.intersection([
Organization.OrganizationType,
Expand All @@ -121,29 +115,7 @@ export class OrganizationWithRelations extends Organization {
aliases: t.array(t.string),
twitter: t.union([t.string, t.null]),
docs: t.union([t.string, t.null]),
projects: t.array(
t.intersection([
ProjectMoreInfo.ProjectMoreInfoType,
t.strict({
github: t.union([t.string, t.null]),
website: t.union([t.string, t.null]),
docs: t.union([t.string, t.null]),
category: t.union([t.string, t.null]),
twitter: t.union([t.string, t.null]),
discord: t.union([t.string, t.null]),
telegram: t.union([t.string, t.null]),
hacks: t.array(Hack.HackType),
audits: t.array(Audit.AuditType),
chains: t.array(Chain.ChainType),
ecosystems: t.array(t.string),
jobs: t.array(
StructuredJobpostWithRelations.StructuredJobpostWithRelationsType,
),
investors: t.array(Investor.InvestorType),
repos: t.array(Repository.RepositoryType),
}),
]),
),
projects: t.array(ProjectWithBaseRelations.ProjectWithBaseRelationsType),
fundingRounds: t.array(FundingRound.FundingRoundType),
investors: t.array(Investor.InvestorType),
community: t.array(t.string),
Expand Down Expand Up @@ -194,9 +166,9 @@ export class OrganizationWithRelations extends Organization {

@ApiProperty({
type: "array",
items: { $ref: getSchemaPath(ProjectWithRelations) },
items: { $ref: getSchemaPath(ProjectWithBaseRelations) },
})
projects: Omit<ProjectWithRelations, "detectedJobsites" | "jobsites">[];
projects: ProjectWithBaseRelations[];

@ApiProperty({
type: "array",
Expand Down

0 comments on commit 903d414

Please sign in to comment.