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.
Turtle/schema.ts

75 lines
1.4 KiB
TypeScript

// Database schema
// Firestore
const collection = {
rooms: [
{
roomId: {
createdAt: 'timestamp',
ownerId: 'userId',
messages: [
{
messageId: {
createdAt: 'timestamp',
content: 'Message content',
senderId: 'userId',
type: 'type',
},
},
],
playlist: [
{
videoId: {
createdAt: 'timestamp',
url: 'https://youtube.com',
},
},
],
states: [
{
stateId: {
time: 'timestamp',
isPlaying: true,
},
},
],
},
},
],
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',
},
},
},
};
// TODO: Put in firebase.json
// "functions": {
// "predeploy": [
// "npm --prefix \"$RESOURCE_DIR\" run lint",
// "npm --prefix \"$RESOURCE_DIR\" run build"
// ],
// "source": "functions"
// },