Skip to content

Commit

Permalink
feat: groupSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
javalosr2004 committed Feb 16, 2024
1 parent c0b31b8 commit e553a80
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 30 deletions.
3 changes: 0 additions & 3 deletions .env.example

This file was deleted.

22 changes: 3 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/components/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function Calendar(props: { events: FCEvent[]; admin: Boolean }) {
return (
<div>
<div className={style.wrapper}>
<CreateEditEvent create={false} showModal={showModal} setShowModal={setShowModal}></CreateEditEvent>
<CreateEditEvent create={true} showModal={showModal} setShowModal={setShowModal}></CreateEditEvent>
<FullCalendar
customButtons={buttonType}
plugins={[
Expand Down
4 changes: 1 addition & 3 deletions src/app/components/ExpandedViewComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ const EventExpandedView: React.FC<EventExpandedViewProps> = ({ eventDetails }) =
<Text>
<strong>{eventDetails.location}</strong>
</Text>
<Text mb={8}>
<strong>{eventDetails.groupsAllowed}/{eventDetails.groupsAllowed} Participants</strong>
</Text>

<Text mb={12}>
{eventDetails.description}
</Text>
Expand Down
4 changes: 2 additions & 2 deletions src/database/eventSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type IEvent = {
startTime: Date;
endTime: Date;
volunteerEvent: boolean;
groupsAllowed: number[];
groupsAllowed: Schema.Types.ObjectId[];
attendeeIds: Schema.Types.ObjectId[];
};

Expand All @@ -23,7 +23,7 @@ const eventSchema = new Schema<IEvent>({
startTime: { type: Date, required: true },
endTime: { type: Date, required: true },
volunteerEvent: { type: Boolean, required: true },
groupsAllowed: { type: [Number], required: false },
groupsAllowed: { type: [Schema.Types.ObjectId], required: false },
attendeeIds: { type: [Schema.Types.ObjectId], required: true, default: [] },
});

Expand Down
13 changes: 13 additions & 0 deletions src/database/groupSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import mongoose, { Mongoose, Schema } from "mongoose";

export type IGroup = {
group_name: string;
groupees: Schema.Types.ObjectId[];
};

const Group = new Schema<IGroup>({
group_name: { type: String, required: true },
groupees: { type: [Schema.Types.ObjectId], required: true, default: [] },
});

export default mongoose.models["groups"] || mongoose.model("groups", Group);
4 changes: 2 additions & 2 deletions src/database/userSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type IUser = {
role: "user" | "supervisor" | "admin";
eventsAttended: [Schema.Types.ObjectId];
digitalWaiver: Schema.Types.ObjectId | null;
groupId: number | null;
groupId: Schema.Types.ObjectId | null;
};

const UserSchema = new Schema<IUser>({
Expand All @@ -54,7 +54,7 @@ const UserSchema = new Schema<IUser>({
required: true,
default: [],
},
groupId: { type: Number, required: false },
groupId: { type: Schema.Types.ObjectId, required: false },
digitalWaiver: { type: Schema.Types.ObjectId, required: false },
});

Expand Down

0 comments on commit e553a80

Please sign in to comment.