Skip to content

refactor(api/web): use cuhacking logo on cms instead of local asset #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions libs/db/access/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const isSelf = ({ req: {user} }) => {
}

export const isOrganizerOrSelf = ({ req: {user} }) => {
if (!user) return false;
if (user){
if (user.organizerTeam?.name){
return true
Expand All @@ -46,6 +45,7 @@ export const isOrganizerOrSelf = ({ req: {user} }) => {
}
}
};
return false
}

export const isSponsor = ({ req: {user} }) => {
Expand All @@ -57,17 +57,30 @@ export const isSponsor = ({ req: {user} }) => {
return false
};

export const isMentor = ({ req: {user} }) => {

export const isOrganizer = ({ req: {user} }) => {
if (user){
if (user.group.name === "Mentor"){
if (user.organizerTeam?.name){
return true
}
}
return false
return false
};
return false
}

export const isOrganizerOrSponsor = ({ req: {user} }) => {
if (user){
if (user.organizerTeam?.name){
return true
}
if (user.group.name === "Sponsor"){
return true
}
};
return false
}
Comment on lines +71 to +81
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix syntax error in isOrganizerOrSponsor function.

The function has a syntax error with a misplaced semicolon after the nested if statements, which will cause runtime errors.

 export const isOrganizerOrSponsor = ({ req: {user} }) => {
   if (user){
    if (user.organizerTeam?.name){
      return true
    }
    if (user.group.name === "Sponsor"){
      return true
    }
-};
+  }
   return false
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const isOrganizerOrSponsor = ({ req: {user} }) => {
if (user){
if (user.organizerTeam?.name){
return true
}
if (user.group.name === "Sponsor"){
return true
}
};
return false
}
export const isOrganizerOrSponsor = ({ req: {user} }) => {
if (user){
if (user.organizerTeam?.name){
return true
}
if (user.group.name === "Sponsor"){
return true
}
}
return false
}


export const isJudge = ({ req: {user} }) => {
export const isMentor = ({ req: {user} }) => {
if (user){
if (user.group.name === "Mentor"){
return true
Expand All @@ -76,15 +89,15 @@ export const isJudge = ({ req: {user} }) => {
return false
};

export const isOrganizer: IsAuthenticated = ({ req: { user } }) =>
{

export const isJudge = ({ req: {user} }) => {
if (user){
if (user.group.name === "Organizer"){
if (user.group.name === "Mentor"){
return true
}
}
return false
}
};

export const isOrganizerInTeam = (teamNames: string[]) => {
return ({ req: { user } }: AccessArgs<User>) =>
Expand Down
26 changes: 18 additions & 8 deletions libs/db/collections/models/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
authenticated,
isOrganizer,
isOrganizerOrSelf,
isOrganizerOrSponsor,
isSuperAdmin,
} from "@/db/access";
import { navAccordions } from "@/db/collections/navAccordions";
Expand Down Expand Up @@ -266,7 +267,7 @@ export const Users: CollectionConfig = {
},
},
access: {
admin: isSelf,
admin: isOrganizerOrSponsor,
read: isOrganizerOrSelf,
create: authenticated,
update: isSelf || isOrganizer || isSuperAdmin,
Expand All @@ -276,11 +277,8 @@ export const Users: CollectionConfig = {
// afterChange: [loginAfterCreate],
// },
admin: {
// hidden: (user) => {
// if (user?.id === 1){
// return false
// }
// return user?.group?.name === "Organizer" ? false : true
// hidden: ({user}) => {
// return user?.group?.name === "Hacker"
Comment on lines +280 to +281
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Commented-out hiding logic.
Confirm if it’s no longer required or just temporarily disabled.

// },
livePreview: {
url: `${process.env.CUHACKING_2025_PORTAL_LOCAL_URL}/profile`,
Expand Down Expand Up @@ -528,11 +526,15 @@ export const Users: CollectionConfig = {
{
label: "Emergency Contact",
type: "collapsible",
admin: {
hidden: true
},
fields: [
{
type: "row",
fields:[
{ name: "emergencyContactFullName", type: "text", label: "Full Name" },
{ name: "emergencyContactFullName", type: "text", label: "Full Name",
},
{
name: "emergencyContactRelationship",
type: "select",
Expand Down Expand Up @@ -612,7 +614,9 @@ export const Users: CollectionConfig = {
{
type: "collapsible",
label: "GitHub",
admin: { readOnly: true },
admin: {
hidden: true
},
Comment on lines +617 to +619
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Hidden GitHub collapsible.
If it’s not used, this is fine. Otherwise re-check if you need it visible.

fields: [
{
name: "githubUrl",
Expand Down Expand Up @@ -706,6 +710,9 @@ export const Users: CollectionConfig = {
{
type: "collapsible",
label: "Discord",
admin: {
hidden: true
},
fields: [
{
name: "discordUsername",
Expand Down Expand Up @@ -742,6 +749,9 @@ export const Users: CollectionConfig = {
{
type: "collapsible",
label: "Google",
admin: {
hidden: true
},
fields: [
{ name: "googleEmail", type: "email" },
{
Expand Down
Loading