issue-152 wasn't quiet solved correctly it showed all parts
on the user's profile instead of only their own parts
This commit is contained in:
@@ -14,7 +14,7 @@ export const schema = gql`
|
||||
}
|
||||
|
||||
type Query {
|
||||
parts: [Part!]!
|
||||
parts(userName: String): [Part!]!
|
||||
part(id: String!): Part
|
||||
partByUserAndTitle(userName: String!, partTitle: String!): Part
|
||||
}
|
||||
|
||||
@@ -7,8 +7,18 @@ import {
|
||||
import { requireAuth } from 'src/lib/auth'
|
||||
import { requireOwnership } from 'src/lib/owner'
|
||||
|
||||
export const parts = () => {
|
||||
return db.part.findMany({ where: { deleted: false } })
|
||||
export const parts = ({ userName }) => {
|
||||
if (!userName) {
|
||||
return db.part.findMany({ where: { deleted: false } })
|
||||
}
|
||||
return db.part.findMany({
|
||||
where: {
|
||||
deleted: false,
|
||||
user: {
|
||||
userName,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const part = ({ id }) => {
|
||||
|
||||
Reference in New Issue
Block a user