diff --git a/src/Type_Definitions/Post_Post.js b/src/Type_Definitions/Post_Post.js index b1bc9cc..35d70ce 100644 --- a/src/Type_Definitions/Post_Post.js +++ b/src/Type_Definitions/Post_Post.js @@ -147,9 +147,20 @@ const postDefs = gql` input UpdatePostInput { postId: ID! + + postViewStatus: ViewStatus + title: String caption: String - postViewStatus: ViewStatus + + camera: String + lens: String + aperture: String + focalLength: String + shutterSpeed: String + ISO: String + takenWhen: String + copyRight: String } type Post { diff --git a/src/resolvers/Mutation/contest.js b/src/resolvers/Mutation/contest.js index 689135c..7653fe0 100644 --- a/src/resolvers/Mutation/contest.js +++ b/src/resolvers/Mutation/contest.js @@ -108,7 +108,7 @@ const contestMutation = { ], }); - console.log({ a }); + // console.log({ a }); return result; }, diff --git a/src/resolvers/Mutation/post.js b/src/resolvers/Mutation/post.js index 1c99d0f..ccd5f7b 100644 --- a/src/resolvers/Mutation/post.js +++ b/src/resolvers/Mutation/post.js @@ -109,7 +109,9 @@ const postMutation = { }, updatePost: async (parent, args, info) => { let result; + console.log(args.data); + try { result = await prisma.post.update({ where: { @@ -121,6 +123,28 @@ const postMutation = { postViewStatus: args.data.postViewStatus || undefined, }, }); + + await prisma.image.update({ + where: { + postId: args.data.postId, + }, + data: { + imageInfoId: { + update: { + data: { + camera: args.data.camera || undefined, + lens: args.data.lens || undefined, + aperture: args.data.aperture || undefined, + focalLength: args.data.focalLength || undefined, + shutterSpeed: args.data.shutterSpeed || undefined, + ISO: args.data.ISO || undefined, + takenWhen: args.data.takenWhen || undefined, + copyRight: args.data.copyRight || undefined, + }, + }, + }, + }, + }); } catch (e) { console.log(e); throw e; diff --git a/src/resolvers/Type/ContestPrize___.js b/src/resolvers/Type/ContestPrize___.js index 4441e37..efe0b01 100644 --- a/src/resolvers/Type/ContestPrize___.js +++ b/src/resolvers/Type/ContestPrize___.js @@ -9,11 +9,38 @@ const Contest_Prize = { }); }, userId: async (parent, args, info) => { - return await prisma.user.findUnique({ + let a = await prisma.user.findUnique({ where: { id: parent.userId, }, }); + + console.log({ a }); + + if (a === null) { + a = { + id: '000000000000000000000000', + email: '', + phoneNumber: '', + hashPassword: '', + name: '', + profileImageURL: '', + backgroundImageURL: '', + age: 18, + birthday: '', + isAdmin: 0, + createdAt: '', + updatedAt: '', + biography: null, + notiIds: [], + chatIDs: [], + endoseredIds: [], + interestCategoryIds: [], + joinedContestIds: [], + }; + } + + return a; }, };