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], | |
creatorId: [eventCreatorId], | |
chatId: [eventChatId], | |
speakerIds: [1, 2, 3], | |
slug: [eventSlug], | |
roomIds: [1, 3], | |
hallIds: [2, 9, 10] | |
// Should this be nested? Or should it be 'userIds:', 'usersCount:', 'usersInEventIds:', 'usersInEventCount:'? | |
users: { | |
count: [eventUsersCount], | |
ids: [24, 25] | |
inEventCount: [eventUsersOnlineCount] | |
// Is this needed if we have 'isInEvent:' in the users model? | |
inEventIds: [24, 25], | |
}, | |
} | |
----- | |
// Should this be placed in the event model? I think the rule should be, anything that is referenced in two seperate locations, gets its own model, so in my opinion, this shouldn't be in the event model. What do you think? If you disagree havily we can discuss on our call | |
tickets: [{ | |
id: [ticketId], | |
type: "DONATION", | |
name: [ticketName], | |
description: [ticketDescription], | |
currency: [ticketCurrency], | |
price: [ticketPrice], | |
quantity: [ticketQuantity], | |
remainingQuantity: [ticketsRemainingQuantity] | |
}] | |
----- | |
// 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: [{ | |
id: [roomId], | |
selectorId: [roomSelectorId], | |
name: [roomName], | |
creatorId: [roomCreatorId], | |
slug: [roomSlug], | |
isLive: true, | |
isStage: true, ///////// Shall we call it isStage | |
chatId: [roomChatId], | |
// Should this be nested? Or should it be 'audienceIds:' and 'audienceCount:' | |
audience: { | |
count: [roomAudienceCount], | |
ids: [1, 3, 5] | |
} | |
// Should this be nested? Or should it be 'speakerIds:' and 'speakerCount:' | |
speakers: { | |
count: [roomSpeakersCount], | |
ids: [6, 9, 10] | |
} | |
///////// Check if these properties are correct | |
streamCredentials: { | |
appId: [appId], | |
channel: [channelName], | |
isSpeaker: true, | |
isUserWatching: false, | |
screenToken: [screenToken], | |
videoToken: [videoToken] | |
}, | |
accessPermissions: { | |
organizers: true, | |
speakers: true, | |
attendees: true, | |
tickets: [ | |
23, | |
89 | |
] | |
}, | |
streamPermissions: { | |
organizers: true, | |
speakers: true, | |
attendees: true, | |
tickets: [ | |
23, | |
89 | |
] | |
}, | |
}] | |
----- | |
halls: [{ | |
id: [hallId], | |
selectorId: [hallSelectorId], | |
name: [hallName], | |
creatorId: [hallCreatorId], | |
roomIds: [1, 3, 4], | |
liveRoomCount: [hallLiveRoomsCount], | |
slug: [hallSlug], | |
accessPermissions: { | |
organizers: true, | |
speakers: true, | |
attendees: true, | |
tickets: [ | |
23, | |
89 | |
] | |
}, | |
createRoomPermissions: { | |
organizers: true, | |
speakers: true, | |
attendees: true, | |
tickets: [ | |
23, | |
89 | |
] | |
} | |
}] | |
----- | |
chats: [{ | |
id: [chatId], | |
////// Should this be 'medium:' or 'location:' rather than 'type:' | |
type: "ROOM", | |
messages: [{ | |
id: [messageId], | |
senderId: [senderId], | |
message: "Hello" | |
}] | |
}] | |
----- | |
// Today you mentioned that if we include 'me' in the users model we'll have to "get an array from state and loop it to find our current user. Because of these reasons I believe it’s best to separate currentUser (which as I mentioned before might have special properties) from users array (a prop name for it may be “me”). And for that reason we can remove “isMe” property from other users". Is this still true after realising that we need 'me' to be included for things like audience? | |
users: [{ | |
id: [userId], | |
selectorId: [userSelectorId], | |
name: [userName], | |
email: [userEmail], | |
image: [userImage], | |
slug: [userSlug], | |
color: [userColor], | |
verified: true, | |
// Should this be in an object or just have eventUserId, eventUserType, ticketId, isInEvent | |
// Only needs to be included if the user is in an event | |
eventUser: { | |
id: [eventUserId], | |
type: "ATTENDEE", | |
ticketId: [eventUserTicketId], | |
// Do we need this if we have inEventIds in the event object? Or maybe we don't need the inEventIds? | |
isInEvent: true | |
}, | |
// Only needs to be included if the user is the current user | |
isMe: true, | |
organizationIds: [23, 65, 21], | |
paymentAccounts: [{ | |
id: [paymentAccountId], | |
email: [paymentAccountEmail], | |
userId: [paymentAccountUserId] | |
}], | |
}] | |
----- | |
// Can be ignored for the moment as organizations won't be needed inside event | |
// Maybe best to just reference in users. However, what if in the future we want to show a list of users and their organizations. If users share organizations we will want one centralised place to update organizations | |
organizations: [{ | |
id: [organizationId], | |
selectorId: [organizationSelectorId], | |
name: [organizationName], | |
image: [organizationImage], | |
slug: [organizationSlug], | |
paymentAccounts: [{ | |
id: [paymentAccountId], | |
email: [paymentAccountEmail], | |
userId: [paymentAccountUserId] | |
}] | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment