diff --git a/backend/src/db/factories.js b/backend/src/db/factories.js index f46ac10ee..3e164d51b 100644 --- a/backend/src/db/factories.js +++ b/backend/src/db/factories.js @@ -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) }) diff --git a/backend/src/db/migrate/store.js b/backend/src/db/migrate/store.js index 0361e874b..61d591cb7 100644 --- a/backend/src/db/migrate/store.js +++ b/backend/src/db/migrate/store.js @@ -20,6 +20,7 @@ const createCategories = async (session) => { `MERGE (c:Category { icon: "${icon}", slug: "${name}", + name: "${name}", id: "${id}", createdAt: toString(datetime()) })`, diff --git a/backend/src/db/seed.js b/backend/src/db/seed.js index eb79d5aa2..482517e69 100644 --- a/backend/src/db/seed.js +++ b/backend/src/db/seed.js @@ -273,6 +273,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] Factory.build('category', { id: `cat${index + 1}`, slug: name, + name, icon, }) }), diff --git a/backend/src/models/Category.js b/backend/src/models/Category.js index 8d87ac0e2..9a3f47fd0 100644 --- a/backend/src/models/Category.js +++ b/backend/src/models/Category.js @@ -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() }, diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index b09bb3edd..d9a04732c 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -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]',