Last active
January 22, 2021 14:58
-
-
Save willdspd/967916c877e29f4067589759e1229449 to your computer and use it in GitHub Desktop.
Event SPA global state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
event: { | |
id: [eventId], | |
selectorId: [eventSelectorId], | |
name: [eventName], | |
description: [eventDescription], | |
image: [eventImage], | |
startTime: [eventStartTime], | |
endTime: [eventEndTime], | |
slug: [eventSlug], | |
creatorId: [eventCreatorId], | |
chatId: [eventChatId], | |
speakerIds: [1, 2, 3], | |
roomIds: [1, 2, 3], | |
hallIds: [1, 2, 3] | |
userIds: [1, 2, 3], | |
userCount: [eventUsersCount], | |
usersInEventIds: [1, 2, 3] | |
usersInEventCount: [eventUsersOnlineCount], | |
} | |
----- | |
tickets: { | |
byId: { | |
1: { | |
id: [ticketId], | |
type: "DONATION", | |
name: [ticketName], | |
description: [ticketDescription], | |
currency: [ticketCurrency], | |
price: [ticketPrice], | |
quantity: [ticketQuantity], | |
remainingQuantity: [ticketsRemainingQuantity] | |
} | |
}, | |
allIds : [1] | |
} | |
----- | |
// I agree it isn't needed, but I think rooms in halls probably should be added to the global state for consistency. It will just be much easier to understand that everything regading event state is in easy-peasy, no need for developers to have to look into the code to see what is local and what is global, plus we can see the whole event interior state using Redux dev tools which will be easier for debugging. However, if we face any issues or obvious inconveniences we can discuss again. | |
rooms: { | |
byId: { | |
1: { | |
id: [roomId], | |
selectorId: [roomSelectorId], | |
name: [roomName], | |
creatorId: [roomCreatorId], | |
slug: [roomSlug], | |
isLive: true, | |
// This should probably be changed from 'isStage:' to something else, because organizers may create private rooms for themsleves and speakers, which won't act as stages. I'm thinking reversing it and having something like 'isInHall:' | |
isStage: true, | |
chatId: [roomChatId], | |
audienceCount: [roomAudienceCount], | |
audienceIds: [1, 2, 3], | |
speakerIds: [1, 2, 3], | |
speakerCount: [roomSpeakersCount], | |
// Agora | |
agoraAppId: [agoraAppId], | |
agoraChannelName: [agoraChannelName], | |
agoraScreenToken: [agoraScreenToken], | |
agoraVideoToken: [agoraVideoToken], | |
canStream: true, | |
// Fall back for accuracy to ensure the viewer count is on point | |
isReceivingStream: false, | |
// Access permissions | |
organizersCanAccess: true, | |
speakersCanAccess: true, | |
allAttendeesCanAccess: true, | |
canAccessTicketIds: [1, 2, 3] | |
// Stream permissions | |
organizersCanStream: true, | |
speakersCanStream: true, | |
allAttendeesCanStream: true, | |
canStreamTicketIds: [1, 2, 3] | |
} | |
}, | |
allIds : [1] | |
} | |
----- | |
halls: { | |
byId: { | |
1: { | |
id: [hallId], | |
selectorId: [hallSelectorId], | |
name: [hallName], | |
creatorId: [hallCreatorId], | |
roomIds: [1, 2, 3], | |
liveRoomCount: [hallLiveRoomsCount], | |
slug: [hallSlug], | |
// Access permissions | |
organizersCanAccess: true, | |
speakersCanAccess: true, | |
allAttendeesCanAccess: true, | |
canAccessTicketIds: [1, 2, 3] | |
// Create Room Permissions | |
organizersCanCreateRooms: true, | |
speakersCanCreateRooms: true, | |
allAttendeesCanCreateRooms: true, | |
canCreateRoomsTicketIds: [1, 2, 3] | |
} | |
}, | |
allIds : [1] | |
} | |
----- | |
chats: { | |
byId: { | |
1: { | |
id: [chatId], | |
// Should be type as will include 'DM' in the future | |
type: "ROOM", | |
messageIds: [1, 2, 3] | |
} | |
}, | |
allIds: [1] | |
} | |
----- | |
messages: { | |
byId: { | |
1: { | |
id: [messageId], | |
senderId: [senderId], | |
message: "Hello" | |
} | |
}, | |
allIds: [1] | |
} | |
----- | |
users: { | |
byId: { | |
1: { | |
id: [userId], | |
selectorId: [userSelectorId], | |
eventUserId: [eventUserId], | |
name: [userName], | |
email: [userEmail], | |
image: [userImage], | |
slug: [userSlug], | |
color: [userColor], | |
isVerified: true, | |
// Only needs to be included if 'me' | |
organizationIds: [1, 2, 3], | |
stripeAccountIds: [1, 2, 3] | |
} | |
}, | |
allIds: [1], | |
meId: 1 | |
} | |
----- | |
eventUsers: { | |
byId: { | |
1: { | |
id: [eventUserId], | |
type: "ATTENDEE", | |
ticketId: [ticketId], | |
} | |
}, | |
allIds: [1] | |
} | |
----- | |
organizations: { | |
byId: { | |
1: { | |
id: [organizationId], | |
selectorId: [organizationSelectorId], | |
name: [organizationName], | |
image: [organizationImage], | |
slug: [organizationSlug], | |
stripeAccountIds: [1, 2, 3] | |
} | |
}, | |
allIds: [1] | |
} | |
----- | |
stripeAccounts: { | |
byId: { | |
1: { | |
id: [stripeAccountId], | |
userId: [stripeUserId], | |
email: [stripeEmail] | |
} | |
}, | |
allIds: [1] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment