Skip to content
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

Update Event.ts and EventCollection.ts #160

Open
wants to merge 2 commits 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
11 changes: 4 additions & 7 deletions src/components/calendar/EventModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,11 @@ const Header: React.FC<{ data: BodyProps | null | undefined }> = ({ data }) => {
}
dayjs.extend(LocalizedFormat)
const startDate = dayjs(data.startDate).format('lll')

return (
<Flex justify="space-between" py={8}>
<Box float="left">{data.name}</Box>
{/* <Box float="right">{data.startDate.toString()}</Box> */}
<Box float="right">{startDate}</Box>
<Box float="right">{`Starts: ` + startDate}</Box>
</Flex>
)
}
Expand All @@ -122,16 +121,14 @@ const Body: React.FC<{ data: BodyProps | null | undefined }> = ({ data }) => {
}

dayjs.extend(LocalizedFormat)
const startDate = dayjs(data.startDate).format('lll')
const endDate = dayjs(data.endDate).format('lll')

const description = data.description;
return (
<Flex direction="column">
<Flex justify="space-between" py={4}>
<Box>{'Time: 1000 - 1200'}</Box>
<Box>{'Venue: LT69'}</Box>
<Box float="left">{`Event Description: ` + description}</Box>
<Box float="right">{`Ends: ` + endDate}</Box>
</Flex>
<Box py={6}>{'Description: This is a very fun event.'}</Box>
</Flex>
)
}
Expand Down
21 changes: 12 additions & 9 deletions src/server/db/collections/admin/EventCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ type User = {
}

export type Event = {
attendees: number
endDate: FirebaseFirestore.Timestamp | Date
hasStarted: boolean
id?: string
invitedAttendees: User[]
name: string
departments: string[]
isQrRequired: boolean
startDate: FirebaseFirestore.Timestamp | Date
id?: string
startDate: FirebaseFirestore.Timestamp | Date
endDate: FirebaseFirestore.Timestamp | Date
name: string
description: string
venue: string
departments: string[]
isExclusive: boolean
hasStarted: boolean
attendees: number
invitedAttendees: User[]
secretCode: string
}

class EventCollection extends BaseCollection<Event> {
Expand Down
22 changes: 13 additions & 9 deletions src/server/db/models/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ type User = {
}

export type Event = {
attendees: number
endDate: Timestamp | Date
hasStarted: boolean
id?: string
invitedAttendees: User[]
name: string
departments: string[]
isQrRequired: boolean
startDate: Timestamp | Date
id?: string
startDate: Timestamp | Date
endDate: Timestamp | Date
name: string
description: string
venue: string
departments: string[]
isExclusive: boolean
hasStarted: boolean
attendees: number
invitedAttendees: User[]
secretCode: string

}

export default User
1 change: 1 addition & 0 deletions src/server/trpc/router/event/getEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const getEvent = protectedProcedure
qr_code,
departments: event.departments,
startDate: (event.startDate as Timestamp).toDate(),
description: event.description
}
} catch (e) {
throw new TRPCError({
Expand Down
1 change: 1 addition & 0 deletions src/types/event/event.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export interface BodyProps {
qr_code: string | undefined
startDate: Date
departments: string[]
description: string
}