Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
HUNG-rushb committed Jan 6, 2024
1 parent 9963f42 commit f1436d5
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/Type_Definitions/Post_Post.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/Mutation/contest.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const contestMutation = {
],
});

console.log({ a });
// console.log({ a });

return result;
},
Expand Down
24 changes: 24 additions & 0 deletions src/resolvers/Mutation/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ const postMutation = {
},
updatePost: async (parent, args, info) => {
let result;

console.log(args.data);

try {
result = await prisma.post.update({
where: {
Expand All @@ -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;
Expand Down
29 changes: 28 additions & 1 deletion src/resolvers/Type/ContestPrize___.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
};

Expand Down

0 comments on commit f1436d5

Please sign in to comment.