Skip to content
Merged

Dev #13

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
1 change: 1 addition & 0 deletions src/modules/campaign/campaign.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class CampaignService {
zaloGroupUrl: obj.zaloGroupUrl,
hotline: obj.hotline,
regulationsUrl: obj.regulationsUrl,
regulations: obj.regulations,
fanpageUrl: obj.fanpageUrl,
sizeShirtOptions: obj.sizeShirtOptions || [],
createdAt: obj.createdAt,
Expand Down
3 changes: 3 additions & 0 deletions src/modules/campaign/dto/campaign-public-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export class CampaignPublicResponseDto {
@ApiPropertyOptional({ example: 'https://example.com/regulations.pdf', description: 'Link điều lệ' })
regulationsUrl?: string;

@ApiPropertyOptional({ example: '## Thể lệ\n- Điều 1: ...', description: 'Nội dung thể lệ (Markdown)' })
regulations?: string;

@ApiPropertyOptional({ example: 'https://facebook.com/5bib', description: 'Link fanpage' })
fanpageUrl?: string;

Expand Down
5 changes: 5 additions & 0 deletions src/modules/campaign/dto/create-campaign.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ export class CreateCampaignDto {
@IsString()
regulationsUrl?: string;

@ApiPropertyOptional({ description: 'Nội dung thể lệ (Markdown)' })
@IsOptional()
@IsString()
regulations?: string;

@ApiPropertyOptional({ description: 'Link fanpage' })
@IsOptional()
@IsString()
Expand Down
3 changes: 3 additions & 0 deletions src/modules/campaign/schemas/campaign.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export class Campaign {
@Prop()
regulationsUrl: string;

@Prop({ type: String })
regulations: string;

@Prop()
fanpageUrl: string;

Expand Down
3 changes: 2 additions & 1 deletion src/modules/upload/upload.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Injectable } from '@nestjs/common';
import { Injectable, BadRequestException } from '@nestjs/common';
import {
S3Client,
PutObjectCommand,
Expand All @@ -13,6 +13,7 @@ export class UploadService {
constructor(private readonly s3Client: S3Client) {}

async uploadFile(file: Express.Multer.File): Promise<string | false> {
if (!file) throw new BadRequestException('No file uploaded. Send as multipart/form-data with field name "file"');
try {
const randomString = Math.random().toString(36).substring(2, 15);
const now = new Date();
Expand Down
Loading