Giter Club home page Giter Club logo

monnn-273 / back-end Goto Github PK

View Code? Open in Web Editor NEW

This project forked from greenpeace-fe28-be10/back-end

0.0 0.0 0.0 4.91 MB

Hijauin API i the backbone of an innovative web application designed to unite environmental activists and enthusiasts. With a strong focus on community building, Hijauin utilizes zip code identification to create region-based communities, empowering activists to connect, collaborate, and drive positive environmental change.

Home Page: https://documenter.getpostman.com/view/27335295/2s93sdYXKN#8c685967-72cb-4b59-878a-ff9811cb7d48

JavaScript 100.00%
backend backend-api express-js expressjs javascript rest-api restful-api

back-end's Introduction

API Spec

Authentication

Login

Request :

  • Method : POST
  • Endpoint : /api/login
  • Body :
{
  "email": "string, unique",
  "password": "string"
}

Response :

{
  "message": {
    "id": "integer, unique",
    "name": "string",
    "email": "string",
    "address": "string",
    "role": "string"
  },
  "token": "string"
}

Register

Request :

  • Method : POST
  • Endpoint : /api/register
  • Body :
{
  "name": "string",
  "email": "string, unique",
  "address": "string",
  "password": "string"
}

Response :

{
    {
    "data": {
        "email": "string",
        "name": "string",
        "address": "string"
    },
    "token": "string",
    "message": "Registration Success"
}
}



Community

Get All Communities in Hijauin

Request :

  • Method : GET
  • Endpoint guest: /api/communities
  • Endpoint admin: /api/v1/communities
  • Endpoint admin: /api/v2/communities

Response :

{
  "success": "boolean",
  "message": "SUCCESS",
  "communityData": [
    {
      "id": "integer",
      "name": "string",
      "location": "string",
      "postal_code": "string",
      "image": "string",
      "leader_id": "integer",
      "leader_name": "string"
    },
    {
      "id": "integer",
      "name": "string",
      "location": "string",
      "postal_code": "string",
      "image": "string",
      "leader_id": "integer",
      "leader_name": "string"
    }
  ]
}

Get Community Detail

Request :

  • Method : GET
  • Endpoint guest: /api/communities/{id}
  • Endpoint admin: /api/v1/communities/{id}
  • Endpoint admin: /api/v2/communities/{id}

Response :

{
  "success": "boolean",
  "status": "string",
  "message": "string",
  "communityDetail": {
    "id": "integer",
    "name": "string",
    "location": "string",
    "postal_code": "string",
    "image": "string",
    "description": "text"
  },
  "communityActivities": [
    {
      "title": "string",
      "description": "string",
      "date": "date",
      "status": "string"
    }
  ],
  "communityLeader": {
    "id": "integer",
    "name": "string"
  }
}

Create New Community

Request :

  • Method : POST

  • Endpoint admin: /api/v1/communities

  • Endpoint user: /api/v2/communities

  • Header Authorization: Bearer token

  • Body :

{
  "name": "string",
  "leader_id": "integer",
  "location": "string",
  "postal_code": "string",
  "image": "string",
  "description": "text"
}

Response :

{
  "success": "boolean",
  "status": "string",
  "message": "string",
  "communityDetail": {
    "id": "integer",
    "name": "string",
    "location": "string",
    "postal_code": "string",
    "image": "string",
    "description": "text"
  },
  "communityActivities": [
    {
      "title": "string",
      "description": "string",
      "date": "date",
      "status": "string"
    }
  ],
  "communityLeader": {
    "id": "integer",
    "name": "string"
  }
}

Update Community

Request :

  • Method : PATCH

  • Endpoint admin: /api/v1/communities/{id}

  • Endpoint user: /api/v2/communities/{id}

  • Header Authorization: Bearer token

  • Body :

{
  "name": "string",
  "leader_id": "integer",
  "location": "string",
  "postal_code": "string",
  "image": "string",
  "description": "text"
}

Response :

{
  "success": "boolean",
  "status": "string",
  "message": "string",
  "data": {
    "id": "integer",
    "name": "string",
    "location": "string",
    "description": "text",
    "leader_id": "integer",
    "image": "string",
    "postal_code": "string",
    "createdAt": "date",
    "updatedAt": "date"
  }
}

Delete Community

Request :

  • Method : DELETE
  • Endpoint: /api/v1/communities/{id}
  • Header Authorization: Bearer token

Response :

{
  "status": "boolean",
  "message": "string"
}

Community Members

Get Community Member List

Request :

  • Method : GET
  • Endpoint admin: /api/v1/communities/{id}/community-members
  • Endpoint user: /api/v2/communities/{id}/community-members
  • Header Authorization: Bearer token

Response :

{
    "success": boolean,
    "message": "string",
    "communityMembers": [
        {
            "id": integer,
            "name": "string",
            "address": "string",
            "email": "string",
            "users_id": integer
        },
        {
            "id": integer,
            "name": "string",
            "address": "string",
            "email": "string",
            "users_id": integer
        }
    ]
}

Create New Community Member (User self-enrollment or added by admin)

Request :

  • Method : POST

  • Endpoint admin: /api/v1/communities/{id}/community-members

  • Endpoint user: /api/v2/communities/{id}/community-members

  • Header Authorization: Bearer token

  • Body

{
  "users_id": "integer",
  "community_role": "string"
}

Response :

{
  "success": "boolean",
  "message": "string",
  "data": {
    "id": "integer",
    "users_id": "integer",
    "communities_id": "integer",
    "community_role": "string",
    "updatedAt": "2023-06-14T19:34:19.693Z",
    "createdAt": "2023-06-14T19:34:19.693Z"
  }
}

Delete Community Member

Request :

  • Method : DELETE
  • Endpoint admin: /api/v1/communities/{communityId}/community-members/{memberId}
  • Header Authorization: Bearer token

Response :

{
  "status": "string",
  "message": "string"
}

Community Activities

Create New Activity

Request :

  • Method : POST
  • Endpoint: /api/v2/communities/{communityId}/activity
  • Header Authorization: Bearer token -Body:
{
  "title": "string ",
  "description": " text",
  "date": "date",
  "status": "string"
}

Response :

{
  "status": "string",
  "message": "string",
  "data": {
    "id": "integer",
    "communities_id": "integer",
    "title": "string",
    "date": "date",
    "description": " text",
    "status": "string",
    "updatedAt": "date",
    "createdAt": "date"
  }
}

Update Activity

Request :

  • Method : PATCH
  • Endpoint: /api/v2/communities/{communityId}/activity/{activityId}
  • Header Authorization: Bearer token -Body:
{
  "title": "string",
  "description": " text",
  "date": "date",
  "status": "string"
}

Response :

{
  "success": "boolean",
  "status": "string",
  "message": "string",
  "data": {
    "id": "integer",
    "communities_id": "integer",
    "title": "string",
    "description": " text",
    "date": "date",
    "status": "string",
    "createdAt": "date",
    "updatedAt": "date"
  }
}

Delete Activity

Request :

  • Method : DELETE
  • Endpoint: /api/v2/communities/{communityId}/activity/{activityId}
  • Header Authorization: Bearer token

Response :

{
  "status": "string",
  "message": "string"
}

back-end's People

Contributors

monnn-273 avatar habibsyawali avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.