Update seeds to create post with a category

This commit is contained in:
Matt Rider 2019-08-20 16:39:26 +02:00
parent a000719663
commit 7bbbf40bcc

View File

@ -276,131 +276,82 @@ import Factory from './factories'
asAdmin.create('Post', { asAdmin.create('Post', {
id: 'p0', id: 'p0',
image: faker.image.unsplash.food(), image: faker.image.unsplash.food(),
categoryIds: ['cat16'],
}), }),
asModerator.create('Post', { asModerator.create('Post', {
id: 'p1', id: 'p1',
image: faker.image.unsplash.technology(), image: faker.image.unsplash.technology(),
categoryIds: ['cat1'],
}), }),
asUser.create('Post', { asUser.create('Post', {
id: 'p2', id: 'p2',
title: `Nature Philosophy Yoga`, title: `Nature Philosophy Yoga`,
content: `${hashtag1}`, content: `${hashtag1}`,
categoryIds: ['cat2'],
}), }),
asTick.create('Post', { asTick.create('Post', {
id: 'p3', id: 'p3',
categoryIds: ['cat3'],
}), }),
asTrick.create('Post', { asTrick.create('Post', {
id: 'p4', id: 'p4',
categoryIds: ['cat4'],
}), }),
asTrack.create('Post', { asTrack.create('Post', {
id: 'p5', id: 'p5',
categoryIds: ['cat5'],
}), }),
asAdmin.create('Post', { asAdmin.create('Post', {
id: 'p6', id: 'p6',
image: faker.image.unsplash.buildings(), image: faker.image.unsplash.buildings(),
categoryIds: ['cat6'],
}), }),
asModerator.create('Post', { asModerator.create('Post', {
id: 'p7', id: 'p7',
content: `${mention1} ${faker.lorem.paragraph()}`, content: `${mention1} ${faker.lorem.paragraph()}`,
categoryIds: ['cat7'],
}), }),
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`, title: `Quantum Flow Theory explains Quantum Gravity`,
content: `${hashtagAndMention1}`, content: `${hashtagAndMention1}`,
categoryIds: ['cat8'],
}), }),
asTick.create('Post', { asTick.create('Post', {
id: 'p9', id: 'p9',
categoryIds: ['cat9'],
}), }),
asTrick.create('Post', { asTrick.create('Post', {
id: 'p10', id: 'p10',
categoryIds: ['cat10'],
}), }),
asTrack.create('Post', { asTrack.create('Post', {
id: 'p11', id: 'p11',
image: faker.image.unsplash.people(), image: faker.image.unsplash.people(),
categoryIds: ['cat11'],
}), }),
asAdmin.create('Post', { asAdmin.create('Post', {
id: 'p12', id: 'p12',
content: `${mention2} ${faker.lorem.paragraph()}`, content: `${mention2} ${faker.lorem.paragraph()}`,
categoryIds: ['cat12'],
}), }),
asModerator.create('Post', { asModerator.create('Post', {
id: 'p13', id: 'p13',
categoryIds: ['cat13'],
}), }),
asUser.create('Post', { asUser.create('Post', {
id: 'p14', id: 'p14',
image: faker.image.unsplash.objects(), image: faker.image.unsplash.objects(),
categoryIds: ['cat14'],
}), }),
asTick.create('Post', { asTick.create('Post', {
id: 'p15', id: 'p15',
categoryIds: ['cat15'],
}), }),
]) ])
await Promise.all([ await Promise.all([
f.relate('Post', 'Categories', {
from: 'p0',
to: 'cat16',
}),
f.relate('Post', 'Categories', {
from: 'p1',
to: 'cat1',
}),
f.relate('Post', 'Categories', {
from: 'p2',
to: 'cat2',
}),
f.relate('Post', 'Categories', {
from: 'p3',
to: 'cat3',
}),
f.relate('Post', 'Categories', {
from: 'p4',
to: 'cat4',
}),
f.relate('Post', 'Categories', {
from: 'p5',
to: 'cat5',
}),
f.relate('Post', 'Categories', {
from: 'p6',
to: 'cat6',
}),
f.relate('Post', 'Categories', {
from: 'p7',
to: 'cat7',
}),
f.relate('Post', 'Categories', {
from: 'p8',
to: 'cat8',
}),
f.relate('Post', 'Categories', {
from: 'p9',
to: 'cat9',
}),
f.relate('Post', 'Categories', {
from: 'p10',
to: 'cat10',
}),
f.relate('Post', 'Categories', {
from: 'p11',
to: 'cat11',
}),
f.relate('Post', 'Categories', {
from: 'p12',
to: 'cat12',
}),
f.relate('Post', 'Categories', {
from: 'p13',
to: 'cat13',
}),
f.relate('Post', 'Categories', {
from: 'p14',
to: 'cat14',
}),
f.relate('Post', 'Categories', {
from: 'p15',
to: 'cat15',
}),
f.relate('Post', 'Tags', { f.relate('Post', 'Tags', {
from: 'p0', from: 'p0',
to: 'Freiheit', to: 'Freiheit',