I am curious to see if my current structure is compatible with Firebase, or if I need to make adjustments. Let's take a look at an example using the "/rooms" endpoint, which contains an array of Room objects:
export class Room {
id: number;
password: string;
state: number;
messages: Message[] = [];
}
And now let's consider the Message class:
export class Message{
author: string;
message: string;
playerExcluded: string;
}
My goal is to load a room without a password (which should be feasible) and where message.playerExcluded does not equal firebase.auth().currentUser.uid (this part seems more challenging).
This setup essentially means that each user will have access to all messages except those from which they are excluded. One potential solution could involve loading fields like id and state directly from the Room object first, followed by another query to load Messages, but this approach may not be optimal.
Is it realistic to achieve this in a single query, or would it be too complicated? Any suggestions on how to go about this?