Skip to content

professorqtaku/plantrade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Specifications Plantrade

Prefix for the following endpoints: localhost:4000


AUTH

/api/login

Method: POST

Body: application/json

{
  "username": "string",
  "password": "string"
}

Response:

{
  "id": "Number",
  "username": "string",
  "email": "string"
}

/api/register

Method: POST

Body: application/json

{
  "id": "Number",
  "username": "string",
  "email": "string"
}

Response:

{
  "id": "Number",
  "username": "string",
  "email": "string"
}

/api/whoami

Method: GET

Response:

{
  "id": "Number",
  "username": "string",
  "email": "string"
}

/api/logout

Method: DELETE

Response: void


AUCTION

/rest/auctions

get all auctions

Method: GET

Response:

[
  {
    "id": "Number",
    "title": "string",
    "description": "string",
    "startPrice": "Number",
    "status": "OPEN/NOT_SOLD/SOLD",
    "endDate": "Date",
    "host": {
      "id": "Number",
      "username": "string"
    },
    "winner": {
      "id": "Number",
      "username": "string"
    },
    "categories": [
      {
        "id": "Number",
        "name": "string"
      }
    ],
    "bids": [
      {
        "id": "Number",
        "user": {
          "id": "Number",
          "username": "string"
        }
      }
    ],
    "images": [
      {
        "id": "Number",
        "path": "string",
        "auction": {
          "id": "Number"
        }
      }
    ]
  }
]

/rest/auctions/{id}

get specific auction by id

Method: GET

Response:

{
  "id": "Number",
  "title": "string",
  "description": "string",
  "startPrice": "Number",
  "status": "OPEN/NOT_SOLD/SOLD",
  "endDate": "Date",
  "host": {
    "id": "Number",
    "username": "string"
  },
  "winner": {
        "id": "Number",
        "username": "string"
      },
  "categories": [
    {
      "id": "Number",
      "name": "string"
    }
  ],
  "bids": [
    {
      "id": "Number",
      "user": {
        "id": "Number",
        "username": "string"
      }
    }
  ],
  "images": [
    {
      "id": "Number",
      "path": "string",
      "auction": {
        "id": "Number"
      }
    }
  ]
}

/rest/auctions

create an auction

Method: POST

Body: formdata

auction:
    {
        "title": "string",
        "description": "string",
        "startPrice": "Number",
        "endDate": "Date",
    }
),
categories:
    [
        {
            "id": "Number",
            "name": "string"
        }
    ]
    ),
files: List<MultipartFile> files

Response:

{
  "id": "Number",
  "title": "string",
  "description": "string",
  "startPrice": "Number",
  "status": "OPEN",
  "endDate": "Date",
  "host": {
    "id": "Number",
    "username": "string"
  },
  "winner": {
        "id": "Number",
        "username": "string"
      },
  "categories": [
    {
      "id": "Number",
      "name": "string"
    }
  ],
  "bids": [],
  "images": []
}

/rest/auctions/user

get all auctions for current user

Method: GET

Response:

[
  {
    "id": "Number",
    "title": "string",
    "description": "string",
    "startPrice": "Number",
    "status": "string",
    "endDate": "Date",
    "host": {
      "id": "Number",
      "username": "string"
    },
    "winner": {
        "id": "Number",
        "username": "string"
      },
    "categories": [
      {
        "id": "Number",
        "name": "string"
      }
    ],
    "bids": [
      {
        "id": "Number",
        "user": {
          "id": "Number",
          "username": "string"
        }
      }
    ],
    "images": [
      {
        "id": "Number",
        "path": "string",
        "auction": {
          "id": "Number"
        }
      }
    ]
  }
]

/rest/auctions/won

get won auctions for current user

Method: GET

Response:

[
  {
    "id": "Number",
    "title": "string",
    "description": "string",
    "startPrice": "Number",
    "status": "OPEN/NOT_SOLD/SOLD",
    "endDate": "Date",
    "host": {
      "id": "Number",
      "username": "string"
    },
    "winner": {
      "id": "Number",
      "username": "string"
    },
    "categories": [
      {
        "id": "Number",
        "name": "string"
      }
    ],
    "bids": [
      {
        "id": "Number",
        "user": {
          "id": "Number",
          "username": "string"
        }
      }
    ],
    "images": [
      {
        "id": "Number",
        "path": "string",
        "auction": {
          "id": "Number"
        }
      }
    ]
  }
]

BID

/api/bid

create a bid

