Skip to content

Commit

Permalink
✨ Feat: document type이 image인 경우 thumbnail url 추가
Browse files Browse the repository at this point in the history
#
  • Loading branch information
ks1ksi committed Oct 5, 2023
1 parent bff2ceb commit 89b1227
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/document/document.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { DocumentDto } from './dto/response/document.dto';
import { OpenAiService } from '../openai/open-ai.service';
import { AwsService } from '../aws/aws.service';
import { UserService } from '../user/user.service';
import { ConfigService } from '@nestjs/config';

@Injectable()
export class DocumentService {
Expand All @@ -24,6 +25,7 @@ export class DocumentService {
private openAiService: OpenAiService,
private awsService: AwsService,
private userService: UserService,
private configService: ConfigService,
) {}

async findByCursor(
Expand Down Expand Up @@ -304,6 +306,11 @@ export class DocumentService {
data: {
docId, // S3 object key
type: documentType,
// IMAGE 인 경우 썸네일 추가
thumbnailUrl:
documentType === DocumentType.IMAGE
? `${this.configService.get<string>('THUMBNAIL_URL')}/${docId}`
: null,
status: Status.EMBED_PENDING,
user: { connect: { id: user.id } },
title: file.originalname,
Expand Down

0 comments on commit 89b1227

Please sign in to comment.