Skip to content

Commit

Permalink
'.'
Browse files Browse the repository at this point in the history
  • Loading branch information
ManucherKM committed Oct 1, 2023
1 parent c506244 commit 0f270ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/archive/archive.controller.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GetUserIdByToken } from '@/decorators/GetUserIdByToken'
import { JwtAuthGuard } from '@/guard/jwt-auth.guard'
import {
Body,
Expand Down Expand Up @@ -40,8 +41,11 @@ export class ArchiveController {
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@Post()
async create(@Body() createArchiveDto: CreateArchiveDto) {
return await this.archiveService.create(createArchiveDto)
async create(
@Body() createArchiveDto: CreateArchiveDto,
@GetUserIdByToken() userId: string,
) {
return await this.archiveService.create(userId, createArchiveDto)
}

@Get('share/:id')
Expand Down
2 changes: 1 addition & 1 deletion src/archive/archive.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ArchiveService {
private readonly fileService: FileService,
) {}

async create({ userId, fileIds }: CreateArchiveDto) {
async create(userId: string, { fileIds }: CreateArchiveDto) {
const isFilesExist = await this.isFilesExist(fileIds)

if (!isFilesExist) {
Expand Down
4 changes: 0 additions & 4 deletions src/archive/dto/create-archive.dto.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { IsNotEmpty, IsString } from 'class-validator'

export class CreateArchiveDto {
@IsString()
@IsNotEmpty()
userId: string

@IsString({ each: true })
fileIds: string[]
}

0 comments on commit 0f270ad

Please sign in to comment.