mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
refactor(seeds): Use buildList to setup lists
This commit is contained in:
parent
fc367297e3
commit
f9c42ab2a5
@ -933,334 +933,140 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
|||||||
trollingComment.update({ disabled: true, updatedAt: new Date().toISOString(), closed: true }),
|
trollingComment.update({ disabled: true, updatedAt: new Date().toISOString(), closed: true }),
|
||||||
])
|
])
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('user', 30)
|
||||||
[...Array(30).keys()].map(i => {
|
|
||||||
return Factory.build('user')
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'post', 30, {
|
||||||
[...Array(30).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'post',
|
|
||||||
{
|
|
||||||
image: faker.image.unsplash.objects(),
|
image: faker.image.unsplash.objects(),
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
categoryIds: ['cat1'],
|
categoryIds: ['cat1'],
|
||||||
author: jennyRostock,
|
author: jennyRostock,
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 6, {}, {
|
||||||
[...Array(6).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: jennyRostock,
|
author: jennyRostock,
|
||||||
postId: 'p2',
|
postId: 'p2',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 4, {}, {
|
||||||
[...Array(4).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: jennyRostock,
|
author: jennyRostock,
|
||||||
postId: 'p15',
|
postId: 'p15',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'comment', 2, {}, {
|
||||||
[...Array(2).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: jennyRostock,
|
author: jennyRostock,
|
||||||
postId: 'p4',
|
postId: 'p4',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('post', 21, {
|
||||||
[...Array(21).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'post',
|
|
||||||
{
|
|
||||||
image: faker.image.unsplash.buildings(),
|
image: faker.image.unsplash.buildings(),
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
author: peterLustig,
|
author: peterLustig,
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 3, {}, {
|
||||||
[...Array(3).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: peterLustig,
|
author: peterLustig,
|
||||||
postId: 'p4',
|
postId: 'p4',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 5, {}, {
|
||||||
[...Array(5).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: peterLustig,
|
author: peterLustig,
|
||||||
postId: 'p14',
|
postId: 'p14',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 6, {}, {
|
||||||
[...Array(6).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: peterLustig,
|
author: peterLustig,
|
||||||
postId: 'p0',
|
postId: 'p0',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'post', 11, {
|
||||||
[...Array(11).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'post',
|
|
||||||
{
|
|
||||||
image: faker.image.unsplash.food(),
|
image: faker.image.unsplash.food(),
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
author: dewey,
|
author: dewey,
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'comment', 7, {}, {
|
||||||
[...Array(7).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: dewey,
|
author: dewey,
|
||||||
postId: 'p2',
|
postId: 'p2',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'comment', 5, {}, {
|
||||||
[...Array(5).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: dewey,
|
author: dewey,
|
||||||
postId: 'p6',
|
postId: 'p6',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'comment', 2, {}, {
|
||||||
[...Array(2).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: dewey,
|
author: dewey,
|
||||||
postId: 'p9',
|
postId: 'p9',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('post', 16, {
|
||||||
[...Array(16).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'post',
|
|
||||||
{
|
|
||||||
image: faker.image.unsplash.technology(),
|
image: faker.image.unsplash.technology(),
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
author: louie,
|
author: louie,
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 4, {}, {
|
||||||
[...Array(4).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
postId: 'p1',
|
postId: 'p1',
|
||||||
author: louie,
|
author: louie,
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 8, {}, {
|
||||||
[...Array(8).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: louie,
|
author: louie,
|
||||||
postId: 'p10',
|
postId: 'p10',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 5, {}, {
|
||||||
[...Array(5).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: louie,
|
author: louie,
|
||||||
postId: 'p13',
|
postId: 'p13',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('post', 45, {
|
||||||
[...Array(45).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'post',
|
|
||||||
{
|
|
||||||
image: faker.image.unsplash.people(),
|
image: faker.image.unsplash.people(),
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
author: bobDerBaumeister,
|
author: bobDerBaumeister,
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 2, {}, {
|
||||||
[...Array(2).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: bobDerBaumeister,
|
author: bobDerBaumeister,
|
||||||
postId: 'p2',
|
postId: 'p2',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'comment', 3, {}, {
|
||||||
[...Array(3).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: bobDerBaumeister,
|
author: bobDerBaumeister,
|
||||||
postId: 'p12',
|
postId: 'p12',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'comment', 7, {}, {
|
||||||
[...Array(7).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: bobDerBaumeister,
|
author: bobDerBaumeister,
|
||||||
postId: 'p13',
|
postId: 'p13',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'post', 8, {
|
||||||
[...Array(8).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'post',
|
|
||||||
{
|
|
||||||
image: faker.image.unsplash.nature(),
|
image: faker.image.unsplash.nature(),
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
author: huey,
|
author: huey,
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 6, {}, {
|
||||||
[...Array(6).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: huey,
|
author: huey,
|
||||||
postId: 'p0',
|
postId: 'p0',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList( 'comment', 8, {}, {
|
||||||
[...Array(8).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: huey,
|
author: huey,
|
||||||
postId: 'p13',
|
postId: 'p13',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Promise.all(
|
await Factory.buildList('comment', 9, {}, {
|
||||||
[...Array(9).keys()].map(() => {
|
|
||||||
return Factory.build(
|
|
||||||
'comment',
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
author: huey,
|
author: huey,
|
||||||
postId: 'p15',
|
postId: 'p15',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await Factory.build('donations')
|
await Factory.build('donations')
|
||||||
/* eslint-disable-next-line no-console */
|
/* eslint-disable-next-line no-console */
|
||||||
console.log('Seeded Data...')
|
console.log('Seeded Data...')
|
||||||
|
await driver.close()
|
||||||
|
await neode.close()
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
/* eslint-disable-next-line no-console */
|
/* eslint-disable-next-line no-console */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user