|
| 1 | +import { Prisma } from '@prisma/client'; |
| 2 | +import { connectUser, connectOrganization } from '../utils/common.factory.js'; |
| 3 | + |
| 4 | +type ShopConfig = { |
| 5 | + name: string; |
| 6 | + description: string; |
| 7 | +}; |
| 8 | + |
| 9 | +type MachineryConfig = { |
| 10 | + name: string; |
| 11 | + shopName: string; |
| 12 | + quantity: number; |
| 13 | +}; |
| 14 | + |
| 15 | +export const shopConfigs: ShopConfig[] = [ |
| 16 | + { name: 'Forsyth Machine Shop', description: 'MIE Club Machine Shop' }, |
| 17 | + { name: 'Richards 054', description: 'Main Richards Makerspace' }, |
| 18 | + { name: 'Richards 055', description: 'Richards Basement Shop' }, |
| 19 | + { name: 'Richards 050', description: 'THE BAYYYYYY WOOOO' }, // Fire description |
| 20 | + { name: 'EXP Machine Shop', description: 'Basement of EXP' } |
| 21 | +]; |
| 22 | + |
| 23 | +export const machineryConfigs: MachineryConfig[] = [ |
| 24 | + // Forsyth Machine Shop |
| 25 | + { name: 'Front Tormach 1100MX', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 26 | + { name: 'Middle Tormach 1100MX', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 27 | + { name: 'Rear Tormach 1100MX', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 28 | + { name: 'Right Tormach 1100MX', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 29 | + { name: 'Front Manual Mill', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 30 | + { name: 'Rear Manual Mill', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 31 | + { name: 'Front Manual Lathe', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 32 | + { name: 'ProtoTRAK CNC Lathe', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 33 | + { name: 'Tormach 24R CNC Router', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 34 | + { name: 'Haas VF2 YT', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 35 | + { name: 'Cold Cut Saw', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 36 | + { name: 'Rear Manual Lathe', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 37 | + { name: 'Vertical Bandsaw', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 38 | + { name: 'Horizontal Bandsaw', shopName: 'Forsyth Machine Shop', quantity: 1 }, |
| 39 | + |
| 40 | + // Richards 054 |
| 41 | + { name: 'Hydraulic Press', shopName: 'Richards 054', quantity: 1 }, |
| 42 | + { name: 'Arbor Press (Baja)', shopName: 'Richards 054', quantity: 1 }, |
| 43 | + { name: 'Sheet Metal Brake', shopName: 'Richards 054', quantity: 1 }, |
| 44 | + |
| 45 | + // Richards 055 |
| 46 | + { name: 'Protomax Waterjet', shopName: 'Richards 055', quantity: 1 }, |
| 47 | + { name: 'Drill Press', shopName: 'Richards 055', quantity: 1 }, |
| 48 | + { name: 'Belt/Rotary Sander', shopName: 'Richards 055', quantity: 1 }, |
| 49 | + { name: 'Bench Grinder', shopName: 'Richards 055', quantity: 2 }, |
| 50 | + { name: 'Vertical Bandsaw', shopName: 'Richards 055', quantity: 1 }, |
| 51 | + { name: 'Horizontal Bandsaw', shopName: 'Richards 055', quantity: 1 }, |
| 52 | + |
| 53 | + // Richards 050 |
| 54 | + { name: 'Bambu Lab P1P', shopName: 'Richards 050', quantity: 1 }, |
| 55 | + { name: 'Bambu Lab H2S', shopName: 'Richards 050', quantity: 1 }, |
| 56 | + |
| 57 | + // EXP Machine Shop |
| 58 | + { name: 'Tormach 1100MX', shopName: 'EXP Machine Shop', quantity: 1 }, |
| 59 | + { name: 'Omax Waterjet', shopName: 'EXP Machine Shop', quantity: 1 } |
| 60 | +]; |
| 61 | + |
| 62 | +export const shopCreateInput = ( |
| 63 | + userCreatedId: string, |
| 64 | + organizationId: string, |
| 65 | + config: ShopConfig |
| 66 | +): Prisma.ShopCreateInput => ({ |
| 67 | + name: config.name, |
| 68 | + description: config.description, |
| 69 | + userCreated: connectUser(userCreatedId), |
| 70 | + organization: connectOrganization(organizationId) |
| 71 | +}); |
| 72 | + |
| 73 | +export const machineryCreateInput = ( |
| 74 | + userCreatedId: string, |
| 75 | + organizationId: string, |
| 76 | + config: MachineryConfig |
| 77 | +): Prisma.MachineryCreateInput => ({ |
| 78 | + name: config.name, |
| 79 | + userCreated: connectUser(userCreatedId), |
| 80 | + organization: connectOrganization(organizationId) |
| 81 | +}); |
| 82 | + |
| 83 | +export const shopMachineryCreateInput = ( |
| 84 | + shopId: string, |
| 85 | + machineryId: string, |
| 86 | + quantity: number |
| 87 | +): Prisma.Shop_MachineryCreateInput => ({ |
| 88 | + shop: { connect: { shopId } }, |
| 89 | + machinery: { connect: { machineryId } }, |
| 90 | + quantity |
| 91 | +}); |
0 commit comments