Style part page

This commit is contained in:
Kurt Hutten
2020-11-07 16:38:48 +11:00
parent 606cf8eae8
commit 1bdc836b66
18 changed files with 347 additions and 61 deletions

View File

@@ -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({

View File

@@ -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 }) =>