-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: nickname 리턴 * fix: platform=linux/amd64 추가 * feat: thumbnail 생성 * feat: ThumbNail.jpg S3 업로드 * feat: thumbnail encoding server에서 만드는 거로 수정 * feat: thumbnail return API 생성 * feat: thumbnail api 연결 * feat: thumbnail info streams API 에서 가져오기 * fix : 리뷰반영 * fix : 리뷰반영 * fix : .DS_Store 삭제 * fix: camelCase로 변경 * fix: 리뷰반영
- Loading branch information
Showing
15 changed files
with
357 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
/.idea | ||
server/.DS_Store | ||
*.pem | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
export class ReadStreamDto { | ||
readonly userId: string; | ||
readonly nickname: string; | ||
readonly title: string; | ||
readonly category: string; | ||
readonly viewer: number; | ||
readonly thumbnail: string; | ||
readonly thumbnail: { ContentLength: number; thumbnailUrl: string }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Controller, Get, Param } from '@nestjs/common'; | ||
import { ThumbnailsService } from './thumbnails.service'; | ||
|
||
@Controller('thumbnails') | ||
export class ThumbnailsController { | ||
constructor(private readonly thumbnailsService: ThumbnailsService) {} | ||
|
||
@Get(':userId') | ||
async getThumbnailUrl(@Param('userId') userId: string) { | ||
return await this.thumbnailsService.getThumbnailUrl(userId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { ThumbnailsController } from './thumbnails.controller'; | ||
import { ThumbnailsService } from './thumbnails.service'; | ||
|
||
@Module({ | ||
controllers: [ThumbnailsController], | ||
providers: [ThumbnailsService], | ||
exports: [ThumbnailsService], | ||
}) | ||
export class ThumbnailsModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import AWS = require('aws-sdk'); | ||
|
||
@Injectable() | ||
export class ThumbnailsService { | ||
async getThumbnailUrl(userId: string) { | ||
const objectName = `thumb/${userId}_240p264kbs.png`; | ||
const endpoint = new AWS.Endpoint(process.env.AWS_S3_URL); | ||
const region = process.env.AWS_S3_REGION; | ||
const accessKey = process.env.AWS_ACCESS_KEY_ID; | ||
const secretKey = process.env.AWS_SECRET_ACCESS_KEY; | ||
const S3 = new AWS.S3({ | ||
endpoint: endpoint, | ||
region: region, | ||
credentials: { | ||
accessKeyId: accessKey, | ||
secretAccessKey: secretKey, | ||
}, | ||
}); | ||
|
||
const params = { | ||
Bucket: process.env.AWS_S3_BUCKET_NAME, | ||
Key: objectName, | ||
}; | ||
|
||
const objectInfo = await S3.getObject(params).promise(); | ||
|
||
return { | ||
ContentLength: objectInfo.ContentLength, | ||
thumbnailUrl: objectName, | ||
}; | ||
} | ||
} |
Oops, something went wrong.