From f9c8c9b4be2165f1e1187d0b4b2f87e2a73424a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 22 Aug 2022 11:27:18 +0200 Subject: [PATCH] Add different group member roles to seeding --- backend/src/db/seed.js | 113 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 1 deletion(-) diff --git a/backend/src/db/seed.js b/backend/src/db/seed.js index f9b2d05da..a2be78553 100644 --- a/backend/src/db/seed.js +++ b/backend/src/db/seed.js @@ -5,7 +5,11 @@ import createServer from '../server' import faker from '@faker-js/faker' import Factory from '../db/factories' import { getNeode, getDriver } from '../db/neo4j' -import { createGroupMutation, joinGroupMutation } from './graphql/groups' +import { + createGroupMutation, + joinGroupMutation, + switchGroupMemberRoleMutation, +} from './graphql/groups' import { createPostMutation } from './graphql/posts' import { createCommentMutation } from './graphql/comments' @@ -415,6 +419,46 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] userId: 'u3', }, }), + mutate({ + mutation: joinGroupMutation, + variables: { + id: 'g0', + userId: 'u4', + }, + }), + mutate({ + mutation: joinGroupMutation, + variables: { + id: 'g0', + userId: 'u6', + }, + }), + ]) + await Promise.all([ + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u2', + roleInGroup: 'usual', + }, + }), + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u4', + roleInGroup: 'admin', + }, + }), + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u3', + roleInGroup: 'owner', + }, + }), ]) authenticatedUser = await jennyRostock.toJson() @@ -440,6 +484,13 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] userId: 'u1', }, }), + mutate({ + mutation: joinGroupMutation, + variables: { + id: 'g1', + userId: 'u2', + }, + }), mutate({ mutation: joinGroupMutation, variables: { @@ -462,6 +513,40 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] }, }), ]) + await Promise.all([ + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u1', + roleInGroup: 'usual', + }, + }), + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u2', + roleInGroup: 'usual', + }, + }), + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u5', + roleInGroup: 'admin', + }, + }), + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u6', + roleInGroup: 'owner', + }, + }), + ]) authenticatedUser = await bobDerBaumeister.toJson() await Promise.all([ @@ -508,6 +593,32 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] }, }), ]) + await Promise.all([ + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u4', + roleInGroup: 'usual', + }, + }), + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u5', + roleInGroup: 'usual', + }, + }), + mutate({ + mutation: switchGroupMemberRoleMutation, + variables: { + id: 'g0', + userId: 'u6', + roleInGroup: 'usual', + }, + }), + ]) // Create Posts