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 read events from social layer into explore events, interests events tab, and map groups / related dao events to dao page. Merge with currents events.json on fetch and filter in with date. #51

Open
codingshot opened this issue Oct 18, 2024 · 0 comments
Labels
feature-request new feature request

Comments

@codingshot
Copy link
Member

codingshot commented Oct 18, 2024

Blocker

  • talking to social layer team to integrate api
  • need to integrate their auth solution for post and editing events

Read all events' filter based on activity

  • open event in new tab that goes to social layer

in future add event registration

Resources

// Import the node-fetch polyfill
import fetch, { Headers, Request, Response } from 'node-fetch';

// Assign fetch polyfills to global scope if not already defined
if (!globalThis.fetch) {
globalThis.fetch = fetch;
globalThis.Headers = Headers;
globalThis.Request = Request;
globalThis.Response = Response;
}

// Import necessary modules from graphql-request
import { gql, GraphQLClient } from 'graphql-request';

// Define the GraphQL client pointing to the API URL
const endpoint = 'https://graph.sola.day/v1/graphql';
const client = new GraphQLClient(endpoint);

// Define the GraphQL query for events starting from now to 24 hours later
const query = gqlquery FetchUpcomingEvents($currentTime: timestamp!, $twentyFourHoursLater: timestamp!) { events( where: { display: {_neq: "private"}, start_time: {_gte: $currentTime, _lte: $twentyFourHoursLater}, status: {_in: ["open", "new", "normal"]} }, order_by: {start_time: asc}, limit: 10 ) { id title start_time end_time location participants_count cover_url owner { username image_url } } };

// Function to fetch upcoming events
async function fetchUpcomingEvents() {
const currentTime = new Date().toISOString();
const twentyFourHoursLater = new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString();

const variables = {
currentTime: currentTime.split('.')[0] + 'Z',
twentyFourHoursLater: twentyFourHoursLater.split('.')[0] + 'Z'
};

try {
const data = await client.request(query, variables);
return data;
} catch (error) {
console.error('Error fetching events:', error);
}
}

// Fetch and display upcoming events
const eventData = await fetchUpcomingEvents();
console.log(eventData);

// Export the function for external usage
export { fetchUpcomingEvents };

@codingshot codingshot changed the title integrate read events from social layer integrate read events from social layer [Blocked by Social Layer API] Oct 18, 2024
@codingshot codingshot changed the title integrate read events from social layer [Blocked by Social Layer API] integrate read events from social layer into explore events, interests events tab, and map groups / related dao events to dao page. Merge with currents events.json on fetch and filter in with date. Oct 21, 2024
@codingshot codingshot added the feature-request new feature request label Oct 21, 2024
@codingshot codingshot moved this to Product Backlog in ActivityDAO Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request new feature request
Projects
Status: Product Backlog
Development

No branches or pull requests

1 participant