Method: POST

Body: application/json

{
  "userId": "Number",
  "auctionId": "Number",
  "price": "number",
  "createdDate": "Date"
}

Response

{
  "id": "Number",
  "user": {
    "id": "Number",
    "username": "string",
  },
  "auction": {
    "id": "Number",
    "title": "string",
    "description": "string",
    "startPrice": "Number",
    "status": "string",
    "endDate": "Date",
    "host": {
      "id": "Number",
      "username": "string",
    },
    "winner": {
      "id": "Number",
      "username": "string"
      },
    "Category": [
      {
        "id": "Number",
        "name": "string"
      }
    ],
    "images": [
      {
        "id": "Number",
        "path": "string",
        "auction": {
          "id": "Number"
        }
      }
    ]
  },
  "price": "Number",
  "createdDate": "Date"
}

/api/{id}/highest-bid

get highest bid of a specific auction

Method: GET

Response

{
  "id": "Number",
  "user": {
    "id": "Number",
    "username": "string",
  },
  "auction": {
    "id": "Number",
    "title": "string",
    "description": "string",
    "startPrice": "Number",
    "status": "string",
    "endDate": "Date",
    "host": {
      "id": "Number",
      "username": "string",
    },
    "winner": {
      "id": "Number",
      "username": "string"
      },
    "Category": [
      {
        "id": "Number",
        "name": "string"
      }
    ],
    "images": [
      {
        "id": "Number",
        "path": "string",
        "auction": {
          "id": "Number"
        }
      }
    ]
  },
  "price": "Number",
  "createdDate": "Date"
}

CATEGORY

/rest/categories

Method: GET

Response

[
  {
    "id": "Number",
    "name": "string"
  }
]

SEARCH

/rest/auctions/search?

Optionals

  • title=string
  • status=string
  • category=string

Notis, optinals can be combined
example:

/rest/auctions/search?title=string&category=string&status=string

Method: GET

Response

[
  {
    "id": "Number",
    "title": "string",
    "description": "string",
    "startPrice": "Number",
    "status": "string",
    "endDate": "Date",
    "host": {
      "id": "Number",
      "username": "string"
    },
    "winner": {
      "id": "Number",
      "username": "string"
    },
    "categories": [
      {
        "id": "Number",
        "name": "string"
      }
    ],
    "bids": [
      {
        "id": "Number",
        "user": {
          "id": "Number",
          "username": "string"
        },
        "price": "number",
        "createdDate": "Date"
      }
    ],
    "images": [
      {
        "id": "Number",
        "path": "string",
        "auction": {
          "id": "Number"
        }
      },
      {
        "id": "Number",
        "path": "string",
        "auction": {
          "id": "Number"
        }
      }
    ]
  }
]

CHAT

/api/chats

create a chat regarding an auction

Method: POST

Body: application/json

{
  "auctionId": "Number"
}

Response

{
  "id": "Number",
  "creator": {
    "id": "Number",
    "username": "string"
  },
  "receiver": {
    "id": "Number",
    "username": "string"
  },
  "auction": {
    "id": "Number",
    "title": "string"
  }
}

/api/chats

get chats for current user

Method: GET

Response

[
  {
  "id": "Number",
  "creator": {
      "id": "Number",
      "username": "string"
    },
  "receiver": {
      "id": "Number",
      "username": "string"
    },
  "auction": {
      "id": "Number",
      "title": "string"
    }
  }
]

MESSEGE

/api/messages/{chatId}

post a new message

Method: POST

Body: application/json

{
  "message": "string",
}

Response

{
  "id": "Number",
  "writer": {
      "id": "Number",
      "username": "string"
    },
  "message": "string",
  "createdDate": "Date"
}

/api/messages/{chatId}

get all messages from a chat

Method: GET

Response

[
  {
    "id": "Number",
    "writer": {
      "id": "Number",
      "username": "string"
      },
    "message": "string",
    "createdDate": "Date"
  }
]

NOTIFICATION

/api/notifications

Method: GET

Response

[
  {
    "id": "Number",
    "message": "string",
    "auction": {
      "id": "Number"
    },
    "user": {
      "id": "Number"
    },
    "isRead": "boolean"
  }
]

/api/notifications/update/is-read/all

Method: PUT

Response

[
  {
    "id": "Number",
    "message": "string",
    "auction": {
      "id": "Number"
    },
    "user": {
      "id": "Number"
    },
    "isRead": "boolean"
  }
]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages