DB에는 없지만, graphql상에서는 존재, DB는 터치하지 않고, data를 manage함.
import { gql } from 'apollo-server'
export default gql`
type Photo {
id: Int!
user: User!
file: String!
caption: String
hashtags: [Hashtag]
createdAt: String!
updatedAt: String!
likes: Int!
}
type Hashtag {
id: Int!
hashtag: String!
photos(page: Int!): [Photo]
totalPhotos: Int!
createdAt: String!
updatedAt: String!
}
type Like {
id: Int!
photo: Photo!
createdAt: String!
updatedAt: String!
}
`
import prisma from '../client'
export default {
Photo: {
///Photo의 computed field
user: ({ userId }) => prisma.user.findUnique({ where: { id: userId } }),
///parent자리, 혹은 root자리에 userId를 넣어서, photo의 user를 찾음.
hashtags: ({ id }) =>
///id는 photo의 id임.
prisma.hashtag.findMany({
where: {
photos: { some: { id } },
},
}),
//// hashtag의 DB중 photos중에서 위의 photo id 가 들어있는 hashtag를 찾음
likes: ({ id }) => prisma.like.count({ where: { photoId: id } }),
///photo id를 parent혹은 root 자리에 넣어서
///그 photo의 like갯수를 count함.
},
Hashtag: {
///Hashtag의 computed Field
photos: ({ id }, { page }) => {
return prisma.hashtag.findUnique({ where: { id } }).photos()
},
///hashtag의 id를 입력받아서 그 hashtag를 가진 photo들을 return해줌.
totalPhotos: ({ id }) =>
///id는 hashtag의 id를 뜻함.
prisma.photo.count({
where: {
hashtags: {
some: { id },
},
},
}),
////hashtag의 id(#orange)를 가진 photo를 찾아서 count해서 return해줌,
},
}
Hello! I would like to share these online services related to photographs:
https://depositphotos.com/photo/photo-2011-04-20-sitemap-268.xml
https://depositphotos.com/photo/photo-2011-04-22-sitemap-269.xml
https://depositphotos.com/photo/photo-2011-04-26-sitemap-270.xml
https://depositphotos.com/photo/photo-2011-04-28-sitemap-271.xml
https://depositphotos.com/photo/photo-2011-04-29-sitemap-272.xml
https://depositphotos.com/photo/photo-2011-04-29-sitemap-273.xml
https://depositphotos.com/photo/photo-2011-05-01-sitemap-274.xml
https://depositphotos.com/photo/photo-2011-05-03-sitemap-275.xml
https://depositphotos.com/photo/photo-2011-05-05-sitemap-276.xml
https://depositphotos.com/photo/photo-2011-05-07-sitemap-277.xml
https://depositphotos.com/photo/photo-2011-05-10-sitemap-278.xml
https://depositphotos.com/photo/photo-2011-05-12-sitemap-279.xml
https://depositphotos.com/photo/photo-2011-05-14-sitemap-280.xml
https://depositphotos.com/photo/photo-2011-05-16-sitemap-281.xml
https://depositphotos.com/photo/photo-2011-05-18-sitemap-282.xml
https://depositphotos.com/photo/photo-2011-05-20-sitemap-283.xml
https://depositphotos.com/photo/photo-2011-05-23-sitemap-284.xml
The information you share is excellent and exciting, and thanks to that, I know more valuable things. Keep posting interesting things and I will keep an eye on your posts https://busd-store.com/