first commit
This commit is contained in:
1377
docs/docs.go
Normal file
1377
docs/docs.go
Normal file
File diff suppressed because it is too large
Load Diff
1348
docs/swagger.json
Normal file
1348
docs/swagger.json
Normal file
File diff suppressed because it is too large
Load Diff
872
docs/swagger.yaml
Normal file
872
docs/swagger.yaml
Normal file
@@ -0,0 +1,872 @@
|
||||
definitions:
|
||||
controllers.AddToCartRequest:
|
||||
properties:
|
||||
product_id:
|
||||
type: integer
|
||||
quantity:
|
||||
minimum: 1
|
||||
type: integer
|
||||
required:
|
||||
- product_id
|
||||
- quantity
|
||||
type: object
|
||||
controllers.LoginRequest:
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
type: object
|
||||
controllers.RefreshRequest:
|
||||
properties:
|
||||
refresh_token:
|
||||
type: string
|
||||
required:
|
||||
- refresh_token
|
||||
type: object
|
||||
controllers.RegisterRequest:
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
first_name:
|
||||
type: string
|
||||
last_name:
|
||||
type: string
|
||||
password:
|
||||
minLength: 6
|
||||
type: string
|
||||
username:
|
||||
minLength: 3
|
||||
type: string
|
||||
required:
|
||||
- email
|
||||
- first_name
|
||||
- last_name
|
||||
- password
|
||||
- username
|
||||
type: object
|
||||
controllers.ResendVerificationRequest:
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
required:
|
||||
- email
|
||||
type: object
|
||||
controllers.UpdateCartItemRequest:
|
||||
properties:
|
||||
quantity:
|
||||
minimum: 1
|
||||
type: integer
|
||||
required:
|
||||
- quantity
|
||||
type: object
|
||||
models.CartDoc:
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
items:
|
||||
items:
|
||||
$ref: '#/definitions/models.CartItemDoc'
|
||||
type: array
|
||||
user_id:
|
||||
type: integer
|
||||
type: object
|
||||
models.CartItemDoc:
|
||||
properties:
|
||||
cart_id:
|
||||
type: integer
|
||||
id:
|
||||
type: integer
|
||||
product:
|
||||
$ref: '#/definitions/models.ProductDoc'
|
||||
product_id:
|
||||
type: integer
|
||||
quantity:
|
||||
type: integer
|
||||
type: object
|
||||
models.CategoryDoc:
|
||||
properties:
|
||||
children:
|
||||
items:
|
||||
$ref: '#/definitions/models.CategoryDoc'
|
||||
type: array
|
||||
description:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
parent_id:
|
||||
type: integer
|
||||
title:
|
||||
type: string
|
||||
type: object
|
||||
models.CommentDoc:
|
||||
properties:
|
||||
body:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
post_id:
|
||||
type: integer
|
||||
user_id:
|
||||
type: integer
|
||||
type: object
|
||||
models.PostDoc:
|
||||
properties:
|
||||
categories:
|
||||
items:
|
||||
$ref: '#/definitions/models.CategoryDoc'
|
||||
type: array
|
||||
content:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
images:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
tags:
|
||||
items:
|
||||
$ref: '#/definitions/models.TagDoc'
|
||||
type: array
|
||||
title:
|
||||
type: string
|
||||
type: object
|
||||
models.ProductCategoryDoc:
|
||||
properties:
|
||||
children:
|
||||
items:
|
||||
$ref: '#/definitions/models.ProductCategoryDoc'
|
||||
type: array
|
||||
description:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
keywords:
|
||||
type: string
|
||||
parent_id:
|
||||
type: integer
|
||||
slug:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
type: object
|
||||
models.ProductCategoryViewDoc:
|
||||
properties:
|
||||
category_id:
|
||||
type: integer
|
||||
id:
|
||||
type: integer
|
||||
ip_address:
|
||||
type: string
|
||||
type: object
|
||||
models.ProductCommentDoc:
|
||||
properties:
|
||||
body:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
product_id:
|
||||
type: integer
|
||||
user_id:
|
||||
type: integer
|
||||
type: object
|
||||
models.ProductDoc:
|
||||
properties:
|
||||
categories:
|
||||
items:
|
||||
$ref: '#/definitions/models.ProductCategoryDoc'
|
||||
type: array
|
||||
content:
|
||||
type: string
|
||||
format:
|
||||
type: string
|
||||
height:
|
||||
type: integer
|
||||
id:
|
||||
type: integer
|
||||
images:
|
||||
type: string
|
||||
price:
|
||||
type: number
|
||||
quality:
|
||||
type: integer
|
||||
slug:
|
||||
type: string
|
||||
tags:
|
||||
items:
|
||||
$ref: '#/definitions/models.ProductTagDoc'
|
||||
type: array
|
||||
title:
|
||||
type: string
|
||||
width:
|
||||
type: integer
|
||||
type: object
|
||||
models.ProductTagDoc:
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
models.TagDoc:
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
info:
|
||||
contact: {}
|
||||
paths:
|
||||
/api/v1/auth/login:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Login payload
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.LoginRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Login user
|
||||
tags:
|
||||
- Auth
|
||||
/api/v1/auth/me:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get current user from token
|
||||
tags:
|
||||
- Auth
|
||||
/api/v1/auth/refresh:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Refresh payload
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.RefreshRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Refresh access token
|
||||
tags:
|
||||
- Auth
|
||||
/api/v1/auth/register:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Register payload
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.RegisterRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Register user
|
||||
tags:
|
||||
- Auth
|
||||
/api/v1/auth/resend-verification:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Resend verification payload
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.ResendVerificationRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Resend verification email
|
||||
tags:
|
||||
- Auth
|
||||
/api/v1/auth/verify-email:
|
||||
get:
|
||||
parameters:
|
||||
- description: Email verify token
|
||||
in: query
|
||||
name: token
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Verify email address with token
|
||||
tags:
|
||||
- Auth
|
||||
/api/v1/cart:
|
||||
delete:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CartDoc'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Clear the entire cart
|
||||
tags:
|
||||
- Cart
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CartDoc'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get the current user's cart
|
||||
tags:
|
||||
- Cart
|
||||
/api/v1/cart/items:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Cart Item Details
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.AddToCartRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CartDoc'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Add item to cart
|
||||
tags:
|
||||
- Cart
|
||||
/api/v1/cart/items/{item_id}:
|
||||
delete:
|
||||
parameters:
|
||||
- description: Cart Item ID
|
||||
in: path
|
||||
name: item_id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CartDoc'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Remove item from cart
|
||||
tags:
|
||||
- Cart
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Cart Item ID
|
||||
in: path
|
||||
name: item_id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Update Quantity
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.UpdateCartItemRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CartDoc'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Update cart item quantity
|
||||
tags:
|
||||
- Cart
|
||||
/api/v1/categories:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.CategoryDoc'
|
||||
type: array
|
||||
summary: List categories (public)
|
||||
tags:
|
||||
- Categories
|
||||
/api/v1/categories/{slug}:
|
||||
get:
|
||||
parameters:
|
||||
- description: Category slug
|
||||
in: path
|
||||
name: slug
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryDoc'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Get single category (public)
|
||||
tags:
|
||||
- Categories
|
||||
/api/v1/comments:
|
||||
get:
|
||||
parameters:
|
||||
- description: Post ID
|
||||
in: query
|
||||
name: post_id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.CommentDoc'
|
||||
type: array
|
||||
summary: List comments for a post (public)
|
||||
tags:
|
||||
- Comments
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Comment payload
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/models.CommentDoc'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Create comment (public)
|
||||
tags:
|
||||
- Comments
|
||||
/api/v1/hero:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Get active hero/banner
|
||||
tags:
|
||||
- Hero
|
||||
/api/v1/heroes:
|
||||
get:
|
||||
description: Returns all hero/banner records (no filter)
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
type: array
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Get all heroes
|
||||
tags:
|
||||
- Hero
|
||||
/api/v1/posts:
|
||||
get:
|
||||
parameters:
|
||||
- description: Page number
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- description: Items per page
|
||||
in: query
|
||||
name: per_page
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
summary: List posts (public) with pagination
|
||||
tags:
|
||||
- Posts
|
||||
/api/v1/posts/{slug}:
|
||||
get:
|
||||
parameters:
|
||||
- description: Post slug
|
||||
in: path
|
||||
name: slug
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.PostDoc'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Get single post (public)
|
||||
tags:
|
||||
- Posts
|
||||
/api/v1/product-categories/{id}/view:
|
||||
post:
|
||||
parameters:
|
||||
- description: Category ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/models.ProductCategoryViewDoc'
|
||||
summary: Record a view for a product category
|
||||
tags:
|
||||
- Products
|
||||
/api/v1/products:
|
||||
get:
|
||||
parameters:
|
||||
- description: Page number
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- description: Items per page
|
||||
in: query
|
||||
name: per_page
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
summary: List products (public) with pagination
|
||||
tags:
|
||||
- Products
|
||||
/api/v1/products/{id}/comments:
|
||||
get:
|
||||
parameters:
|
||||
- description: Product ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.ProductCommentDoc'
|
||||
type: array
|
||||
summary: Get comments for a product
|
||||
tags:
|
||||
- Products
|
||||
/api/v1/products/{slug}:
|
||||
get:
|
||||
parameters:
|
||||
- description: Product slug
|
||||
in: path
|
||||
name: slug
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.ProductDoc'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Get single product (public) by slug
|
||||
tags:
|
||||
- Products
|
||||
/api/v1/setting:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Get site settings
|
||||
tags:
|
||||
- Setting
|
||||
/api/v1/tags:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.TagDoc'
|
||||
type: array
|
||||
summary: List tags (public)
|
||||
tags:
|
||||
- Tags
|
||||
securityDefinitions:
|
||||
BearerAuth:
|
||||
description: Enter your bearer token in the format 'Bearer {token}'
|
||||
in: header
|
||||
name: Authorization
|
||||
type: apiKey
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user