Categorygithub.com/FadhilRasyidin/go-backend-telkom
repositorypackage
0.0.0-20230512141050-6d6ce816076a
Repository: https://github.com/fadhilrasyidin/go-backend-telkom.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Overview


I will be using yesterday's task admission as it has already implemented some fundamental ecommerce features

Tasks

  • Buatlah API untuk menampilkan list produk seperti pada gambar dibawah ini. Pada API list produk juga bisa untuk menghandle search by product name
  • Buatlah API untuk menampilkan produk detail seperti gambar dibawah ini.
  • Buatlah API untuk menambah, mengubah dan menghapus produk (Create, Update, Delete)
  • Hanya authenticated user yang dapat mengakses API Create, Update, dan Delete produk, selain itu API bisa diakses oleh guest user
  • Pada API Create Produk dan Update Produk harus dapat mengupload image produk ke minio. Pada kedua API ini disarankan menggunakan form data untuk request payloadnya
  • Format penyimpanan di minio menggunakan //

Plus Points

  • Dapat menyimpan image di minio tanpa menggunakan temporary image
  • Image yang disimpan diminio dapat diakses publik dan memenuhi kriteria diatas

How to Run

# You can start the project with below commands
docker-compose up -d
go run main.go
  • SIGNUP FUNCTION API CALL (POST REQUEST)

http://localhost:8000/users/signup

{
  "first_name": "fadhil",
  "last_name": "fadhil",
  "email": "[email protected]",
  "password": "fadhilfadhil",
  "phone": "+4534545435"
}

Response :"Successfully Signed Up!!"

{
  "email": "[email protected]",
  "password": "fadhilfadhil"
}

response will be like this

{
  "_id": "***********************",
  "first_name": "fadhil",
  "last_name": "fadhil",
  "password": "$2a$14$UIYjkTfnFnhg4qhIfhtYnuK9qsBQifPKgu/WPZAYBaaN17j0eTQZa",
  "email": "[email protected]",
  "phone": "+4534545435",
  "token": "eyJc0Bwcm90b25vbWFpbC5jb20iLCJGaXJzdF9OYW1lIjoiam9zZXBoIiwiTGFzdF9OYW1lIjoiaGVybWlzIiwiVWlkIjoiNjE2MTRmNTM5ZjI5YmU5NDJiZDlkZjhlIiwiZXhwIjoxNjMzODUzNjUxfQ.NbcpVtPLJJqRF44OLwoanynoejsjdJb5_v2qB41SmB8",
  "Refresh_Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IiIsIkZpcnLCJVaWQiOiIiLCJleHAiOjE2MzQzNzIwNTF9.ocpU8-0gCJsejmCeeEiL8DXhFcZsW7Z3OCN34HgIf2c",
  "created_at": "2022-04-09T08:14:11Z",
  "updtaed_at": "2022-04-09T08:14:11Z",
  "user_id": "61614f539f29be942bd9df8e",
  "usercart": [],
  "address": [],
  "orders": []
}
{
  "product_name": "Xiaomi Mi Band 2 Smartwatch",
  "price": 150000,
  "rating": 3,
  "image": "xia.jpg"
}

Response : "Successfully added our Product Admin!!"

Response

[
  {
    "Product_ID": "6153ff8edef2c3c0a02ae39a",
    "product_name": "xiaomimiband2smartwatch",
    "price": 15000,
    "rating": 3,
    "image": "xia.jpg"
  }
]
  • Search Product by regex function (GET REQUEST)

defines the word search sorting http://localhost:8000/users/search?name=al

response:

[
  {
    "Product_ID": "6153ff8edef2c3c0a02ae39a",
    "product_name": "xiaomimiband2smartwatch",
    "price": 15000,
    "rating": 3,
    "image": "xia.jpg"
  }
]
{
  "house_name": "kosan",
  "street_name": "perkici x",
  "city_name": "tangsel",
  "pin_code": "15222"
}