|
| 1 | +import type { CollectionConfig } from 'payload' |
| 2 | +import { admins, adminsAndUser, anyone, |
| 3 | + // checkRole |
| 4 | +} from '@/db/access' |
| 5 | +import { adminGroups } from '@/db/collections/adminGroups' |
| 6 | + |
| 7 | +export const Hardware: CollectionConfig = { |
| 8 | + slug: 'hardware', |
| 9 | + access: { |
| 10 | + read: adminsAndUser, |
| 11 | + create: admins, |
| 12 | + update: admins, |
| 13 | + delete: admins, |
| 14 | + }, |
| 15 | + admin: { |
| 16 | + group: adminGroups.inventory, |
| 17 | + defaultColumns: [ |
| 18 | + 'images', |
| 19 | + 'name', |
| 20 | + 'description', |
| 21 | + 'resources', |
| 22 | + 'quantity', |
| 23 | + 'categories', |
| 24 | + 'id', |
| 25 | + ] |
| 26 | + }, |
| 27 | + fields: [ |
| 28 | + { |
| 29 | + name: 'name', |
| 30 | + type: 'text', |
| 31 | + }, |
| 32 | + { |
| 33 | + name: 'description', |
| 34 | + type: 'richText', |
| 35 | + }, |
| 36 | + { |
| 37 | + name: 'resources', |
| 38 | + type: 'richText', |
| 39 | + }, |
| 40 | + { |
| 41 | + name: 'quantity', |
| 42 | + type: 'number', |
| 43 | + admin: { |
| 44 | + position: 'sidebar' |
| 45 | + }, |
| 46 | + }, |
| 47 | + { |
| 48 | + name: 'categories', |
| 49 | + type: 'select', |
| 50 | + hasMany: true, |
| 51 | + admin: { |
| 52 | + position: 'sidebar' |
| 53 | + }, |
| 54 | + options: [ |
| 55 | + { label: 'Basics', value: 'basics' }, |
| 56 | + { label: 'Parts', value: 'parts' }, |
| 57 | + { label: 'Communication', value: 'communication' }, |
| 58 | + { label: 'Display', value: 'display' }, |
| 59 | + { label: 'Microcontrollers', value: 'microcontrollers' }, |
| 60 | + { label: 'Power', value: 'power' }, |
| 61 | + { label: 'Cables', value: 'cables' }, |
| 62 | + { label: 'Motor + control', value: 'motorpluscontrol' }, |
| 63 | + { label: 'Sensors', value: 'sensors' }, |
| 64 | + { label: 'Peripherals + Accessories', value: 'peripheralsplusaccessories' }, |
| 65 | + { label: 'Miscellaneous', value: 'miscellaneous' }, |
| 66 | + { label: 'VR', value: 'vr' }, |
| 67 | + { label: 'Lottery', value: 'lottery' }, |
| 68 | + ], |
| 69 | + }, |
| 70 | + { |
| 71 | + name: 'images', |
| 72 | + type: 'array', |
| 73 | + admin: { |
| 74 | + position: 'sidebar' |
| 75 | + }, |
| 76 | + fields: [ |
| 77 | + { |
| 78 | + name: 'image', |
| 79 | + type: 'upload', |
| 80 | + relationTo: 'media', |
| 81 | + } |
| 82 | + ] |
| 83 | + }, |
| 84 | + ], |
| 85 | +} |
| 86 | + |
| 87 | +export const hardwareSeedData = [ |
| 88 | + { |
| 89 | + images: [ |
| 90 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/2826/8360/879-1__51603.1644937292.jpg?c=2" }, |
| 91 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/2826/8359/Raspberry_Pi_Screen_4_1200x__99444.1644935903.jpg?c=2" } |
| 92 | + ], |
| 93 | + name: "1602 LCD Display Module DC 5V 16x2 Blue Backlight", |
| 94 | + description: { |
| 95 | + children: [ |
| 96 | + { |
| 97 | + type: "ul", |
| 98 | + children: [ |
| 99 | + { type: "li", children: [{ text: "LCD display module with blue backlight" }] }, |
| 100 | + { type: "li", children: [{ text: "Wide viewing angle and high contrast" }] }, |
| 101 | + { type: "li", children: [{ text: "Built-in industry standard HD44780 equivalent LCD controller" }] }, |
| 102 | + { type: "li", children: [{ text: "Commonly used in: copiers, fax machines, laser printers, Raspberry Pi DIY Users" }] }, |
| 103 | + { type: "li", children: [{ text: "LCM type: Characters" }] }, |
| 104 | + { type: "li", children: [{ text: "Can display 2-lines X 16-characters." }] }, |
| 105 | + { type: "li", children: [{ text: "Voltage: 5V DC" }] }, |
| 106 | + { type: "li", children: [{ text: "Module size: 80mm x 35mm x 11mm" }] }, |
| 107 | + { type: "li", children: [{ text: "Viewing area size: 64.5mm x 16mm" }] } |
| 108 | + ] |
| 109 | + } |
| 110 | + ] |
| 111 | + }, |
| 112 | + resources: { |
| 113 | + children: [] |
| 114 | + }, |
| 115 | + quantity: 40, |
| 116 | + categories: ["display"] |
| 117 | + }, |
| 118 | + { |
| 119 | + images: [ |
| 120 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/360/977/apiet5tdg__65616.1554985042.jpg?c=2" }, |
| 121 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/360/978/apiwf1p4q__51288.1554985044.jpg?c=2" } |
| 122 | + ], |
| 123 | + name: "Blue Screen LCD12864 Display With Backlight 5V", |
| 124 | + description: { |
| 125 | + children: [ |
| 126 | + { type: "paragraph", children: [{ text: "A 128x64 pixel LCD display module with a blue backlight and 5V operation." }] } |
| 127 | + ] |
| 128 | + }, |
| 129 | + resources: { |
| 130 | + children: [] |
| 131 | + }, |
| 132 | + quantity: 25, |
| 133 | + categories: ["display"] |
| 134 | + }, |
| 135 | + { |
| 136 | + images: [ |
| 137 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/368/999/apihrfbtv__24433.1554985090.jpg?c=2" } |
| 138 | + ], |
| 139 | + name: "Active Buzzer - 5V", |
| 140 | + description: { |
| 141 | + children: [ |
| 142 | + { type: "paragraph", children: [{ text: "A simple 5V active buzzer for sound applications." }] } |
| 143 | + ] |
| 144 | + }, |
| 145 | + resources: { |
| 146 | + children: [] |
| 147 | + }, |
| 148 | + quantity: 50, |
| 149 | + categories: ["peripheralsplusaccessories"] |
| 150 | + }, |
| 151 | + { |
| 152 | + images: [ |
| 153 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/2596/7310/40_41_42_43_44__80468.1542985281__16363.1618930134.jpg?c=2" }, |
| 154 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/2596/7309/910_source_1542985282__79719.1618930127.jpg?c=2" } |
| 155 | + ], |
| 156 | + name: "USB A-Male to USB Micro-B Cable - 3ft", |
| 157 | + description: { |
| 158 | + children: [ |
| 159 | + { type: "paragraph", children: [{ text: "USB A-Male to USB Micro-B Cable - 3ft. Perfect for Micro:bit and some Arduino boards!" }] } |
| 160 | + ] |
| 161 | + }, |
| 162 | + resources: { |
| 163 | + children: [] |
| 164 | + }, |
| 165 | + quantity: 100, |
| 166 | + categories: ["cables"] |
| 167 | + }, |
| 168 | + { |
| 169 | + images: [ |
| 170 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/3685/11887/ABX00083_00.default_1000x750__94279.1714074326.jpg?c=2" }, |
| 171 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/3685/11888/ABX00083_01.iso_1000x750__01675.1714074347.jpg?c=2" }, |
| 172 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/3685/11889/ABX00083_02.back_1000x750__47015.1714074365.jpg?c=2" }, |
| 173 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/3685/11890/ABX00083_03.unbox_1000x750__59921.1714074380.jpg?c=2" }, |
| 174 | + { image: "https://cdn11.bigcommerce.com/s-am5zt8xfow/images/stencil/1280x1280/products/3685/11887/ABX00083_00.default_1000x750__94279.1714074326.jpg?c=2" } |
| 175 | + ], |
| 176 | + name: "Arduino Nano ESP32 with Headers", |
| 177 | + description: { |
| 178 | + children: [ |
| 179 | + { type: "paragraph", children: [{ text: "An ESP32-based Arduino Nano with headers, ideal for IoT and embedded applications." }] } |
| 180 | + ] |
| 181 | + }, |
| 182 | + resources: { |
| 183 | + children: [] |
| 184 | + }, |
| 185 | + quantity: 30, |
| 186 | + categories: ["microcontrollers"] |
| 187 | + } |
| 188 | +]; |
0 commit comments