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
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,8 @@ CLOUDFRONT_PROJECT_SHOWCASE_MEDIA_PRIVATE_KEY=""
CLOUDFRONT_PROJECT_SHOWCASE_MEDIA_PUBLIC_KEY=""
CLOUDFRONT_PROJECT_SHOWCASE_MEDIA_KEY_PAIR_ID=""
CLOUDFRONT_PROJECT_SHOWCASE_MEDIA_URL_EXPIRATION=""

CHALLENGES_DB_URL=""
MEMBERS_DB_URL=""
RESOURCES_DB_URL=""
SKILLS_DB_URL=""
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
"@nestjs/swagger": "^11.0.3",
"@prisma/adapter-pg": "7.4.0",
"@prisma/client": "7.4.0",
"@topcoder/challenge-api-v6": "github:topcoder-platform/challenge-api-v6#prisma-client",
"@topcoder/member-api-v6": "github:topcoder-platform/member-api-v6#prisma-client",
"@topcoder/resource-api-v6": "github:topcoder-platform/resource-api-v6#prisma-client",
"@topcoder/standardized-skills-api": "github:topcoder-platform/standardized-skills-api#prisma-client",
"axios": "^1.13.5",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
Expand Down
5,123 changes: 5,056 additions & 67 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Add publishedAt, publishedBy, and alt to project showcase posts and media
ALTER TABLE projects."project_showcase_posts"
ADD COLUMN "publishedAt" TIMESTAMP(3),
ADD COLUMN "publishedBy" INTEGER;

ALTER TABLE projects."project_showcase_post_media"
ADD COLUMN "alt" TEXT;
3 changes: 3 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,8 @@ model ProjectShowcasePost {
challengeIds String[] @default([])
createdById Int
updatedById Int
publishedAt DateTime?
publishedBy Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

Expand Down Expand Up @@ -1138,6 +1140,7 @@ model ProjectShowcasePostMedia {
projectShowcasePostId BigInt
type String
url String
alt String?
createdAt DateTime @default(now())
createdBy BigInt

Expand Down
21 changes: 21 additions & 0 deletions src/api/project-showcase-post/dto/challenge-metadata.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ApiProperty } from '@nestjs/swagger';

export class ChallengeMetadataDto {
@ApiProperty()
challengeId: string;

@ApiProperty()
numOfSubmissions: number;

@ApiProperty()
numOfRegistrants: number;

@ApiProperty({ type: [Object] })
skills: Array<{ id: string; name: string }>;

@ApiProperty()
track: string;

@ApiProperty({ type: [String] })
countries: string[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ export class ProjectShowcasePostListQueryDto extends PaginationDto {
projectId?: string | string[] | Record<string, unknown>;

@ApiPropertyOptional({
type: [String],
description: 'Filter by industry id (exact or $in pattern)',
})
@IsOptional()
@Transform(({ value }) => parseFilterInput(value))
industryId?: string | string[] | Record<string, unknown>;

@ApiPropertyOptional({
type: [String],
description: 'Filter by category id (exact or $in pattern)',
})
@IsOptional()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, IsUrl } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString, IsUrl } from 'class-validator';

export class ProjectShowcasePostMediaInputDto {
@ApiProperty({ description: 'MIME type of the media asset.' })
Expand All @@ -10,4 +10,9 @@ export class ProjectShowcasePostMediaInputDto {
@ApiProperty({ description: 'URL of the media asset.' })
@IsUrl()
url: string;

@ApiPropertyOptional({ description: 'Alternative text for the media asset.' })
@IsOptional()
@IsString()
alt?: string;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, IsUrl } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString, IsUrl } from 'class-validator';

export class ProjectShowcasePostMediaDto {
@ApiProperty({ description: 'Media asset id.' })
Expand All @@ -16,6 +16,11 @@ export class ProjectShowcasePostMediaDto {
@IsUrl()
url: string;

@ApiPropertyOptional({ description: 'Alternative text for the media asset.' })
@IsOptional()
@IsString()
alt?: string;

@ApiProperty({ description: 'Timestamp when media asset was created.' })
createdAt: Date;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { ProjectShowcasePostStatus } from '@prisma/client';
import { ProjectShowcasePostMediaDto } from './project-showcase-post-media.dto';
import { ChallengeMetadataDto } from './challenge-metadata.dto';

export class ProjectShowcasePostResponseDto {
@ApiProperty()
Expand All @@ -27,9 +28,18 @@ export class ProjectShowcasePostResponseDto {
@ApiProperty({ type: [Object] })
categories: Array<{ id: string; name: string }>;

@ApiPropertyOptional()
projectTitle?: string;

@ApiPropertyOptional({ type: [ProjectShowcasePostMediaDto] })
media?: ProjectShowcasePostMediaDto[];

@ApiPropertyOptional()
publishedAt?: Date;

@ApiPropertyOptional()
publishedBy?: number;

@ApiProperty()
createdById: number;

Expand All @@ -41,4 +51,7 @@ export class ProjectShowcasePostResponseDto {

@ApiProperty()
updatedAt: Date;

@ApiPropertyOptional({ type: [ChallengeMetadataDto] })
challengeMetadata?: ChallengeMetadataDto[];
}
32 changes: 28 additions & 4 deletions src/api/project-showcase-post/project-showcase-post.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,20 @@ export class ProjectShowcasePostController {
@ApiQuery({ name: 'sort', required: false, type: String })
@ApiQuery({ name: 'status', required: false, type: String })
@ApiQuery({ name: 'projectId', required: false, type: String })
@ApiQuery({ name: 'industryId', required: false, type: String })
@ApiQuery({ name: 'categoryId', required: false, type: String })
@ApiQuery({
name: 'industryId',
required: false,
type: String,
isArray: true,
example: ['1', '2'],
})
@ApiQuery({
name: 'categoryId',
required: false,
type: String,
isArray: true,
example: ['2', '3'],
})
@ApiQuery({ name: 'challengeId', required: false, type: String })
@ApiQuery({ name: 'keyword', required: false, type: String })
@ApiResponse({
Expand Down Expand Up @@ -98,8 +110,20 @@ export class ProjectShowcasePostController {
@ApiQuery({ name: 'perPage', required: false, type: Number })
@ApiQuery({ name: 'sort', required: false, type: String })
@ApiQuery({ name: 'status', required: false, type: String })
@ApiQuery({ name: 'industryId', required: false, type: String })
@ApiQuery({ name: 'categoryId', required: false, type: String })
@ApiQuery({
name: 'industryId',
required: false,
type: String,
isArray: true,
example: ['5', '10'],
})
@ApiQuery({
name: 'categoryId',
required: false,
type: String,
isArray: true,
example: ['7', '12'],
})
@ApiQuery({ name: 'challengeId', required: false, type: String })
@ApiQuery({ name: 'keyword', required: false, type: String })
@ApiResponse({
Expand Down
Loading
Loading