({
userId,
teamId,
name,
fields,
routes = [],
}: {
name: string;
userId: number;
teamId: number | null;
routes?: Route[];
fields: {
type: string;
label: string;
identifier?: string;
required: boolean;
options?: {
label: string;
id: string | null;
}[];
}[];
})
| 18 | export const createRoutingFormsFixture = () => { |
| 19 | return { |
| 20 | async create({ |
| 21 | userId, |
| 22 | teamId, |
| 23 | name, |
| 24 | fields, |
| 25 | routes = [], |
| 26 | }: { |
| 27 | name: string; |
| 28 | userId: number; |
| 29 | teamId: number | null; |
| 30 | routes?: Route[]; |
| 31 | fields: { |
| 32 | type: string; |
| 33 | label: string; |
| 34 | identifier?: string; |
| 35 | required: boolean; |
| 36 | options?: { |
| 37 | label: string; |
| 38 | id: string | null; |
| 39 | }[]; |
| 40 | }[]; |
| 41 | }) { |
| 42 | return await prisma.app_RoutingForms_Form.create({ |
| 43 | data: { |
| 44 | name, |
| 45 | userId, |
| 46 | teamId, |
| 47 | routes: [ |
| 48 | ...routes, |
| 49 | // Add a fallback route always, this is taken care of tRPC route normally but do it manually while running the query directly. |
| 50 | { |
| 51 | id: "898899aa-4567-489a-bcde-f1823f708646", |
| 52 | action: { type: "customPageMessage", value: "Fallback Message" }, |
| 53 | isFallback: true, |
| 54 | queryValue: { id: "898899aa-4567-489a-bcde-f1823f708646", type: "group" }, |
| 55 | }, |
| 56 | ], |
| 57 | fields: fields.map((f) => ({ |
| 58 | id: uuidv4(), |
| 59 | ...f, |
| 60 | })), |
| 61 | }, |
| 62 | }); |
| 63 | }, |
| 64 | }; |
| 65 | }; |
no test coverage detected