Skip to content

Commit

Permalink
Merge pull request #34 from quangdangfit/redis-cache
Browse files Browse the repository at this point in the history
Redis cache
  • Loading branch information
quangdangfit authored Jun 11, 2023
2 parents b0fb832 + dd78f54 commit aea160f
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/api/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewOrderAPI(validator validation.Validation, service services.IOrderService
// PlaceOrder godoc
//
// @Summary place order
// @Tags orders
// @Produce json
// @Security ApiKeyAuth
// @Param _ body serializers.PlaceOrderReq true "Body"
Expand Down Expand Up @@ -62,6 +63,7 @@ func (a *OrderAPI) PlaceOrder(c *gin.Context) {
// GetOrders godoc
//
// @Summary get my orders
// @Tags orders
// @Produce json
// @Security ApiKeyAuth
// @Param _ query serializers.ListOrderReq true "Query"
Expand Down Expand Up @@ -92,6 +94,7 @@ func (a *OrderAPI) GetOrders(c *gin.Context) {
// GetOrderByID godoc
//
// @Summary get order details
// @Tags orders
// @Produce json
// @Security ApiKeyAuth
// @Param id path string true "Order ID"
Expand All @@ -114,6 +117,7 @@ func (a *OrderAPI) GetOrderByID(c *gin.Context) {
// CancelOrder godoc
//
// @Summary cancel order
// @Tags orders
// @Produce json
// @Security ApiKeyAuth
// @Param id path string true "Order ID"
Expand Down
4 changes: 4 additions & 0 deletions app/api/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func NewProductAPI(
// GetProductByID godoc
//
// @Summary Get product by id
// @Tags products
// @Produce json
// @Param id path string true "Product ID"
// @Success 200 {object} serializers.Product
Expand Down Expand Up @@ -64,6 +65,7 @@ func (p *ProductAPI) GetProductByID(c *gin.Context) {
// ListProducts godoc
//
// @Summary Get list products
// @Tags products
// @Produce json
// @Success 200 {object} serializers.ListProductRes
// @Router /api/v1/products [get]
Expand Down Expand Up @@ -98,6 +100,7 @@ func (p *ProductAPI) ListProducts(c *gin.Context) {
// CreateProduct godoc
//
// @Summary create product
// @Tags products
// @Produce json
// @Security ApiKeyAuth
// @Param _ body serializers.CreateProductReq true "Body"
Expand Down Expand Up @@ -132,6 +135,7 @@ func (p *ProductAPI) CreateProduct(c *gin.Context) {
// UpdateProduct godoc
//
// @Summary update product
// @Tags products
// @Produce json
// @Security ApiKeyAuth
// @Param id path string true "Product ID"
Expand Down
4 changes: 4 additions & 0 deletions app/api/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewUserAPI(validator validation.Validation, service services.IUserService)
// Login godoc
//
// @Summary Login
// @Tags users
// @Produce json
// @Param _ body serializers.LoginReq true "Body"
// @Success 200 {object} serializers.LoginRes
Expand Down Expand Up @@ -62,6 +63,7 @@ func (u *UserAPI) Login(c *gin.Context) {
// Register godoc
//
// @Summary Register new user
// @Tags users
// @Produce json
// @Param _ body serializers.RegisterReq true "Body"
// @Success 200 {object} serializers.RegisterRes
Expand Down Expand Up @@ -94,6 +96,7 @@ func (u *UserAPI) Register(c *gin.Context) {
// GetMe godoc
//
// @Summary get my profile
// @Tags users
// @Security ApiKeyAuth
// @Produce json
// @Success 200 {object} serializers.User
Expand Down Expand Up @@ -130,6 +133,7 @@ func (u *UserAPI) RefreshToken(c *gin.Context) {
// ChangePassword godoc
//
// @Summary changes the password
// @Tags users
// @Security ApiKeyAuth
// @Produce json
// @Param _ body serializers.ChangePasswordReq true "Body"
Expand Down
36 changes: 36 additions & 0 deletions docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"produces": [
"application/json"
],
"tags": [
"orders"
],
"summary": "get my orders",
"parameters": [
{
Expand Down Expand Up @@ -45,6 +48,9 @@
"produces": [
"application/json"
],
"tags": [
"orders"
],
"summary": "place order",
"parameters": [
{
Expand Down Expand Up @@ -77,6 +83,9 @@
"produces": [
"application/json"
],
"tags": [
"orders"
],
"summary": "get order details",
"parameters": [
{
Expand Down Expand Up @@ -107,6 +116,9 @@
"produces": [
"application/json"
],
"tags": [
"orders"
],
"summary": "cancel order",
"parameters": [
{
Expand All @@ -125,6 +137,9 @@
"produces": [
"application/json"
],
"tags": [
"products"
],
"summary": "Get list products",
"responses": {
"200": {
Expand All @@ -144,6 +159,9 @@
"produces": [
"application/json"
],
"tags": [
"products"
],
"summary": "create product",
"parameters": [
{
Expand Down Expand Up @@ -171,6 +189,9 @@
"produces": [
"application/json"
],
"tags": [
"products"
],
"summary": "Get product by id",
"parameters": [
{
Expand Down Expand Up @@ -199,6 +220,9 @@
"produces": [
"application/json"
],
"tags": [
"products"
],
"summary": "update product",
"parameters": [
{
Expand Down Expand Up @@ -238,6 +262,9 @@
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "changes the password",
"parameters": [
{
Expand All @@ -258,6 +285,9 @@
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Login",
"parameters": [
{
Expand Down Expand Up @@ -290,6 +320,9 @@
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "get my profile",
"responses": {
"200": {
Expand All @@ -306,6 +339,9 @@
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Register new user",
"parameters": [
{
Expand Down
Loading

0 comments on commit aea160f

Please sign in to comment.