63 lines
1.2 KiB
TypeScript
63 lines
1.2 KiB
TypeScript
import { mergePartially, NestedPartial } from 'merge-partially';
|
|
import { faker } from '@faker-js/faker';
|
|
|
|
interface User {
|
|
id: string;
|
|
name: string;
|
|
}
|
|
|
|
interface Track {
|
|
id: string;
|
|
instrument: string;
|
|
}
|
|
|
|
interface Participant {
|
|
id: string;
|
|
client_id: string;
|
|
user: User;
|
|
tracks: Track[];
|
|
}
|
|
|
|
interface Invitations {
|
|
id: string;
|
|
sender_id?: string;
|
|
receiver_id?: string;
|
|
}
|
|
|
|
interface Session {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
participants?: Participant[];
|
|
invitations?: Invitations[];
|
|
}
|
|
|
|
export default function makeFakeSession(overrides?: NestedPartial<Session>): Session {
|
|
return mergePartially.deep(
|
|
{
|
|
id: faker.string.uuid(),
|
|
name: faker.lorem.sentence({ min: 3, max: 5 }),
|
|
description: faker.lorem.paragraph(),
|
|
participants: [
|
|
{
|
|
id: faker.string.uuid(),
|
|
client_id: faker.string.uuid(),
|
|
user: {
|
|
id: faker.string.uuid(),
|
|
name: faker.person.firstName(),
|
|
},
|
|
tracks: [{
|
|
id: faker.string.uuid(),
|
|
instrument: "Piano"
|
|
}]
|
|
}],
|
|
invitations: [
|
|
{
|
|
id: faker.string.uuid()
|
|
}
|
|
]
|
|
},
|
|
overrides
|
|
);
|
|
}
|