58 lines
1.2 KiB
TypeScript
58 lines
1.2 KiB
TypeScript
import { mergePartially, NestedPartial } from 'merge-partially';
|
|
import { faker } from '@faker-js/faker';
|
|
import { IUser } from './user';
|
|
|
|
interface ITrack {
|
|
id: string;
|
|
instrument: string;
|
|
}
|
|
|
|
interface IParticipant {
|
|
id: string;
|
|
client_id: string;
|
|
user: IUser;
|
|
tracks: ITrack[];
|
|
}
|
|
|
|
interface IInvitations {
|
|
id: string;
|
|
sender_id?: string;
|
|
receiver_id?: string;
|
|
}
|
|
|
|
interface ISession {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
participants?: IParticipant[];
|
|
invitations?: IInvitations[];
|
|
}
|
|
|
|
export default function makeFakeSession(overrides?: NestedPartial<ISession>): ISession {
|
|
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(),
|
|
},
|
|
tracks: [{
|
|
id: faker.string.uuid(),
|
|
instrument: "Piano"
|
|
}]
|
|
}],
|
|
invitations: [
|
|
{
|
|
id: faker.string.uuid()
|
|
}
|
|
]
|
|
},
|
|
overrides
|
|
);
|
|
}
|