Style part page
This commit is contained in:
@@ -11,6 +11,21 @@ export const part = ({ id }) => {
|
||||
where: { id },
|
||||
})
|
||||
}
|
||||
export const partByUserAndTitle = async ({ userName, partTitle }) => {
|
||||
const user = await db.user.findOne({
|
||||
where: {
|
||||
userName
|
||||
}
|
||||
})
|
||||
return db.part.findOne({
|
||||
where: {
|
||||
title_userId: {
|
||||
title: partTitle,
|
||||
userId: user.id,
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const createPart = async ({ input }) => {
|
||||
return db.part.create({
|
||||
|
||||
@@ -54,7 +54,11 @@ export const deleteUser = ({ id }) => {
|
||||
}
|
||||
|
||||
export const User = {
|
||||
Part: (_obj, { root }) => db.user.findOne({ where: { id: root.id } }).Part(),
|
||||
Parts: (_obj, { root }) => db.user.findOne({ where: { id: root.id } }).Part(),
|
||||
Part: (_obj, { root, ...rest }) => db.part.findOne({where: { title_userId: {
|
||||
title: _obj.partTitle,
|
||||
userId: root.id,
|
||||
}}}),
|
||||
Reaction: (_obj, { root }) =>
|
||||
db.user.findOne({ where: { id: root.id } }).Reaction(),
|
||||
Comment: (_obj, { root }) =>
|
||||
|
||||
Reference in New Issue
Block a user