Skip to content

Commit

Permalink
update readme and add postman collection
Browse files Browse the repository at this point in the history
  • Loading branch information
zkrhm committed Sep 2, 2018
1 parent e3d2db9 commit a18a6d3
Show file tree
Hide file tree
Showing 2 changed files with 262 additions and 2 deletions.
58 changes: 56 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,60 @@
Social Networking.

### Components
- Gorilla Mux ([Hail Harambe](https://www.reddit.com/r/Harambe/)...!!!)
- Plain old handler
- [Cayley Graph] (https://cayley.io/)
- [Cayley Graph] (https://cayley.io/) (currently running on memory graph - so there won't be persisted data out of testing data)
- socialnetwork better to be implemented using graph structure.


### How to run.
execute following command on terminal
```bash
docker-compose up
```

### How to access :

open [this file](docs/imd-socmed.postman_collection.json) on [Postman App](https://www.getpostman.com/)
- End POINTS:
- http://localhost:8000/connect
- http://localhost:8000/friend-list
- http://localhost:8000/common-friends
- http://localhost:8000/subscribe
- http://localhost:8000/list-subscriber
- http://localhost:8000/block
- http://localhost:8000/post-update

### Using go
You need to get ![golang dep](https://golang.github.io/dep/docs/installation.html) installed
on Terminal execute :
```bash
go get -u github.com/zkrhm/imd-socialnetwork
```

then do :
```bash
cd $GOPATH/src/github.com/zkrhm/imd-socialnetwork
go dep
```


### Rules
this program following these rules :
- Registered user can connect to other registered user
- connected user become update receiver until/unless he do block person who publishing update
- User cannot connect to other user who blocks him
- User can subscribe to other user's update
- this subscribing user will receive update from people who he/she subscribe to even if not connected as friend
- User can block other user
- When a user doing update, following users will be the recipient of the update
1. this user friends
2. users who subscribe
3. registered user who mentioned at text update
and following user won't become the recipient
1. friend who block him
2. registered user who are not friend
3. unregistered email address mentioned on his / her update.

### List of Registered user.
You can check at app/app.go
Expand All @@ -21,4 +73,6 @@ You can check at app/app.go

### Friend Relationship

![User Relationship](docs/img/user-graph.png)
![User Relationship](docs/img/user-graph.png)

Tested on Golang ver.1.10.3, Docker image on ver.1.10.4
206 changes: 206 additions & 0 deletions docs/imd-socmed.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
{
"info": {
"_postman_id": "8b0fff26-0044-4ffa-ae7d-21306126c2d8",
"name": "imd-socmed",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Get Subscribers",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"email\":\"[email protected]\"\n}"
},
"url": {
"raw": "http://localhost:8000/list-subscriber",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"list-subscriber"
]
}
},
"response": []
},
{
"name": "Friend List",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"email\": \"[email protected]\"\n}"
},
"url": {
"raw": "http://localhost:8000/friend-list",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"friend-list"
]
},
"description": "get friend list."
},
"response": []
},
{
"name": "Common Friend",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"friends\": [\n\t\t\"[email protected]\",\n\t\t\"[email protected]\"\n\t]\n}"
},
"url": {
"raw": "http://localhost:8000/common-friends",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"common-friends"
]
}
},
"response": []
},
{
"name": "Subscribe",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"requestor\": \"[email protected]\",\n\t\"target\": \"[email protected]\"\n}"
},
"url": {
"raw": "http://localhost:8000/subscribe",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"subscribe"
]
}
},
"response": []
},
{
"name": "Block",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"requestor\": \"[email protected]\",\n\t\"target\": \"[email protected]\"\n}"
},
"url": {
"raw": "http://localhost:8000/block",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"block"
]
}
},
"response": []
},
{
"name": "Post Update",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"sender\":\"[email protected]\",\n\t\"text\": \"Hello World...!!!\"\n}"
},
"url": {
"raw": "http://localhost:8000/post-update",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"post-update"
]
}
},
"response": []
},
{
"name": "connect-as-friend",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"friends\": [\n\t\t\"[email protected]\",\n\t\t\"[email protected]\"\n\t\t\n\t]\n}"
},
"url": {
"raw": "http://localhost:8000/connect",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"connect"
]
}
},
"response": []
}
]
}

0 comments on commit a18a6d3

Please sign in to comment.