Skip to content

Commit

Permalink
refactor: make schema updates
Browse files Browse the repository at this point in the history
fix: changed existing code according to schema updates
  • Loading branch information
celinechoiii committed Oct 31, 2024
1 parent 1934a16 commit 8be9176
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 44 deletions.
4 changes: 2 additions & 2 deletions app/activeEvents/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function Page() {
setEvents(fetchedActiveEvents);
};
getActiveEvents();
}, [events]);
}, []);

return (
<Container>
Expand All @@ -53,7 +53,7 @@ export default function Page() {
</TitleBar>
<EventListingDiv>
{events.map(event => (
<EventListingCard key={event.event_id} genre={event.genre} />
<EventListingCard key={event.event_id} performance_type={event.performance_type} />
))}
</EventListingDiv>
</Container>
Expand Down
4 changes: 2 additions & 2 deletions app/events/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Page() {
<th>facility_id</th>
<th>start_date_time</th>
<th>end_date_time</th>
<th>type_of_act</th>
<th>performance_type</th>
<th>genre</th>
<th>needs_host</th>
<th>performer_type</th>
Expand All @@ -36,7 +36,7 @@ export default function Page() {
<td>{d.facility_id}</td>
<td>{d.start_date_time}</td>
<td>{d.end_date_time}</td>
<td>{d.type_of_act}</td>
<td>{d.performance_type}</td>
<td>{d.genre}</td>
<td>{d.needs_host}</td>
<td>{d.performer_type}</td>
Expand Down
5 changes: 3 additions & 2 deletions components/EventListingCard/EventListingCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { EventListing } from './styles';
import { PerformanceType } from '@/types/schema'

export default function EventListingCard({ genre }: { genre: string }) {
return <EventListing> {genre} </EventListing>;
export default function EventListingCard({ performance_type }: { performance_type: PerformanceType }) {
return <EventListing> {performance_type} </EventListing>;
}
81 changes: 43 additions & 38 deletions types/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { UUID } from 'crypto';

// used for events and volunteer_preference tables
export type TypeOfAct =
export type PerformanceType =
| 'Music'
| 'Dance'
| 'Poetry'
Expand All @@ -15,7 +15,7 @@ export type TypeOfAct =
| 'Puppetry';

// used for volunteers_preference and facilities table
export type TypeOfFacility =
export type FacilityType =
| 'Assisted Living'
| "Children's Day Care"
| 'Detention Center'
Expand Down Expand Up @@ -53,43 +53,44 @@ export type Genre =
| 'Standards';

// used for events table
export type EventStatus = 'ACTIVE' | 'INACTIVE';
export type EventStatus = 'Active' | 'Inactive';

// used for event_signups table
export type Role = 'Host' | 'Performer';

// used for availabilities table
export type Day =
| 'Monday'
| 'Tuesday'
| 'Wednesday'
| 'Thursday'
| 'Friday'
| 'Saturday'
| 'Sunday';

export type TypeOfPerformer = 'Solo' | 'Duo' | 'Band';
export type PerformerType = 'Solo' | 'Duo' | 'Band';

export interface Availabilities {
availability_id: UUID;
facility_id: UUID;
date: Date; // date
day_of_week: Day;
start_time: string; // timestamptz
end_time: string; // timestamptz
is_recurring: boolean;
name: string;
additional_info: string;
}

export interface AvailableDates {
date_id: UUID;
availability_id: UUID;
available_date: string; //date
}

export interface Timeslots {
timeslot_id: UUID;
date_id: UUID;
start_time: string; //timestamptz
end_time: string; //timestamptz
}

export interface Event {
event_id: UUID;
facility_id: UUID;
start_date_time: string; //timestamptz
end_date_time: string; //timestamptz
type_of_act: TypeOfAct;
genre: Genre;
performance_type: PerformanceType;
genre?: Genre;
needs_host: boolean;
performer_type: TypeOfPerformer;
event_status: EventStatus;
performer_type: PerformerType;
notes?: string;
}

export interface EventSignups {
Expand All @@ -99,27 +100,30 @@ export interface EventSignups {
is_accepted: boolean;
}

export interface Facilities {
export interface FacilityContacts {
user_id: UUID;
facility_id: UUID;
name: string;
email: string;
first_name: string;
last_name: string;
phone_number: string;
state: string;
}

export interface Facilities {
facility_id: UUID;
name: string;
county: string;
city: string;
street_address_1: string;
street_address_2?: string;
postal_code: string;
audience: Audience;
type: TypeOfFacility;
type: FacilityType;
host_name?: string;
host_contact?: string;
poc_name: string;
poc_contact: string;
notifications_opt_in: boolean;
}

export interface Volunteers {
volunteer_id: UUID;
user_id: UUID;
first_name: string;
last_name: string;
email: string;
Expand All @@ -128,11 +132,12 @@ export interface Volunteers {
}

export interface VolunteersPreferences {
volunteer_id: UUID;
city?: string;
genre?: Genre;
instruments?: Instruments;
type_of_act?: TypeOfAct;
audience?: Audience;
facility_type?: TypeOfFacility;
user_id: UUID;
role?: Role[];
performance_type?: PerformanceType[];
facility_type?: FacilityType[];
locations?: string[];
audience?: Audience[];
genre?: Genre[];
additional_info?: string;
}

0 comments on commit 8be9176

Please sign in to comment.