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

Integrate event preview #1013

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions backend/entities/events/previews/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/google/uuid"
)

type common struct {
type Common struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
Name string `json:"name"`
EventType models.EventType `json:"event_type"`
Location string `json:"location"`
Link string `json:"link"`
Expand All @@ -18,13 +18,13 @@ type common struct {
}

type EventStub struct {
common
Common
Host uuid.UUID `json:"host"`
}

func (es *EventStub) Into(tags []models.Tag, hostName string, hostLogo string) *EventPreview {
return &EventPreview{
common: es.common,
Common: es.Common,
Tags: tags,
HostName: hostName,
HostLogo: hostLogo,
Expand All @@ -36,7 +36,7 @@ func (es EventStub) TableName() string {
}

type EventPreview struct {
common
Common
Tags []models.Tag `json:"tags"`
HostName string `json:"host_name"`
HostLogo string `json:"host_logo"`
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@generatesac/lib",
"version": "0.0.13",
"version": "0.0.164",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
16 changes: 16 additions & 0 deletions frontend/lib/src/api/eventApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { Club, clubSchema } from "../types/club";
import {
CreateEventRequestBody,
Event,
EventPreview,
UpdateEventRequestBody,
eventPreviewSchema,
eventSchema,
} from "../types/event";
import { PaginationQueryParams } from "../types/root";
Expand All @@ -25,9 +27,23 @@ export const eventApi = baseApi.injectEndpoints({
? result.map((event) => ({ type: "Event", id: event.id }))
: ["Event"],
transformResponse: (response) => {
console.log('here!!!!')
return z.array(eventSchema).parse(response);
},
}),
eventsPreview: builder.query<EventPreview[], PaginationQueryParams>({
query: (queryParams) => ({
url: handleQueryParams(`${EVENT_API_BASE_URL}/previews`, queryParams),
method: "GET",
}),
providesTags: (result) =>
result
? result.map((event) => ({ type: "Event", id: event.id }))
: ["Event"],
transformResponse: (response) => {
return z.array(eventPreviewSchema).parse(response);
},
}),
event: builder.query<Event, string>({
query: (id) => ({
url: `${EVENT_API_BASE_URL}/${id}/`,
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/src/types/club.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const createClubTagsRequestBodySchema = z.object({
const clubSchemaIntermediate = z.object({
name: z.string().max(255),
preview: z.string().max(255),
description: z.string().max(255),
description: z.string(),
num_members: z.number(),
is_recruiting: z.boolean(),
application_link: z.string().max(255),
Expand Down
20 changes: 19 additions & 1 deletion frontend/lib/src/types/event.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { z } from "zod";

import { rootModelSchema } from "./root";
import { tagSchema } from "./tag";

/**
* TODO: Re-Write After BE Fixes
Expand Down Expand Up @@ -35,7 +36,7 @@ const updateEventRequestBodySchema = z.object({
const eventSchemaIntermediate = z.object({
name: z.string().max(255),
preview: z.string().max(255),
description: z.string().max(255),
description: z.string(),
start_time: z.string(),
end_time: z.string(),
location: z.string().max(255),
Expand All @@ -48,7 +49,23 @@ const eventSchemaIntermediate = z.object({
host: z.string().uuid(),
});

const eventPreviewSchemaIntermediate = z.object({
id: z.string().uuid(),
name: z.string().max(255),
event_type: eventTypeEnum,
location: z.string().max(255),
link: z.string().max(255).optional(),

start_time: z.string(),
end_time: z.string(),

tags: tagSchema.array(),
host_name: z.string().max(255),
host_logo: z.string().max(255).optional(),
});

export const eventSchema = eventSchemaIntermediate.merge(rootModelSchema);
export const eventPreviewSchema = eventPreviewSchemaIntermediate

// Types:
export type CreateEventRequestBody = z.infer<
Expand All @@ -58,3 +75,4 @@ export type UpdateEventRequestBody = z.infer<
typeof updateEventRequestBodySchema
>;
export type Event = z.infer<typeof eventSchema>;
export type EventPreview = z.infer<typeof eventPreviewSchema>;
207 changes: 0 additions & 207 deletions frontend/mobile/app/(design-system)/components/Editor/editor.tsx

This file was deleted.

80 changes: 0 additions & 80 deletions frontend/mobile/app/(design-system)/components/Editor/font.ts

This file was deleted.

Loading
Loading