Skip to content

Reconnect-Lithium/Back-End

Repository files navigation

Reconnect Mobile App (Back-End)

 

1. POST /register/user

Request:

  • body:
{
  "email": "anto@mail.com",
  "password": "antoanto",
  "username": "anto"
}

Response (201 - Created)

{
  "id": 3,
  "email": "anto@mail.com"
}

 

2. POST /register/owner

Request:

  • body: name is for cafe name
{
  "email": "ardi@mail.com",
  "password": "ardiardi",
  "username": "ardiardi",
  "longitude": 106.805534,
  "latitude": -6.272444,
  "name": "cafe hacktiv",
  "address": "hacktiv 8"
}

Response (201 - Created)

{
  "id": 4,
  "email": "ardi@mail.com"
}

 

3. POST /login

  • body:
{
  "email": "ardi@mail.com",
  "password": "ardiardi"
}

Response (201 - Created)

{
  "access_token": string,
  "id": number,
  "role": string
}

 

4. GET /cafe?longitude=number&latitude=number

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}

Response (200 - Created)

[
  {
    "id": 1,
    "description": String,
    "photo": String,
    "location": {
      "crs": {
        "type": "name",
        "properties": {
          "name": "EPSG:4326"
        }
      },
      "type": "Point",
      "coordinates": [106.805234, -6.272244]
    },
    "name": "cafe 1",
    "address": "cafe 1",
    "UserId": 2,
    "createdAt": "2023-12-18T09:10:51.947Z",
    "updatedAt": "2023-12-18T09:10:51.947Z"
  },
  ...
]

 

5. PATCH /cafe/change-photo/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body (FORM DATA):
{
  "photo": String
}

Response (200 - Updated)

{
  "message": string
}

 

6. PATCH /cafe/description/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body:
{
  "description": String
}

Response (200 - Updated)

{
  "message": string
}

 

7. PATCH /cafe/name/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body:
{
  "name": String
}

Response (200 - Updated)

{
  "message": string
}

 

8. PATCH /cafe/address/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body:
{
  "address": String
}

Response (200 - Updated)

{
  "message": string
}

 

9. POST /cafe/gallery/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body (FORM DATA):
{
  "imgUrl": String
}

Response (200 - Updated)

{
  "message": string
}

 

10. DELETE /cafe/gallery/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}

Response (200 - Deleted)

{
  "message": string
}

 

11. POST /occasion

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body (FORM DATA):
{
  "startTime":"2023-12-16T05:43:33.437Z",
  "endTime":"2023-12-16T06:43:33.437Z",
  "photo": String,
  "eventName":String,
  "CategoryId":Number
}

Response (200 - Created)

{
  "message": string
}

 

12. PATCH /occasion/description/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body:
{
  "description": String
}

Response (200 - Updated)

{
  "message": string
}

 

13. PATCH /occasion/eventName/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body:
{
  "eventName": String
}

Response (200 - Updated)

{
  "message": string
}

 

14. PATCH /occasion/startTime/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body:
{
  "startTime": String
}

Response (200 - Updated)

{
  "message": string
}

 

15. PATCH /occasion/endTime/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body:
{
  "endTime": String
}

Response (200 - Updated)

{
  "message": string
}

 

16. GET /occasion?longitude=number&latitude=number&CategoryId=number

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}

Response (200 - Created)

[
  {
    "eventId": 1,
    "eventPhoto": String,
    "id": 1,
    "startTime": "2023-12-16T05:43:33.437Z",
    "endTime": "2023-12-16T05:43:33.437Z",
    "description": null,
    "photo": String,
    "eventName": "event buat 1",
    "CategoryId": 1,
    "CafeId": 1,
    "createdAt": "2023-12-18T09:10:51.947Z",
    "updatedAt": "2023-12-18T09:10:51.947Z",
    "location": {
      "crs": {
        "type": "name",
        "properties": {
          "name": "EPSG:4326"
        }
      },
      "type": "Point",
      "coordinates": [106.805234, -6.272244]
    },
    "name": "cafe 1",
    "address": "cafe 1",
    "UserId": 2,
    "categoryName": "music"
  },
  ...
]

 

16. GET /occasion/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}

Response (200 - Created)

