Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Commit fb93072

Browse files
committed
feat(axiom): add hardware model
1 parent 2a8d63b commit fb93072

File tree

11 files changed

+362
-3
lines changed

11 files changed

+362
-3
lines changed

apps/axiom/src/components/Nav/navIconMap.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
PersonStanding,
1111
MousePointer2,
1212
Trophy,
13-
CalendarDays
13+
CalendarDays,
14+
Cpu
1415
} from 'lucide-react'
1516
import { ExoticComponent } from 'react'
1617

@@ -28,6 +29,7 @@ export const navIconMap: Partial<
2829
"base-event": CalendarDays,
2930
"general-event": CalendarDays,
3031
"application-form": MousePointer2,
32+
hardware: Cpu
3133
}
3234

3335
export const getNavIcon = (slug: string) =>

libs/cms/configs/server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {Sponsor,
1212
ApplicationForm,
1313
Media,
1414
Emails,
15+
Hardware,
1516
Users,
1617
Teams } from "@/db/collections/models";
1718
import {Constants} from "@/db/globals";
@@ -36,6 +37,7 @@ export const baseConfig = {
3637
Emails,
3738
Roles,
3839
BaseEvent,
40+
Hardware,
3941
ApplicationForm,
4042
GeneralEvent,
4143
UserToEvent,

libs/db/collections/Brands/Brands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { CollectionBeforeChangeHook, CollectionConfig } from 'payload/types'
2+
import { adminGroups } from '@/db/collections/adminGroups'
23

34
const SOCIAL_MEDIA_PLATFORMS = [
45
{ key: 'github', domain: 'github.com', label: 'GitHub' },
@@ -78,6 +79,7 @@ export const Brands: CollectionConfig = {
7879
admin: {
7980
useAsTitle: 'name',
8081
defaultColumns: ['name', 'description', 'id', 'updatedAt', 'createdAt'],
82+
group: adminGroups.inventory,
8183
},
8284
hooks: {
8385
beforeChange: [generateSocialLinks],

libs/db/collections/adminGroups.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export const adminGroups = {
22
globals: '🫙 Globals',
33
relations: '↔ Relations',
4-
communication: ' Communication',
5-
featured: '🫂 Users',
4+
communication: '📢 Communication',
5+
featured: '🫂 People',
66
events: '🍾 Events',
7+
inventory: '📦 Inventory',
78
}

libs/db/collections/models/Challenge.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import type { CollectionConfig } from 'payload'
2+
import { adminGroups } from '@/db/collections/adminGroups'
23

34
export const Challenge: CollectionConfig = {
45
slug: 'challenge',
56
admin: {
67
useAsTitle: 'title',
8+
group: adminGroups.inventory,
79
},
810
fields: [
911
{
@@ -48,6 +50,9 @@ export const Challenge: CollectionConfig = {
4850

4951
export const ChallengePrize: CollectionConfig = {
5052
slug: 'challengePrize',
53+
admin: {
54+
group: adminGroups.inventory,
55+
},
5156
fields: [
5257
{
5358
name: 'formattedTitle',
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
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+
];

libs/db/collections/models/Media.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import type { CollectionConfig } from 'payload'
22

3+
import { adminGroups } from '@/db/collections/adminGroups'
4+
35
export const Media: CollectionConfig = {
46
slug: 'media',
57
admin: {
8+
group: adminGroups.inventory,
69
defaultColumns: [
710
'filename',
811
'alt',

libs/db/collections/models/Organization.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { CollectionConfig } from 'payload'
22
import { authenticated } from '@/db/access'
3+
import { adminGroups } from '@/db/collections/adminGroups'
34
// import { validateURL } from '@cuhacking/db/shared/utils/validate-url'
45

56
export const Organization: CollectionConfig = {
@@ -10,6 +11,7 @@ export const Organization: CollectionConfig = {
1011
},
1112
admin: {
1213
useAsTitle: 'name',
14+
group: adminGroups.inventory,
1315
},
1416
fields: [
1517
{
@@ -45,6 +47,7 @@ export const Sponsor: CollectionConfig = {
4547
slug: 'sponsor',
4648
admin: {
4749
useAsTitle: 'formattedTitle',
50+
group: adminGroups.inventory,
4851
},
4952
fields: [
5053
{

libs/db/collections/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ export * from './Sponsor-To-Event'
1111
export * from './Teams'
1212
export * from './User-To-Event'
1313
export * from './Users'
14+
export * from './Hardware'

0 commit comments

Comments
 (0)