-
Notifications
You must be signed in to change notification settings - Fork 0
contribution_api
sandeshkhadka edited this page Jun 21, 2024
·
3 revisions
POST /api/create/contribution HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Authorization: Bearer <JWT_TOKEN>
{
"name": "<CONTRIBUTION_NAME>",
"type": "<CONTRIBUTION_TYPE>",
"amount": "<NUMERIC_VALUE>"
}
CONTRIBUTION_TYPE is defined in routes.ts Success Response:
{
"contribution": {
"id": "<CONTRIBUTION_ID>",
"name": "<CONTRIBUTION_NAME>",
"type": "<CONTRIBUTION_TYPE>",
"amount": "<NUMERIC_VALUE>",
"belongsToId": "<USER_ID>",
"createdAt": "<TIMESTAMP>",
"approvedBy": "<LIST_OF_USER_ID>",
"passed": "<BOOLEAN>"
}
}
Failure Response:
{
"message": "Could not create Contribuion"
}
DELETE /api/contribution/<CONTRIBUTION_ID> HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Authorization: Bearer <JWT_TOKEN>
Success response:
{
"deleted": {
"id": "<CONTRIBUTION_ID>",
"name": "<CONTRIBUTION_NAME>",
"type": "<CONTRIBUTION_TYPE>",
"amount": "<NUMERIC_VALUE>",
"belongsToId": "<USER_ID>",
"createdAt": "<TIMESTAMP>",
"approvedBy": "<LIST_OF_USER_ID>",
"passed": "<BOOLEAN>"
}
}
Failure response:
{
"message": "Could not delete contribution"
}
POST /api/contribution/approve/<CONTRIBUTION_ID> HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Authorization: Bearer <JWT_TOKEN>
Success response:
{
"updatedContribution": {
"id": "<CONTRIBUTION_ID>",
"name": "<CONTRIBUTION_NAME>",
"type": "<CONTRIBUTION_TYPE>",
"amount": "<NUMERIC_VALUE>",
"belongsToId": "<USER_ID>",
"createdAt": "<TIMESTAMP>",
"approvedBy": "<LIST_OF_USER_ID>",
"passed": "<BOOLEAN>"
}
}
Failure response
{
"message": "Contribution not found"
}
{
"message": "already approved"
}