{
  "id": 1,
  "startTime": "2023-12-16T05:43:33.437Z",
  "endTime": "2023-12-16T05:43:33.437Z",
  "description": null,
  "photo": String,
  "eventName": "event buat 1",
  "CategoryId": 1,
  "CafeId": 1,
  "createdAt": "2023-12-18T09:14:56.123Z",
  "updatedAt": "2023-12-18T09:14:56.123Z",
  "Cafe": {
    "id": 1,
    "description": null,
    "photo": String,
    "location": {
      "crs": {
        "type": "name",
        "properties": {
          "name": "EPSG:4326"
        }
      },
      "type": "Point",
      "coordinates": [106.805234, -6.272244]
    },
    "name": "cafe 1",
    "address": "cafe 1",
    "UserId": 2,
    "createdAt": "2023-12-18T09:10:51.947Z",
    "updatedAt": "2023-12-18T09:10:51.947Z"
  },
  "Category": {
    "id": 1,
    "name": "music",
    "thumbnail": String,
    "createdAt": "2023-12-18T08:58:21.814Z",
    "updatedAt": "2023-12-18T08:58:21.814Z"
  }
}

 

17. GET /room/occasion/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}

Response (200 - Created)

{
  "id": 1,
  "OccasionId": 1,
  "UserId": 2,
  "RoomId": String,
  "createdAt": "2023-12-18T09:14:56.143Z",
  "updatedAt": "2023-12-18T09:14:56.143Z"
}

 

18. POST /room/create-message/:roomId

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}

Response (200 - Created)

{
  "id": 1,
  "time": "2023-12-19T03:44:56.574Z",
  "message": "test 1",
  "RoomId": 1,
  "UserId": 2,
  "createdAt": "2023-12-19T03:44:56.576Z",
  "updatedAt": "2023-12-19T03:44:56.576Z",
  "User": {
    "id": 2,
    "email": "ardi@mail.com",
    "bio": null,
    "avatar": string,
    "role": "owner",
    "username": "ardiardi",
    "createdAt": "2023-12-18T09:10:51.821Z",
    "updatedAt": "2023-12-18T09:10:51.821Z"
  }
}

 

19. GET /room/list-message/:roomId

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}

Response (200 - Created)

[
    {
        "id": 1,
        "time": "2023-12-19T03:44:56.574Z",
        "message": "test 1",
        "RoomId": 1,
        "UserId": 2,
        "createdAt": "2023-12-19T03:44:56.576Z",
        "updatedAt": "2023-12-19T03:44:56.576Z",
        "User": {
            "id": 2,
            "email": "ardi@mail.com",
            "bio": null,
            "avatar": "https://i.pinimg.com/originals/b8/9f/27/b89f270e2aee0577efc5e604f08132d1.jpg",
            "role": "owner",
            "username": "ardiardi",
            "createdAt": "2023-12-18T09:10:51.821Z",
            "updatedAt": "2023-12-18T09:10:51.821Z"
        }
    },
  ...
]

 

20. GET /user/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}

Response (200 - Created)

{
    "id": 2,
    "email": "ardi@mail.com",
    "username": "ardiardi",
    "role": "owner",
    "avatar": String,
    "bio": null,
    "Rooms": [
        {
            "id": 1,
            "OccasionId": 1,
            "UserId": 2,
            "RoomId": "2_1702890896142",
            "createdAt": "2023-12-18T09:14:56.143Z",
            "updatedAt": "2023-12-18T09:14:56.143Z",
            "Occasion": {
                "id": 1,
                "startTime": "2023-12-16T05:43:33.437Z",
                "endTime": "2023-12-16T05:43:33.437Z",
                "description": null,
                "photo": String,
                "eventName": "event buat 1",
                "CategoryId": 1,
                "CafeId": 1,
                "createdAt": "2023-12-18T09:14:56.123Z",
                "updatedAt": "2023-12-18T09:14:56.123Z"
            }
        },
        ...
    ]
}

 

21. PATCH /user/bio/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body:
{
  "bio": String
}

Response (200 - Updated)

{
  "message": string
}

 

22. PATCH /user/avatar/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body (FORM DATA):
{
  "avatar": String
}

Response (200 - Updated)

{
  "message": string
}

 

23. PATCH /user/username/:id

  • Header:
{
  "Authorization": "Bearer <JWT TOKEN>"
}
  • body:
{
  "username": String
}

Response (200 - Updated)

{
  "message": string
}

 

Global Error

Response (400 - Bad Request)

{
  "message": string
}

Response (401 - Unauthorized)

{
  "message": "Invalid token"
}

Response (403 - Forbiden)

{
  "message": string
}

Response (404 - Unauthorized)

{
  "message": String
}

Response (500 - Internal Server Error)

{
  "message": "Internal server error"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors