Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Commit

Permalink
feat: update BestAlbumsResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
YanceyOfficial committed Mar 28, 2020
1 parent edd5d45 commit 23b1977
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/best-albums/best-albums.resolver.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { UseGuards } from '@nestjs/common'
import { Args, Query, Resolver, Mutation, ID } from '@nestjs/graphql'
import { BestAlbumsService } from './best-albums.service'
import { BestAlbumModel } from './models/best-albums.model'
import { BatchDeleteModel } from '../database/models/batch-delete.model'
import { CreateBestAlbumInput } from './dtos/create-best-album.input'
import { UpdateBestAlbumInput } from './dtos/update-best-album.input'
import { GqlAuthGuard } from '../guard/gqlAuth.guard'

@Resolver(() => BestAlbumModel)
export class BestAlbumsResolver {
Expand All @@ -22,21 +24,25 @@ export class BestAlbumsResolver {
}

@Mutation(() => BestAlbumModel)
@UseGuards(GqlAuthGuard)
public async createBestAlbum(@Args('input') input: CreateBestAlbumInput) {
return this.bestAlbumsService.create(input)
}

@Mutation(() => BestAlbumModel)
@UseGuards(GqlAuthGuard)
public async updateBestAlbumById(@Args('input') input: UpdateBestAlbumInput) {
return this.bestAlbumsService.update(input)
}

@Mutation(() => BestAlbumModel)
@UseGuards(GqlAuthGuard)
public async deleteBestAlbumById(@Args({ name: 'id', type: () => ID }) id: string) {
return this.bestAlbumsService.deleteOneById(id)
}

@Mutation(() => BatchDeleteModel)
@UseGuards(GqlAuthGuard)
public async deleteBestAlbums(@Args({ name: 'ids', type: () => [ID] }) ids: string[]) {
return this.bestAlbumsService.batchDelete(ids)
}
Expand Down

0 comments on commit 23b1977

Please sign in to comment.