Skip to content

Commit

Permalink
Merge pull request #15 from RyaWcksn/DEV-0001
Browse files Browse the repository at this point in the history
Dev 0001
  • Loading branch information
RyaWcksn authored Apr 8, 2023
2 parents 8b98ada + dd0bdbd commit d83acc4
Show file tree
Hide file tree
Showing 9 changed files with 529 additions and 7 deletions.
221 changes: 221 additions & 0 deletions Ecommerce.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"info": {
"_postman_id": "88ed0e03-4670-49a1-8ddf-94998901a31b",
"name": "Ecommerce",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Login",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"[email protected]\",\n \"password\": \"password123\",\n \"role\": \"buyer\"\n}"
},
"url": {
"raw": "http://localhost:9000/api/v1/login",
"protocol": "http",
"host": [
"localhost"
],
"port": "9000",
"path": [
"api",
"v1",
"login"
]
}
},
"response": []
},
{
"name": "Create Product",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJlbWFpbCI6InVzZXJAbWFpbC5jb20iLCJleHAiOjE2ODA4NDA5MzgsImlkIjoxLCJyb2xlIjoiYnV5ZXIifQ.nCANSscjLFy3zUDkXoeuU-82nujolaoyi_BSkH5IN64",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJlbWFpbCI6InVzZXJAbWFpbC5jb20iLCJleHAiOiIxNjgwNzk2NTgyIiwiaWQiOiIxIiwicm9sZSI6InNlbGxlciJ9.64y5erHm71BfYLJXxXxUZy0J6vm3FufLO0rw54Pk7Wg",
"type": "default",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"HG Dynames Gundam\",\n \"description\": \"HG Dynames Gundam from Kidou Senshi Gundam 00\",\n \"price\": \"18000\"\n}"
},
"url": {
"raw": "http://localhost:9000/api/v1/seller/create",
"protocol": "http",
"host": [
"localhost"
],
"port": "9000",
"path": [
"api",
"v1",
"seller",
"create"
]
}
},
"response": []
},
{
"name": "Get Seller products",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:9000/api/v1/seller/products",
"protocol": "http",
"host": [
"localhost"
],
"port": "9000",
"path": [
"api",
"v1",
"seller",
"products"
]
}
},
"response": []
},
{
"name": "Create Order",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"productId\": [1],\n \"sellerId\": 1\n}"
},
"url": {
"raw": "http://localhost:9000/api/v1/order",
"protocol": "http",
"host": [
"localhost"
],
"port": "9000",
"path": [
"api",
"v1",
"order"
]
}
},
"response": []
},
{
"name": "Get all seller orders",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:9000/api/v1/seller/order",
"protocol": "http",
"host": [
"localhost"
],
"port": "9000",
"path": [
"api",
"v1",
"seller",
"order"
]
}
},
"response": []
},
{
"name": "Accept Order",
"request": {
"method": "PATCH",
"header": [],
"url": {
"raw": "http://localhost:9000/api/v1/seller/order/accept",
"protocol": "http",
"host": [
"localhost"
],
"port": "9000",
"path": [
"api",
"v1",
"seller",
"order",
"accept"
]
}
},
"response": []
},
{
"name": "Buyer list orders",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:9000/api/v1/orders",
"protocol": "http",
"host": [
"localhost"
],
"port": "9000",
"path": [
"api",
"v1",
"orders"
]
}
},
"response": []
},
{
"name": "Get Products",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJlbWFpbCI6InVzZXJAbWFpbC5jb20iLCJleHAiOjE2ODA5MjYyMzUsImlkIjoxLCJyb2xlIjoiYnV5ZXIifQ.0tXezwqgzCcU073i7e0xo5_02Lte65Z7kPMxtkjGvEM",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:9000/api/v1/products",
"protocol": "http",
"host": [
"localhost"
],
"port": "9000",
"path": [
"api",
"v1",
"products"
]
}
},
"response": []
}
]
}
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Ecommerce for seller and buyer
**Table of Contents**

- [ecommerce](#ecommerce)
- [How to install](#how-to-install)
- [Common Errors](#common-errors)
- [Endpoints](#endpoints)
- [Requests and Response](#requests-and-response)
Expand All @@ -25,6 +26,24 @@ Ecommerce for seller and buyer

<!-- markdown-toc end -->

## How to install

```bash
git clone https://github.com/RyaWcksn/ecommerce
cd ecommerce
docker-compose --build -d

./migrate.sh
```

- Buyer account
> [email protected]
> password123
- Seller account
> [email protected]
> password123

## Common Errors

Expand Down
1 change: 0 additions & 1 deletion apis/v1/services/service_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func (s *ServiceImpl) GetProductsList(ctx context.Context, id int) (productList
func (s *ServiceImpl) CreateOrder(ctx context.Context, payload *dto.CreateOrderRequest) (resp *entities.OrderStatus, err error) {
idStr := ctx.Value("id").(string)
id, _ := strconv.Atoi(idStr)
fmt.Println("ID", id)

buyerData, err := s.buyerImpl.GetData(ctx, id)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion configs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
server:
httpaddress: "9000"
database:
host: "127.0.0.1:3306"
host: "mysql:3306"
username: "aya"
password: "p4ssw0rd1"
database: "ecommerce"
Expand Down
Loading

0 comments on commit d83acc4

Please sign in to comment.