mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
image property type added
This commit is contained in:
parent
ff8cd43165
commit
4a16af10ba
@ -49,8 +49,9 @@ Factory.define('badge')
|
|||||||
|
|
||||||
Factory.define('image')
|
Factory.define('image')
|
||||||
.attr('url', faker.image.unsplash.imageUrl)
|
.attr('url', faker.image.unsplash.imageUrl)
|
||||||
.attr('aspectRatio', 1)
|
.attr('aspectRatio', 1.0)
|
||||||
.attr('alt', faker.lorem.sentence)
|
.attr('alt', faker.lorem.sentence)
|
||||||
|
.attr('type', 'image/jpeg')
|
||||||
.after((buildObject, options) => {
|
.after((buildObject, options) => {
|
||||||
const { url: imageUrl } = buildObject
|
const { url: imageUrl } = buildObject
|
||||||
if (imageUrl) buildObject.url = uniqueImageUrl(imageUrl)
|
if (imageUrl) buildObject.url = uniqueImageUrl(imageUrl)
|
||||||
|
|||||||
@ -3,5 +3,6 @@ export default {
|
|||||||
alt: { type: 'string' },
|
alt: { type: 'string' },
|
||||||
sensitive: { type: 'boolean', default: false },
|
sensitive: { type: 'boolean', default: false },
|
||||||
aspectRatio: { type: 'float', default: 1.0 },
|
aspectRatio: { type: 'float', default: 1.0 },
|
||||||
|
type: { type: 'string' },
|
||||||
createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
|
createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import Resolver from './helpers/Resolver'
|
|||||||
export default {
|
export default {
|
||||||
Image: {
|
Image: {
|
||||||
...Resolver('Image', {
|
...Resolver('Image', {
|
||||||
undefinedToNull: ['sensitive', 'alt', 'aspectRatio'],
|
undefinedToNull: ['sensitive', 'alt', 'aspectRatio', 'type'],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,8 +53,8 @@ export async function mergeImage(resource, relationshipType, imageInput, opts =
|
|||||||
if (!(existingImage || upload)) throw new UserInputError('Cannot find image for given resource')
|
if (!(existingImage || upload)) throw new UserInputError('Cannot find image for given resource')
|
||||||
if (existingImage && upload) deleteImageFile(existingImage, deleteCallback)
|
if (existingImage && upload) deleteImageFile(existingImage, deleteCallback)
|
||||||
const url = await uploadImageFile(upload, uploadCallback)
|
const url = await uploadImageFile(upload, uploadCallback)
|
||||||
const { alt, sensitive, aspectRatio } = imageInput
|
const { alt, sensitive, aspectRatio, type } = imageInput
|
||||||
const image = { alt, sensitive, aspectRatio, url }
|
const image = { alt, sensitive, aspectRatio, url, type }
|
||||||
txResult = await transaction.run(
|
txResult = await transaction.run(
|
||||||
`
|
`
|
||||||
MATCH (resource {id: $resource.id})
|
MATCH (resource {id: $resource.id})
|
||||||
|
|||||||
@ -8,6 +8,7 @@ type Image {
|
|||||||
alt: String,
|
alt: String,
|
||||||
sensitive: Boolean,
|
sensitive: Boolean,
|
||||||
aspectRatio: Float,
|
aspectRatio: Float,
|
||||||
|
type: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
input ImageInput {
|
input ImageInput {
|
||||||
@ -15,4 +16,5 @@ input ImageInput {
|
|||||||
upload: Upload,
|
upload: Upload,
|
||||||
sensitive: Boolean,
|
sensitive: Boolean,
|
||||||
aspectRatio: Float,
|
aspectRatio: Float,
|
||||||
|
type: String,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user