Skip to content

Yash1256/TwainLabInternAssignment

Repository files navigation

Intern Assignment TwainLab Documentaion

This is an API for the Political Party Registration and Interaction of the Political Party and Public based on the Work they do for the them. People can also follow their favourite Leaders to get update for the latest work they do

Brief Intro Of The Project

First the User comes from the Public and creates his account having a role of a member not as a Politician. That User creates a Political Party and becomes a leader for that Political Party. Similarly other members also Register as a user and then send their applications to the Political Party which the leader accepts and rejects. If the leader accepts their role change to Politician and if he rejects role remains same as before. Now here comes for giving rating to the Political Party, Members and their works, so each user can rate the above three on the basis of how he is satisfied. All the above mentioned task is done and here is it's API.

Now Lets begin the Interaction !!!

SIGNUP :

curl \
-d '{
    "username":"xyz",
    "email":"test@gmail.com",
    "password":"1234567890",
    "passwordConfirm":"1234567890",
    "firstname":"ABC",
    "lastname":"XYZ",
    "phoneNumber":"1234567390",
    "DOB":"01/01/2001",
    "address":"abc"
}' \
-H 'Content-Type: application/json' \
https://twainlabassignment.herokuapp.com/v1/users/signup

LOGIN :

curl \
-d '{"username":"xyz","password":"1234567890"}' \
-H 'Content-Type: application/json' \
https://twainlabassignment.herokuapp.com/v1/users/login

Export the Token Created at a time of Login

export TOKEN = Token which you get after Login

Party Registration :

curl -d '{
  "partyName":"BJP",
  "logo":"Kamal",
  "headquater":"India",
  "motive":"Sabka sath sabka vikas"
}' -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" https://twainlabassignment.herokuapp.com/v1/party

Update Party

curl -X PATCH -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" -d '{
"logo":"kamal",
"headquater":"Irndrria",
"motive":"vikas"
}' https://twainlabassignment.herokuapp.com/v1/party/BJP

Delete Party

curl -X DELETE -H "Authorization: Bearer $TOKEN" \ https://twainlabassignment.herokuapp.com/v1/party/BJP

Upload Rating of a Political Party

curl -X PATCH -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
 -d '{
"rating":5
}' \
 https://twainlabassignment.herokuapp.com/v1/party/uploadRating/608fd0bac4211d0015c01a5e

Create Application in a Party

curl -d '{
    "application":"true",
    "aadharCardNo":"123456yy7df899"
}' -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" https://twainlabassignment.herokuapp.com/v1/party/BJP/application

Filter Application on a Party Name

curl -H "Authorization: Bearer $TOKEN" https://twainlabassignment.herokuapp.com/v1/party/Congress/application

Change Application Status from Waiting to Working to Accpeted (0,1,-1)

curl -X PATCH -d '{
    "status":1
}' -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" \
https://twainlabassignment.herokuapp.com/v1/party/BJP/application/changeAppStatus/608fd368c4211d0015c01a60

Add Work

curl -d '{
    "title" : "xyz",
	"description" : "xyz"
}' -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" \
https://twainlabassignment.herokuapp.com/v1/work

Upload Rating of a Work

curl -X PATCH -d '{
    "rating" : 5
}' -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" \
https://twainlabassignment.herokuapp.com/v1/work/608fd5fec4211d0015c01a61

Upload Rating of the Politician

curl -X PATCH -d '{
    "rating" : 5
}' -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" \
https://twainlabassignment.herokuapp.com/v1/users/uploadRating/608fc3021d2e3f0015b6f0ac

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published