add category name again to seed and init to avoid conflicts with graphql model

This commit is contained in:
Moriz Wahl 2022-08-22 20:47:37 +02:00
parent ad4497786c
commit d948067f44
5 changed files with 5 additions and 1 deletions

View File

@ -35,6 +35,7 @@ export const cleanDatabase = async (options = {}) => {
Factory.define('category')
.attr('id', uuid)
.attr('icon', 'globe')
.attr('name', 'Global Peace & Nonviolence')
.after((buildObject, options) => {
return neode.create('Category', buildObject)
})

View File

@ -20,6 +20,7 @@ const createCategories = async (session) => {
`MERGE (c:Category {
icon: "${icon}",
slug: "${name}",
name: "${name}",
id: "${id}",
createdAt: toString(datetime())
})`,

View File

@ -273,6 +273,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
Factory.build('category', {
id: `cat${index + 1}`,
slug: name,
name,
icon,
})
}),

View File

@ -2,6 +2,7 @@ import { v4 as uuid } from 'uuid'
export default {
id: { type: 'string', primary: true, default: uuid },
name: { type: 'string', required: true, default: false },
slug: { type: 'string', unique: 'true' },
icon: { type: 'string', required: true, default: false },
createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },

View File

@ -358,7 +358,7 @@ export default {
undefinedToNull: ['activityId', 'objectId', 'language', 'pinnedAt', 'pinned'],
hasMany: {
tags: '-[:TAGGED]->(related:Tag)',
// categories: '-[:CATEGORIZED]->(related:Category)',
categories: '-[:CATEGORIZED]->(related:Category)',
comments: '<-[:COMMENTS]-(related:Comment)',
shoutedBy: '<-[:SHOUTED]-(related:User)',
emotions: '<-[related:EMOTED]',