- Clone the repository.
git@github.com:lovomax/CarSales.git.-
- Enter the folder of the repository you've just cloned
cd CarSales
- Install the dependencies and initialize the project.
To build the project's backend and the SqlServer Database.
dotnet build CarSaleServerdotnet ef database update
To install the dependencies of the project's frontend, enter the CarSaleClient folder.
cd CarSaleClientyarn
By initializing the backend you are provided with an Admin account, the following variables are the credentials needed to use the application correctly.
Username=adminPassword=admin
After configuring the server and the frontend, we already have all we need to start using the application, all that's left is to run the following commands to start the application:
- On the application's root folder:
-
dotnet run --project CarSaleServer
- On the application's CarSaleClient folder:
-
yarn start
After logging in, you will be redirected to the homepage, where you can move between pages in the application, in here, you will be capable to move to:
- Buy Cars: Allows the user to see all of the registered cars
- Sell Car: Allows for the creation of a new car
- Logging in (if you are still not logged in)
- Details of the Car: In here you can update the general data and image of the car or outright delete it.
The endpoint does a validation for the login and returns a token for authentication
-
example
request body{ "username": "admin", "password": "admin" }- example
response body
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQ3N2IyOTlhLTIzMWYtNDBkYS05N2MzLWFjNzUyNjU0NTI2ZiIsImZ1bGxuYW1lIjoiSm9zZSBEYW5pZWwgQXJyZWF6YSBQdWVydGEiLCJ1c2VybmFtZSI6ImpkYW5pZWxfYXAiLCJlbWFpbCI6ImFkbWluQGFkbWluLmNvbSIsIm1lZGljUm9sZSI6dHJ1ZSwiaWF0IjoxNjMxNDQ2MDUxLCJleHAiOjE2MzE0NDYzNTEsInN1YiI6IjQ3N2IyOTlhLTIzMWYtNDBkYS05N2MzLWFjNzUyNjU0NTI2ZiJ9.HgKfpimfS1ExsvkXMcgNx09GAiaO1yxzI4qfrtStS_o", "success": true, "message": "" } - example
This endpoint returns all of the registered cars
-
Example
requestNo parameters required -
Example
response
"data": [
{
"id": 0,
"name": "string",
"model": "string",
"kilometers": 0,
"price": 0,
"year": "2022-11-12T17:17:40.795Z",
"make": {
"name": "string"
},
"photo": {
"photoURL": "string",
"publicId": "string"
}
},
{
"id": 1,
"name": "string",
"model": "string",
"kilometers": 0,
"price": 0,
"year": "2022-11-12T17:17:40.795Z",
"make": {
"name": "string"
},
"photo": {
"photoURL": "string",
"publicId": "string"
}
}
],
"success": true,
"message": ""This endpoint returns to the user the information of the specified car
-
Example
request -
Example
response
{
"data": {
"id": 0,
"model": "string",
"name": "string",
"kilometers": 0,
"price": 0,
"color": "string",
"year": "2022-11-12T17:29:07.929Z",
"make": {
"name": "string"
},
"photo": {
"photoURL": "string",
"publicId": "string"
}
},
"success": true,
"message": ""
}This endpoint allows for the creation of a new Car
-
Example
request -
headers
{
"Content-Type": "multipart/form-data",
"Authorization": "(Login Token)"
}- Example
request body
{
"model": "string",
"name": "string",
"price": 0,
"color": "string",
"kilometers": 0,
"year": "2022-11-12T17:33:46.367Z",
"makeId": 0
}- Example
response
{
"data": {
"id": 0,
"model": "string",
"name": "string",
"kilometers": 0,
"price": 0,
"color": "string",
"year": "2022-11-12T17:33:46.371Z",
"make": {
"name": "string"
},
"photo": {
"photoURL": "string",
"publicId": "string"
}
},
"success": true,
"message": ""
}The endpoint returns the updated entity and updates the database
-
Example
request -
headers
{
"Content-Type": "multipart/form-data",
"Authorization": "(Login Token)"
}- Example
request body
{
"id": 0,
"model": "string",
"name": "string",
"kilometers": 0,
"price": 0,
"color": "string",
"year": "2022-11-12T17:40:07.730Z"
}- Example
response body
{
"data": {
"id": 0,
"model": "string",
"name": "string",
"kilometers": 0,
"price": 0,
"color": "string",
"year": "2022-11-12T17:40:07.741Z",
"make": {
"name": "string"
},
"photo": {
"photoURL": "string",
"publicId": "string"
}
},
"success": true,
"message": "string"
}The endpoint deletes an endpoint
-
Example
request -
headers
{
"Content-Type": "multipart/form-data",
"Authorization": "(Login Token)"
}- Example
response body
{
"data": "the car has been deleted",
"message": "operation complete",
"success": "true"
}The endpoint returns a photo with a certain ID
-
Example
request -
headers
{
"Content-Type": "multipart/form-data",
"Authorization": "(Login Token)"
}- Example
response body
{
"data": {
"photoURL": "string",
"publicId": "string",
"timeStamp": "string"
},
"success": true,
"message": "string"
}The endpoint registers a photo under a car id
-
Example ``request` string($binary)File, integer($int32) CarId
-
headers
{
"Content-Type": "multipart/form-data",
"Authorization": "(Login Token)"
}- Example
response body
{
"data": {
"photoURL": "string",
"publicId": "string",
"timeStamp": "string"
},
"success": true,
"message": "string"
}The endpoint updates a photo and its URL
-
Example ``request` string($binary)File, string PublicId
-
headers
{
"Content-Type": "multipart/form-data",
"Authorization": "(Login Token)"
}- Example
response body
{
"data": {
"photoURL": "string",
"publicId": "string",
"timeStamp": "string"
},
"success": true,
"message": "string"
}This endpoint deletes a photo in the database and in the service.
-
Example
request -
headers
{
"Content-Type": "multipart/form-data",
"Authorization": "(Login Token)"
}-request body
{
"publicId": "string"
}-example response body
{ "data": "string", "success": true, "message": "string" }
The endpoints with the tag [Authorize] can only be used by a registered user.