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

Commit

Permalink
feat: finish mograte to nest8
Browse files Browse the repository at this point in the history
  • Loading branch information
YanceyOfficial committed Sep 26, 2021
1 parent 2726b2e commit 9282773
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ input CreatePostInput {
summary: String!
content: String!
tags: [String!]!
lastModifiedDate: String!
lastModifiedDate: DateTime!
isPublic: Boolean
}

Expand Down
6 changes: 3 additions & 3 deletions src/posts/dtos/create-post.input.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InputType, Field } from '@nestjs/graphql'
import { InputType, Field, } from '@nestjs/graphql'
import {
IsString,
IsNotEmpty,
Expand Down Expand Up @@ -45,9 +45,9 @@ export class CreatePostInput {
public readonly tags: string[]

@Field({ nullable: false })
@IsString()
@IsDate()
@IsNotEmpty()
public readonly lastModifiedDate: string
public readonly lastModifiedDate: Date

@Field({ nullable: true })
public readonly isPublic?: boolean
Expand Down
8 changes: 4 additions & 4 deletions src/posts/posts.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class PostsResolver {
}

@Query(() => PostModel)
// @UseGuards(GqlAuthGuard)
@UseGuards(GqlAuthGuard)
public async getPosts(@Args('input') input: PaginationInput) {
return this.postsService.findByPagination(input)
}
Expand All @@ -34,19 +34,19 @@ export class PostsResolver {
}

@Mutation(() => PostItemModel)
// @UseGuards(GqlAuthGuard)
@UseGuards(GqlAuthGuard)
public async createPost(@Args('input') input: CreatePostInput) {
return this.postsService.create(input)
}

@Mutation(() => PostItemModel)
// @UseGuards(GqlAuthGuard)
@UseGuards(GqlAuthGuard)
public async updatePostById(@Args('input') input: UpdatePostInput) {
return this.postsService.update(input)
}

@Mutation(() => PostItemModel)
// @UseGuards(GqlAuthGuard)
@UseGuards(GqlAuthGuard)
public async deletePostById(@Args({ name: 'id', type: () => ID }) id: string) {
return this.postsService.deleteOneById(id)
}
Expand Down

0 comments on commit 9282773

Please sign in to comment.