mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
fix: seed file warnings
This commit is contained in:
@@ -8,7 +8,6 @@ export default class extends BaseSeeder {
|
|||||||
static environment = ['development', 'testing'];
|
static environment = ['development', 'testing'];
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
// eslint-disable-next-line unicorn/no-await-expression-member
|
|
||||||
const users = await getUserIds();
|
const users = await getUserIds();
|
||||||
|
|
||||||
const collections = faker.helpers.multiple(
|
const collections = faker.helpers.multiple(
|
||||||
@@ -26,14 +25,16 @@ export async function getUserIds() {
|
|||||||
return users.map(({ id }) => id);
|
return users.map(({ id }) => id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let collectionId = 0;
|
||||||
function createRandomCollection(userIds: User['id'][]) {
|
function createRandomCollection(userIds: User['id'][]) {
|
||||||
const authorId = faker.helpers.arrayElements(userIds, 1).at(0);
|
const authorId = faker.helpers.arrayElements(userIds, 1).at(0);
|
||||||
|
collectionId++;
|
||||||
return {
|
return {
|
||||||
id: faker.string.uuid(),
|
id: collectionId,
|
||||||
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
||||||
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
||||||
visibility: Visibility.PRIVATE,
|
visibility: Visibility.PRIVATE,
|
||||||
nextId: undefined,
|
nextId: collectionId + 1,
|
||||||
authorId,
|
authorId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ export default class extends BaseSeeder {
|
|||||||
static environment = ['development', 'testing'];
|
static environment = ['development', 'testing'];
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
// eslint-disable-next-line unicorn/no-await-expression-member
|
|
||||||
const users = await getUserIds();
|
const users = await getUserIds();
|
||||||
|
|
||||||
const links = await Promise.all(
|
const links = await Promise.all(
|
||||||
|
|||||||
Reference in New Issue
Block a user