Created
May 18, 2017 16:31
-
-
Save lukaspili/d522ff211393a027d2177b95a782fdc2 to your computer and use it in GitHub Desktop.
Boss
This file contains hidden or 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
| val postsQuery = ParseQuery.getQuery<ParseObject>("Post") | |
| .whereExists("createdAt") | |
| .whereExists("building") | |
| .whereExists("author") | |
| .include("building") | |
| .include("photo") | |
| .include("author") | |
| .include("author.Picture") | |
| .whereEqualTo("building", ParseObject.createWithoutData("Building", sessionManager.buildingId)) | |
| .setLimit(QUERY_LIMIT) | |
| .setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE) | |
| when (tab) { | |
| FeedTabController.Tab.AllPosts -> { | |
| postsQuery.whereEqualTo("category", "community") | |
| } | |
| FeedTabController.Tab.TenantPosts -> { | |
| postsQuery | |
| .whereDoesNotExist("stickyUntil") | |
| .whereEqualTo("category", "community") | |
| .whereMatchesQuery("author", ParseUser.getQuery().whereNotEqualTo("AccessLevel", "Manager")) | |
| } | |
| FeedTabController.Tab.ManagerPosts -> { | |
| postsQuery | |
| .whereEqualTo("category", "community") | |
| .whereMatchesQuery("author", ParseUser.getQuery().whereEqualTo("AccessLevel", "Manager")) | |
| } | |
| FeedTabController.Tab.FeedbackPosts -> { | |
| postsQuery.whereContainedIn("category", listOf("issue", "compliment")) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment