diff --git a/schema.gql b/schema.gql index e73b5b63..4e2c074c 100644 --- a/schema.gql +++ b/schema.gql @@ -603,7 +603,7 @@ input CreatePostInput { summary: String! content: String! tags: [String!]! - lastModifiedDate: String! + lastModifiedDate: DateTime! isPublic: Boolean } diff --git a/src/posts/dtos/create-post.input.ts b/src/posts/dtos/create-post.input.ts index 8edf6f62..3a9d11b1 100644 --- a/src/posts/dtos/create-post.input.ts +++ b/src/posts/dtos/create-post.input.ts @@ -1,4 +1,4 @@ -import { InputType, Field } from '@nestjs/graphql' +import { InputType, Field, } from '@nestjs/graphql' import { IsString, IsNotEmpty, @@ -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 diff --git a/src/posts/posts.resolver.ts b/src/posts/posts.resolver.ts index 7c50a479..86410301 100644 --- a/src/posts/posts.resolver.ts +++ b/src/posts/posts.resolver.ts @@ -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) } @@ -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) }