Changed GQL schema and seed data

This commit is contained in:
Wolfgang Huß 2019-07-15 13:39:16 +02:00
parent 6430c9e1bf
commit 688da7f705
2 changed files with 19 additions and 2 deletions

View File

@ -55,6 +55,7 @@ type Notification {
read: Boolean read: Boolean
user: User @relation(name: "NOTIFIED", direction: "OUT") user: User @relation(name: "NOTIFIED", direction: "OUT")
post: Post @relation(name: "NOTIFIED", direction: "IN") post: Post @relation(name: "NOTIFIED", direction: "IN")
comment: Post @relation(name: "NOTIFIED", direction: "IN")
createdAt: String createdAt: String
} }

View File

@ -2,7 +2,8 @@ import faker from 'faker'
import Factory from './factories' import Factory from './factories'
/* eslint-disable no-multi-spaces */ /* eslint-disable no-multi-spaces */
;(async function() { ;
(async function () {
try { try {
const f = Factory() const f = Factory()
const [racoon, rabbit, wolf, bear, turtle, rhino] = await Promise.all([ const [racoon, rabbit, wolf, bear, turtle, rhino] = await Promise.all([
@ -297,6 +298,8 @@ import Factory from './factories'
const mention1 = 'Hey <a class="mention" href="/profile/u3">@jenny-rostock</a>, what\'s up?' const mention1 = 'Hey <a class="mention" href="/profile/u3">@jenny-rostock</a>, what\'s up?'
const mention2 = const mention2 =
'Hey <a class="mention" href="/profile/u3">@jenny-rostock</a>, here is another notification for you!' 'Hey <a class="mention" href="/profile/u3">@jenny-rostock</a>, here is another notification for you!'
const hashtag1 = 'See <a class="hashtag" href="/search/hashtag/NaturphilosophieYoga">#NaturphilosophieYoga</a> can really help you!'
const hashtagAndMention1 = 'The new physics of <a class="hashtag" href="/search/hashtag/QuantenFlussTheorie">#QuantenFlussTheorie</a> can explain <a class="hashtag" href="/search/hashtag/QuantumGravity">#QuantumGravity</a>! <a class="mention" href="/profile/u1">@peter-lustig</a> got that already. ;-)'
await Promise.all([ await Promise.all([
asAdmin.create('Post', { asAdmin.create('Post', {
@ -309,6 +312,8 @@ import Factory from './factories'
}), }),
asUser.create('Post', { asUser.create('Post', {
id: 'p2', id: 'p2',
title: `Nature Philosophy Yoga`,
content: `${hashtag1}`,
}), }),
asTick.create('Post', { asTick.create('Post', {
id: 'p3', id: 'p3',
@ -330,6 +335,8 @@ import Factory from './factories'
asUser.create('Post', { asUser.create('Post', {
id: 'p8', id: 'p8',
image: faker.image.unsplash.nature(), image: faker.image.unsplash.nature(),
title: `Quantum Flow Theory explains Quantum Gravity`,
content: `${hashtagAndMention1}`,
}), }),
asTick.create('Post', { asTick.create('Post', {
id: 'p9', id: 'p9',
@ -566,6 +573,9 @@ import Factory from './factories'
}), }),
]) ])
const mentionInComment1 = 'I heard <a class="mention" href="/profile/u3">@jenny-rostock</a>, practice it since 3 years now.'
const mentionInComment2 = 'Did <a class="mention" href="/profile/u1">@peter-lustig</a> told you?'
await Promise.all([ await Promise.all([
asUser.create('Comment', { asUser.create('Comment', {
id: 'c1', id: 'c1',
@ -582,6 +592,12 @@ import Factory from './factories'
asTrick.create('Comment', { asTrick.create('Comment', {
id: 'c4', id: 'c4',
postId: 'p2', postId: 'p2',
content: `${mentionInComment1}`,
}),
asUser.create('Comment', {
id: 'c4-1',
postId: 'p2',
content: `${mentionInComment2}`,
}), }),
asModerator.create('Comment', { asModerator.create('Comment', {
id: 'c5', id: 'c5',
@ -692,4 +708,4 @@ import Factory from './factories'
process.exit(1) process.exit(1)
} }
})() })()
/* eslint-enable no-multi-spaces */ /* eslint-enable no-multi-spaces */