Last active
December 24, 2015 10:28
-
-
Save ambantis/6783988 to your computer and use it in GitHub Desktop.
A Scala object that manages the tree of Google Drive files in MagicNotebook.io
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
case class MagicNotebook(tree: GFolder, | |
implicit val folders: Map[String, GFolder], | |
implicit val docs: Map[String, GDoc]) | |
object MagicNotebook { | |
def create(userId: String)(implicit s: Session) = { | |
DbHomes.findById(userId).flatMap { fileId => | |
DbGFolders.findById(fileId).map { tree => | |
val folders = DbGFolders.findAllFor(fileId) | |
val docs = DbGDocs.findAllFor(fileId) | |
MagicNotebook(tree, folders, docs) | |
} | |
} | |
} | |
val empty = MagicNotebook(GFolder.empty, Map(), Map()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment