Last active
June 19, 2018 21:45
-
-
Save bbstilson/688414ae1a3b3272ec003802e128b32e to your computer and use it in GitHub Desktop.
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 LibraryTag( | |
id: Int = LibraryTag.NEW_TAG_ID_PLACEHOLDER, | |
name: String, | |
createdAtUtc: Timestamp, | |
modifiedAtUtc: Timestamp | |
) | |
case class UpdateTagRequest( | |
name: String | |
) | |
case class LibraryEntry( | |
id: Int = LibraryEntry.NEW_ENTRY_ID_PLACEHOLDER, | |
paper: PaperLite, | |
createdAtUtc: Timestamp, | |
modifiedAtUtc: Timestamp, | |
status: LibraryEntry.Status | |
) | |
object Status extends ReverseMapped[Short, Status] { | |
case object Unread extends Status(1) | |
case object Read extends Status(2) | |
case object Started extends Status(3) | |
case object Deleted extends Status(4) | |
} | |
/** Represents a join of LibraryEntry and N LibraryTags */ | |
case class LibraryEntryWithTags( | |
id: Int, | |
paper: PaperLite, | |
createdAtUtc: Timestamp, | |
modifiedAtUtc: Timestamp, | |
tags: Seq[LibraryTag], | |
status: LibraryEntry.Status | |
) | |
case class AddLibraryEntryRequest( | |
paperId: String, | |
paperTitle: String, // This is to maintain backwards compatibility with the old reading_list_entry table | |
tags: Option[Seq[Int]] | |
) | |
case class LibrarySearchResponse( | |
entries: Seq[LibraryEntryWithTags], | |
totalPages: Long | |
) | |
case class EntryTagRequest( | |
entryIds: Seq[Int], | |
tagIds: Seq[Int] | |
) | |
case class ManageEntryTagsRequest( | |
delete: Option[EntryTagRequest], | |
create: Option[EntryTagRequest] | |
) | |
case class CreateTagRequest( | |
name: String | |
) |
The tags key in AddLibraryEntryRequest, LibrarySearchRequest and EntryTagsRequest should all probably be Seq[Int].
The tags are unique by name, but we could do tag_id as well.
LibrarySearchResponse should probably have a pageSize field as well.
I was going to say that that value is included in the "query", but I think we are deleting that, so I'll move that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LibrarySearchResponse
should probably have apageSize
field as well.