diff --git a/apps/web-api/prisma/fixtures/project.ts b/apps/web-api/prisma/fixtures/project.ts index e3d6148c0..bfca36b1f 100644 --- a/apps/web-api/prisma/fixtures/project.ts +++ b/apps/web-api/prisma/fixtures/project.ts @@ -46,6 +46,13 @@ const ProjectFactory = Factory.define>( createdBy: '', maintainingTeamUid: '', isFeatured: faker.datatype.boolean(), + highlightContent: [ + { + text: faker.lorem.words(4), + link: faker.internet.url(), + showInCardView: faker.datatype.boolean() + } + ], projectLinks: [{ name: faker.company.name(), url: faker.internet.url() diff --git a/apps/web-api/prisma/fixtures/teams.ts b/apps/web-api/prisma/fixtures/teams.ts index ce6baad2c..c09e92a8b 100644 --- a/apps/web-api/prisma/fixtures/teams.ts +++ b/apps/web-api/prisma/fixtures/teams.ts @@ -62,7 +62,14 @@ const teamsFactory = Factory.define>( createdAt: faker.date.past(), updatedAt: faker.date.recent(), fundingStageUid: null, - lastModifiedBy: null + lastModifiedBy: null, + highlightContent: [ + { + text: faker.lorem.words(4), + link: faker.internet.url(), + showInCardView: faker.datatype.boolean() + } + ], }; } ); diff --git a/apps/web-api/prisma/migrations/20250108055414_highlight_content_field/migration.sql b/apps/web-api/prisma/migrations/20250108055414_highlight_content_field/migration.sql new file mode 100644 index 000000000..04450ab0d --- /dev/null +++ b/apps/web-api/prisma/migrations/20250108055414_highlight_content_field/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable +ALTER TABLE "Project" ADD COLUMN "highlightContent" JSONB; + +-- AlterTable +ALTER TABLE "Team" ADD COLUMN "highlightContent" JSONB; diff --git a/apps/web-api/prisma/schema.prisma b/apps/web-api/prisma/schema.prisma index b2c7e6cf6..b4a818b18 100644 --- a/apps/web-api/prisma/schema.prisma +++ b/apps/web-api/prisma/schema.prisma @@ -49,6 +49,7 @@ model Team { teamFocusAreas TeamFocusArea[] teamFocusAreasVersionHistory TeamFocusAreaVersionHistory[] relatedQuestions DiscoveryQuestion[] @relation("TeamRelatedDiscoveryQuestions") + highlightContent Json? } model Member { @@ -349,6 +350,7 @@ model Project { projectFocusAreas ProjectFocusArea[] contributions ProjectContribution[] relatedQuestions DiscoveryQuestion[] @relation("ProjectRelatedDiscoveryQuestions") + highlightContent Json? } model PLEventLocation { diff --git a/apps/web-api/src/teams/__mocks__/teams.mocks.ts b/apps/web-api/src/teams/__mocks__/teams.mocks.ts index 9477e28d8..dab747323 100644 --- a/apps/web-api/src/teams/__mocks__/teams.mocks.ts +++ b/apps/web-api/src/teams/__mocks__/teams.mocks.ts @@ -1,5 +1,5 @@ import { faker } from '@faker-js/faker'; -import { FundingStage, Team } from '@prisma/client'; +import { FundingStage, Prisma, Team } from '@prisma/client'; import { Factory } from 'fishery'; import { prisma } from '../../../prisma/__mocks__/index'; import { TestFactorySeederParams } from '../../utils/factory-interfaces'; @@ -23,7 +23,7 @@ async function createFundingStage() { export async function createTeam({ amount }: TestFactorySeederParams) { const fundingStage = await createFundingStage(); - const teamFactory = Factory.define>(({ sequence }) => { + const teamFactory = Factory.define>(({ sequence }) => { const team = { uid: `uid-${sequence}`, name: `Team ${sequence}`, @@ -44,8 +44,9 @@ export async function createTeam({ amount }: TestFactorySeederParams) { createdAt: new Date(), updatedAt: new Date(), fundingStageUid: fundingStage.uid, - lastModifiedBy: null - }; + lastModifiedBy: null, + highlightContent: {}, + } as Prisma.TeamCreateManyInput; return team; }); diff --git a/apps/web-api/src/teams/teams.service.ts b/apps/web-api/src/teams/teams.service.ts index d633289d8..8cdcce99a 100644 --- a/apps/web-api/src/teams/teams.service.ts +++ b/apps/web-api/src/teams/teams.service.ts @@ -265,7 +265,7 @@ export class TeamsService { 'name', 'blog', 'contactMethod', 'twitterHandler', 'linkedinHandler', 'telegramHandler', 'officeHours', 'shortDescription', 'website', 'airtableRecId', - 'longDescription', 'moreDetails' + 'longDescription', 'moreDetails', 'highlightContent' ]; copyObj(teamData, team, directFields); // Handle one-to-one or one-to-many mappings diff --git a/libs/contracts/src/schema/project.ts b/libs/contracts/src/schema/project.ts index 8143e7ca5..8a7912c19 100644 --- a/libs/contracts/src/schema/project.ts +++ b/libs/contracts/src/schema/project.ts @@ -30,6 +30,7 @@ const ProjectSchema = z.object({ name: z.string(), url: z.string() }).array().optional(), + highlightContent: z.object({text: z.string(),link:z.string(),showInCardView:z.boolean()}).array().optional(), kpis: z.object({ key: z.string(), value: z.string() diff --git a/libs/contracts/src/schema/team.ts b/libs/contracts/src/schema/team.ts index 552795c72..9f13f18db 100644 --- a/libs/contracts/src/schema/team.ts +++ b/libs/contracts/src/schema/team.ts @@ -29,6 +29,7 @@ export const TeamSchema = z.object({ fundingStageUid: z.string().nullish(), linkedinHandler: z.string().nullish(), officeHours: z.string().nullish(), + highlightContent: z.object({text: z.string(),link:z.string(),showInCardView:z.boolean()}).array().optional() }); export const CreateTeamSchema = TeamSchema.pick({