fix: apollo server image upload
This commit is contained in:
parent
9baa16c824
commit
3e4f4a4962
6 changed files with 103 additions and 10 deletions
|
|
@ -3,7 +3,6 @@ const customers = require('../../../customers')
|
|||
const filters = require('../../filters')
|
||||
|
||||
const resolvers = {
|
||||
// Upload: GraphQLUpload,
|
||||
|
||||
Customer: {
|
||||
isAnonymous: parent => (parent.customerId === anonymous.uuid)
|
||||
|
|
@ -22,9 +21,15 @@ const resolvers = {
|
|||
addCustomField: (...[, { customerId, label, value }]) => customers.addCustomField(customerId, label, value),
|
||||
saveCustomField: (...[, { customerId, fieldId, newValue }]) => customers.saveCustomField(customerId, fieldId, newValue),
|
||||
removeCustomField: (...[, [ { customerId, fieldId } ]]) => customers.removeCustomField(customerId, fieldId),
|
||||
editCustomer: (root, { customerId, customerEdit }, context) => {
|
||||
editCustomer: async (root, { customerId, customerEdit }, context) => {
|
||||
const token = !!context.req.cookies.lid && context.req.session.user.id
|
||||
return customers.edit(customerId, customerEdit, token)
|
||||
const editedData = await customerEdit
|
||||
return customers.edit(customerId, editedData, token)
|
||||
},
|
||||
replacePhoto: async (root, { customerId, photoType, newPhoto }, context) => {
|
||||
const photo = await newPhoto
|
||||
return customers.replacePhoto(customerId, photoType, photo)
|
||||
.then(() => customers.getCustomerById(customerId))
|
||||
},
|
||||
deleteEditedData: (root, { customerId, customerEdit }) => {
|
||||
return customers.deleteEditedData(customerId, customerEdit)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ const typeDef = gql`
|
|||
authorizedOverride: String
|
||||
daysSuspended: Int
|
||||
isSuspended: Boolean
|
||||
frontCamera: Upload
|
||||
newPhoto: Upload
|
||||
photoType: String
|
||||
frontCameraPath: String
|
||||
frontCameraAt: Date
|
||||
frontCameraOverride: String
|
||||
|
|
@ -68,7 +69,6 @@ const typeDef = gql`
|
|||
}
|
||||
|
||||
input CustomerEdit {
|
||||
frontCamera: Upload
|
||||
idCardData: JSONObject
|
||||
idCardPhoto: Upload
|
||||
usSsn: String
|
||||
|
|
@ -87,6 +87,7 @@ const typeDef = gql`
|
|||
removeCustomField(customerId: ID!, fieldId: ID!): CustomerCustomField @auth
|
||||
editCustomer(customerId: ID!, customerEdit: CustomerEdit): Customer @auth
|
||||
deleteEditedData(customerId: ID!, customerEdit: CustomerEdit): Customer @auth
|
||||
replacePhoto(customerId: ID!, photoType: String, newPhoto: Upload): Customer @auth
|
||||
}
|
||||
`
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue