-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added following/merged followers to new method (#89)
- added following - created new method for both following/followers - updated the record with one made by angela and renamed it
- Loading branch information
Showing
3 changed files
with
92 additions
and
21 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
server/src/main/java/edu/sjsu/moth/server/db/Following.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package edu.sjsu.moth.server.db; | ||
|
||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.mongodb.core.mapping.Document; | ||
|
||
import java.util.ArrayList; | ||
|
||
@Document("Following") | ||
public class Following { | ||
@Id | ||
public String id; | ||
public ArrayList<String> following; | ||
|
||
public Following(String id, ArrayList<String> following) { | ||
this.id = id; | ||
this.following = following; | ||
} | ||
|
||
// id to query for, to locate a users' followers document | ||
// afterwards, have a String[] array containing the users' followers and append to it, or delete | ||
// 'Following' can follow a similar format, but in a different collection | ||
|
||
public ArrayList<String> getFollowing() { | ||
return following; | ||
} | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
server/src/main/java/edu/sjsu/moth/server/db/FollowingRepository.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package edu.sjsu.moth.server.db; | ||
|
||
import org.springframework.data.mongodb.repository.Query; | ||
import org.springframework.data.mongodb.repository.ReactiveMongoRepository; | ||
import reactor.core.publisher.Mono; | ||
|
||
public interface FollowingRepository extends ReactiveMongoRepository<Following, String>{ | ||
@Query("{id:'?0'}") | ||
Mono<Following> findItemById(String id); | ||
} |