Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewquang512 committed Nov 4, 2023
1 parent 3afcc1b commit 5e6a935
Show file tree
Hide file tree
Showing 8 changed files with 234 additions and 9 deletions.
203 changes: 203 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"homepage": "https://github.com/HUNG-rushb/Images-Social-Server#readme",
"dependencies": {
"@apollo/sandbox": "^2.5.1",
"@apollo/server": "^4.9.4",
"@as-integrations/aws-lambda": "^3.1.0",
"@graphql-tools/schema": "^9.0.10",
Expand Down
2 changes: 1 addition & 1 deletion src/Type_Definitions/Comment_Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const commentDefs = gql`
createComment(data: CreateCommentInput!): Comment!
deleteComment(data: DeleteCommentInput!): Comment!
updateComment(data: UpdateCommentInput!): Comment!
voteCommand(data: VoteCommentInput!): Comment!
voteComment(data: VoteCommentInput!): Comment!
}
extend type Query {
Expand Down
8 changes: 5 additions & 3 deletions src/handler.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Apollo
import { ApolloServer } from '@apollo/server';
import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default';
import {
ApolloServerPluginLandingPageLocalDefault,
ApolloServerPluginLandingPageProductionDefault
} from '@apollo/server/plugin/landingPage/default';
import {
startServerAndCreateLambdaHandler,
handlers,
} from '@as-integrations/aws-lambda';

// Prisma
import { prisma } from './prisma/database.js';

Expand Down Expand Up @@ -36,7 +38,7 @@ const server = new ApolloServer({
return { prisma };
},
plugins: [
ApolloServerPluginLandingPageLocalDefault,
ApolloServerPluginLandingPageProductionDefault,
...(parseInt(process.env.IS_LOGGING) ? [loggingPlugin] : []),
],
logger: console,
Expand Down
7 changes: 5 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Apollo
import { ApolloServer } from '@apollo/server';
import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default';
import { startStandaloneServer } from '@apollo/server/standalone';
import {
ApolloServerPluginLandingPageLocalDefault,
ApolloServerPluginLandingPageProductionDefault
} from '@apollo/server/plugin/landingPage/default';

// Prisma
import { prisma } from './prisma/database.js';
Expand Down Expand Up @@ -35,7 +38,7 @@ const server = new ApolloServer({
credentials: true, // <- enable CORS response for requests with credentials (cookies, http authentication)
},
plugins: [
ApolloServerPluginLandingPageLocalDefault,
ApolloServerPluginLandingPageProductionDefault,
...(parseInt(process.env.IS_LOGGING) ? [loggingPlugin] : []),
],
logger: console,
Expand Down
3 changes: 2 additions & 1 deletion src/resolvers/Mutation/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const commentMutation = {

return comment;
},

updateComment: async (parent, args, info) => {
return await prisma.comment.update({
where: {
Expand All @@ -63,7 +64,7 @@ const commentMutation = {
* @param {*} info
* @returns
*/
voteCommand: async (parent, args, info) => {
voteComment: async (parent, args, info) => {
const { action, commentId } = args.data;

const existedComment = await prisma.comment.findUnique({
Expand Down
9 changes: 8 additions & 1 deletion src/resolvers/Query/STORY.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ const storyQuery = {
},
};
},
storyInfo: async (parent, args, { prisma }, info) => {

/**
* @param {*} parent
* @param {{data: {storyId: string}}} args
* @param {*} info
* @returns
*/
storyInfo: async (parent, args, info) => {
return await prisma.story.findUnique({
where: {
id: args.data.storyId,
Expand Down
10 changes: 9 additions & 1 deletion src/resolvers/Query/TAG.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ const tagQuery = {
allTags: async (parent, args, info) => {
return await prisma.tag.findMany();
},
suggestTags: async (parent, args, { prisma }, info) => {

/**
* @param {*} parent
* @param {*} args
* @param {*} info
* @returns
*/
suggestTags: async (parent, args, info) => {
const a = await prisma.tag.findMany();
return a.slice(0, 10);
},

tagInfo: async (parent, args, info) => {
return await prisma.tag.findUnique({
where: {
Expand Down

0 comments on commit 5e6a935

Please sign in to comment.