mirror of https://github.com/shuang854/Turtle
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
734 B
TypeScript
43 lines
734 B
TypeScript
// Database schema
|
|
|
|
// Firestore
|
|
const collection = {
|
|
rooms: {
|
|
roomId: {
|
|
createdAt: 'timestamp',
|
|
ownerId: 'userId',
|
|
messages: {
|
|
messageId: {
|
|
createdAt: 'timestamp',
|
|
senderId: 'userId',
|
|
content: 'Message content',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
users: {
|
|
userId: {
|
|
name: 'Anonymous',
|
|
},
|
|
},
|
|
};
|
|
|
|
// Realtime Database - needed for tracking user presence
|
|
const turtle = {
|
|
// Needed for database triggers updating Firestore
|
|
available: {
|
|
roomId: {
|
|
createdAt: '2020-08-12T00:13:16.273Z',
|
|
},
|
|
},
|
|
|
|
// Keeping track of which users are present in a room
|
|
rooms: {
|
|
roomId: {
|
|
userId: {
|
|
name: 'Username',
|
|
},
|
|
},
|
|
},
|
|
};
|