From 613f91b0371825a6b093e1fc0bb48c680709235a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 18 Aug 2022 11:47:27 +0200 Subject: [PATCH] Add seedings for group memberships --- backend/src/db/seed.js | 78 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/backend/src/db/seed.js b/backend/src/db/seed.js index e41ef1abc..ebe8a6020 100644 --- a/backend/src/db/seed.js +++ b/backend/src/db/seed.js @@ -5,7 +5,7 @@ import createServer from '../server' import faker from '@faker-js/faker' import Factory from '../db/factories' import { getNeode, getDriver } from '../db/neo4j' -import { createGroupMutation } from './graphql/groups' +import { createGroupMutation, enterGroupMutation } from './graphql/groups' import { createPostMutation } from './graphql/posts' import { createCommentMutation } from './graphql/comments' @@ -400,6 +400,22 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] }, }), ]) + await Promise.all([ + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g0', + userId: 'u2', + }, + }), + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g0', + userId: 'u3', + }, + }), + ]) authenticatedUser = await jennyRostock.toJson() await Promise.all([ @@ -416,6 +432,36 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] }, }), ]) + await Promise.all([ + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g1', + userId: 'u1', + }, + }), + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g1', + userId: 'u5', + }, + }), + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g1', + userId: 'u6', + }, + }), + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g1', + userId: 'u7', + }, + }), + ]) authenticatedUser = await bobDerBaumeister.toJson() await Promise.all([ @@ -432,6 +478,36 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] }, }), ]) + await Promise.all([ + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g2', + userId: 'u4', + }, + }), + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g2', + userId: 'u5', + }, + }), + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g2', + userId: 'u6', + }, + }), + mutate({ + mutation: enterGroupMutation, + variables: { + id: 'g2', + userId: 'u7', + }, + }), + ]) // Create Posts