diff --git a/backend/entities/events/previews/models.go b/backend/entities/events/previews/models.go index 6f6e9a44..cb287c92 100644 --- a/backend/entities/events/previews/models.go +++ b/backend/entities/events/previews/models.go @@ -15,6 +15,7 @@ type Common struct { Link string `json:"link"` StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` + Image string `json:"image"` } type EventStub struct { diff --git a/backend/entities/models/event.go b/backend/entities/models/event.go index edf5395a..4defdace 100644 --- a/backend/entities/models/event.go +++ b/backend/entities/models/event.go @@ -24,6 +24,8 @@ type Event struct { Description string `json:"description"` Host *uuid.UUID `json:"host"` + Image string `json:"image"` + // geoshi EventType EventType `json:"event_type"` Location string `json:"location"` diff --git a/backend/migrations/000001_init.up.sql b/backend/migrations/000001_init.up.sql index 6af707ab..31e2f0f6 100644 --- a/backend/migrations/000001_init.up.sql +++ b/backend/migrations/000001_init.up.sql @@ -89,6 +89,7 @@ CREATE TABLE IF NOT EXISTS "events"( created_at timestamp WITH time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at timestamp WITH time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, name varchar(255) NOT NULL, + image varchar(255), preview varchar(255) NOT NULL, description text NOT NULL, event_type event_type NOT NULL, diff --git a/frontend/lib/package.json b/frontend/lib/package.json index ada010f6..f329eb25 100644 --- a/frontend/lib/package.json +++ b/frontend/lib/package.json @@ -1,6 +1,6 @@ { "name": "@generatesac/lib", - "version": "0.0.189", + "version": "0.0.191", "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/frontend/lib/src/types/event.ts b/frontend/lib/src/types/event.ts index 62cc0e5b..f282bd75 100644 --- a/frontend/lib/src/types/event.ts +++ b/frontend/lib/src/types/event.ts @@ -40,6 +40,7 @@ const eventSchemaIntermediate = z.object({ start_time: z.string(), end_time: z.string(), location: z.string().max(255), + image: z.string().max(255).optional(), link: z.string().max(255).optional(), event_type: eventTypeEnum, is_recurring: z.boolean().optional(), @@ -55,6 +56,7 @@ const eventPreviewSchemaIntermediate = z.object({ event_type: eventTypeEnum, location: z.string().max(255), link: z.string().max(255).optional(), + image: z.string().max(255).optional(), start_time: z.string(), end_time: z.string(), diff --git a/frontend/mobile/package.json b/frontend/mobile/package.json index 49bc4879..b33dcd6e 100644 --- a/frontend/mobile/package.json +++ b/frontend/mobile/package.json @@ -25,7 +25,7 @@ "@fortawesome/free-solid-svg-icons": "^6.5.2", "@fortawesome/react-fontawesome": "^0.2.2", "@fortawesome/react-native-fontawesome": "^0.3.2", - "@generatesac/lib": "0.0.189", + "@generatesac/lib": "0.0.191", "@gorhom/bottom-sheet": "^4.6.3", "@hookform/resolvers": "^3.4.2", "@react-native-async-storage/async-storage": "^1.23.1", diff --git a/frontend/mobile/src/app/app/event/[id].tsx b/frontend/mobile/src/app/app/event/[id].tsx index 6a5565c2..4de8215c 100644 --- a/frontend/mobile/src/app/app/event/[id].tsx +++ b/frontend/mobile/src/app/app/event/[id].tsx @@ -170,7 +170,7 @@ const EventPage = () => { ) : ( <> { // Fetch events getEvent(eventId).then(({ data: eventData }) => { if (eventData) { + console.log(eventData); dispatch(setEvent(eventData)); dispatch(setClubId(eventData?.host)); } diff --git a/frontend/mobile/src/store/slices/eventSlice.ts b/frontend/mobile/src/store/slices/eventSlice.ts index ffdabbf7..27608231 100644 --- a/frontend/mobile/src/store/slices/eventSlice.ts +++ b/frontend/mobile/src/store/slices/eventSlice.ts @@ -44,6 +44,7 @@ export const eventSlice = createSlice({ state.end_time = action.payload.end_time; state.location = action.payload.location; state.event_type = action.payload.event_type; + state.image = action.payload.image; state.is_archived = action.payload.is_archived; state.is_draft = action.payload.is_draft; state.is_recurring = action.payload.is_recurring; diff --git a/frontend/mobile/yarn.lock b/frontend/mobile/yarn.lock index 6fa02873..f5084a79 100644 --- a/frontend/mobile/yarn.lock +++ b/frontend/mobile/yarn.lock @@ -1402,10 +1402,10 @@ humps "^2.0.1" prop-types "^15.7.2" -"@generatesac/lib@0.0.189": - version "0.0.189" - resolved "https://registry.yarnpkg.com/@generatesac/lib/-/lib-0.0.189.tgz#fc532b0df1d814d74cd8e4fdcd55219aa087bf92" - integrity sha512-HewOUivTTC3+/y59UPlsdAemYKXFgv9ckxV5XHNb+F/LhhVal9feC4adWL4sPbm9wGGxBZrQq7XHU39ucnH3rA== +"@generatesac/lib@0.0.191": + version "0.0.191" + resolved "https://registry.yarnpkg.com/@generatesac/lib/-/lib-0.0.191.tgz#3c999ee26ed1eaab77f8bd1f435d779990fabbba" + integrity sha512-8P0bPY4DNSW4fgTFVpS4EOR4dRgZ4aI+EJvce4RiBIXQLnfwfAbxEtr0M1xHimEZxLH7Lhe3HpUl7Lt0Qx8arQ== dependencies: "@reduxjs/toolkit" "^2.2.3" react "^18.2.0" diff --git a/mock_data/.gitignore b/mock_data/.gitignore index 8e438bf9..0153c5c8 100644 --- a/mock_data/.gitignore +++ b/mock_data/.gitignore @@ -1,3 +1,4 @@ /bin /lib -*.cfg \ No newline at end of file +*.cfg +/.venv \ No newline at end of file diff --git a/mock_data/main.py b/mock_data/main.py index 442e3459..9523078a 100644 --- a/mock_data/main.py +++ b/mock_data/main.py @@ -82,6 +82,13 @@ ] } +randomEventImageData = [ + 'https://i.imgur.com/TM29405.png', + 'https://i.imgur.com/IfjHhrs.png', + 'https://i.imgur.com/TQQ7AEE.png', + 'https://i.imgur.com/Gp0Wwa8.png', +] + TAGS_STRING = ", ".join(f"\"{tag}\"" for tag in sum(MOCK_CATEGORIES_AND_TAGS.values(), [])) # for tags_prompt def description_prompt(name: str, preview: str) -> str: @@ -218,11 +225,14 @@ def random_start_and_endtimes() -> tuple[datetime.datetime, datetime.datetime]: location = random.choice(["West Village H", "Curry Student Center", "Snell Library", "Krentzman Quad", "Marino", "ISEC", "ISEC 2"]) if event_type == "online": location = "" + + image = random.choice(randomEventImageData) events.append({ "id": str(uuid4()), "club_id": clubData["id"], "name": f"Event for {clubData["name"]}", + "image": image, "preview": "This club is holding an event.", "description": event_description, "event_type": event_type, @@ -356,13 +366,14 @@ def fill_clubs(): @transaction def fill_events(): print("Creating event data...") - cmd = """INSERT INTO "events" ("id", "host", "name", "preview", "description", "event_type", "start_time", "end_time", "is_public", "is_draft", "is_archived") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""" + cmd = """INSERT INTO "events" ("id", "host", "name", "image", "preview", "description", "event_type", "start_time", "end_time", "is_public", "is_draft", "is_archived") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""" for event in events: data = ( event['id'], event['club_id'], event['name'].replace("\'", "''"), + random.choice(randomEventImageData), event['preview'].replace("\'", "''"), event['description'].replace('\'', "''"), event['event_type'],