controller

package
v0.0.0-...-1951ad6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

func RegisterCategory

func RegisterCategory(c Category)

func RegisterClient

func RegisterClient(c Client)

func RegisterInventory

func RegisterInventory(c Inventory)

func RegisterInvoice

func RegisterInvoice(c Invoice)

func RegisterProduct

func RegisterProduct(c Product)

func RegisterSwagger

func RegisterSwagger(c Swagger)

func RegisterUser

func RegisterUser(c User)

Types

type Category

type Category struct {
	fx.In
	Validator *helper.Validator
	Service   *service.Category
	Route     fiber.Router `name:"api-v1"`
}

func (Category) AddCategory

func (c Category) AddCategory(ctx *fiber.Ctx) error

AddCategories godoc

@Summary		Add New Category
@Description	Add New Category
@Tags			categories
@Accept			json
@Produce		json
@param			request	body		dto.CategoryDTO	true	"category data"
@Success		200		{object}	output.Category

@Failure		400		{object}	output.HTTPError
@Router			/categories [Post]

func (Category) DeleteCategory

func (c Category) DeleteCategory(ctx *fiber.Ctx) error

DELETECategories godoc

@Summary		delete  Category
@Description	delete  Category
@Tags			categories
@Accept			json
@Produce		json

@Param			id	path		int		true	"Category ID"
@Success		200	{string}	string	"deleted successfully"

@Router			/categories/{id} [Delete]

func (Category) GetCategories

func (c Category) GetCategories(ctx *fiber.Ctx) error

GetCategories godoc

@Summary		get All Categories
@Description	get All Categories
@Tags			categories
@Accept			json
@Produce		json
@Success		200	{array}	output.Category
@Router			/categories [get]

func (Category) UpdateCategory

func (c Category) UpdateCategory(ctx *fiber.Ctx) error

UpdateCategories godoc

@Summary		Update  Category
@Description	Update  Category
@Tags			categories
@Accept			json
@Produce		json
@param			request		body		dto.CategoryDTO	true	"category data"
@param			category_id	path		int				true	"category id"

@Success		200			{object}	model.Category

@Failure		400			{object}	output.HTTPError
@Router			/categories/{category_id} [Patch]

type Client

type Client struct {
	fx.In
	Uploader  *helper.Uploader
	Validator *helper.Validator
	Service   *service.Client
	Route     fiber.Router `name:"api-v1"`
}

func (Client) AddClient

func (c Client) AddClient(ctx *fiber.Ctx) error

AddCategories godoc

@Summary		Add New Client
@Description	Add New Client
@Tags			clients
@Accept			mpfd
@Produce		mpfd
@param			name		formData	string	true	"enter client name"
@param			email		formData	string	true	"enter client email"
@param			phone		formData	number	true	"enter client phone"
@param			is_client	formData	boolean	false	" is client ?"
@param			is_supplier	formData	boolean	false	"is supplier ?"
@param			image		formData	file	true	"image"
@Success		200			{object}	output.Client

@Failure		400			{object}	output.HTTPError
@Router			/clients [Post]

func (Client) DeleteClient

func (c Client) DeleteClient(ctx *fiber.Ctx) error

DeleteClient godoc

@Summary		delete  Client
@Description	delete  Client
@Tags			clients
@Accept			json
@Produce		json

@Param			id	path		int		true	"Client ID"
@Success		200	{string}	string	"deleted successfully"

@Router			/clients/{id} [Delete]

func (*Client) GetClients

func (c *Client) GetClients(ctx *fiber.Ctx) error

GetClients godoc

@Summary		get All Clients
@Description	get All Clients
@Tags			clients
@Accept			json
@Produce		json
@Success		200	{array}	output.Client
@Router			/clients [get]

func (Client) UpdateClient

func (c Client) UpdateClient(ctx *fiber.Ctx) error

UpdateCategories godoc

@Summary		Update  Client
@Description	Update  Client
@Tags			clients
@Accept			mpfd
@Produce		mpfd
@param			name		formData	string	true	"enter client name"
@param			email		formData	string	true	"enter client email"
@param			phone		formData	number	true	"enter client phone"
@param			is_client	formData	boolean	false	"is client ?"
@param			is_supplier	formData	boolean	false	"is supplier ?"
@param			image		formData	file	true	"image"
@param			client_id	path		int		true	"client id"

@Success		200			{object}	model.Client

@Failure		400			{object}	output.HTTPError
@Router			/clients/{client_id} [Patch]

type Inventory

type Inventory struct {
	fx.In
	Validator *helper.Validator
	Service   *service.Inventory
	Route     fiber.Router `name:"api-v1"`
}

func (Inventory) AddInventory

func (c Inventory) AddInventory(ctx *fiber.Ctx) error

AddInventories godoc

@Summary		Add New Inventory
@Description	Add New Inventory
@Tags			inventories
@Accept			json
@Produce		json
@param			request	body		dto.InventoryDTO	true	"inventory data"
@Success		200		{object}	output.Inventory

@Failure		400		{object}	output.HTTPError
@Router			/inventories [Post]

func (Inventory) DeleteInventory

func (c Inventory) DeleteInventory(ctx *fiber.Ctx) error

DELETEInventories godoc

@Summary		delete  Inventory
@Description	delete  Inventory
@Tags			inventories
@Accept			json
@Produce		json

@Param			id	path		int		true	"Inventory ID"
@Success		200	{string}	string	"deleted successfully"

@Router			/inventories/{id} [Delete]

func (Inventory) GetInventories

func (c Inventory) GetInventories(ctx *fiber.Ctx) error

GetInventories godoc

@Summary		get All Inventories
@Description	get All Inventories
@Tags			inventories
@Accept			json
@Produce		json
@Success		200	{array}	output.Inventory
@Router			/inventories [get]

func (Inventory) UpdateInventory

func (c Inventory) UpdateInventory(ctx *fiber.Ctx) error

UpdateInventories godoc

@Summary		Update  Inventory
@Description	Update  Inventory
@Tags			inventories
@Accept			json
@Produce		json
@param			request			body		dto.InventoryDTO	true	"inventory data"
@param			inventory_id	path		int					true	"inventory id"

@Success		200				{object}	model.Inventory

@Failure		400				{object}	output.HTTPError
@Router			/inventories/{inventory_id} [Patch]

type Invoice

type Invoice struct {
	fx.In
	Validator *helper.Validator
	Service   *service.Invoice
	Route     fiber.Router `name:"api-v1"`
}

func (*Invoice) AddInvoice

func (c *Invoice) AddInvoice(ctx *fiber.Ctx) error

AddCategories godoc

@Summary		Add New Invoice
@Description	Add New Invoice
@Tags			invoices
@Accept			json
@Produce		json
@param			request	body		dto.InvoiceDTO	true	"invoice data"
@Success		200		{string}	string			"Invoice Stored Successfully"

@Failure		400		{object}	output.HTTPError
@Router			/invoices [Post]

func (*Invoice) GetInvoices

func (c *Invoice) GetInvoices(ctx *fiber.Ctx) error

GetInvoices godoc

@Summary		get All Invoices
@Description	get All Invoices
@Tags			invoices
@Accept			json
@Produce		json
@Success		200	{array}	output.Invoice
@Router			/invoices [get]

type Product

type Product struct {
	fx.In
	Uploader  *helper.Uploader
	Validator *helper.Validator
	Service   *service.Product
	Route     fiber.Router `name:"api-v1"`
}

func (Product) AddProduct

func (c Product) AddProduct(ctx *fiber.Ctx) error

AddCategories godoc

@Summary		Add New Product
@Description	Add New Product
@Tags			products
@Accept			mpfd
@Produce		mpfd
@param			name		formData	string	true	"enter product name"
@param			code		formData	string	true	"enter product code"
@param			cost_price	formData	number	true	"enter product cost price"
@param			sell_price	formData	number	true	"enter product sell price"
@param			category_id	formData	int		true	"category ID"
@param			image		formData	file	false	"image"
@Success		200			{object}	output.Product

@Failure		400			{object}	output.HTTPError
@Router			/products [Post]

func (Product) DeleteProduct

func (c Product) DeleteProduct(ctx *fiber.Ctx) error

DeleteProduct godoc

@Summary		delete  Product
@Description	delete  Product
@Tags			products
@Accept			json
@Produce		json

@Param			id	path		int		true	"Product ID"
@Success		200	{string}	string	"deleted successfully"

@Router			/products/{id} [Delete]

func (*Product) GetProducts

func (c *Product) GetProducts(ctx *fiber.Ctx) error

GetProducts godoc

@Summary		get All Products
@Description	get All Products
@Tags			products
@Accept			json
@Produce		json
@Success		200	{array}	output.Product
@Router			/products [get]

func (Product) ShowProduct

func (c Product) ShowProduct(ctx *fiber.Ctx) error

get product godoc

@Summary		show  Product
@Description	show  Product
@Tags			products
@Accept			json
@Produce		json
@param			product_id	path		int	true	"Product ID"

@Success		200			{object}	model.Product

@Failure		400			{object}	output.HTTPError
@Router			/products/{product_id} [Get]

func (Product) UpdateProduct

func (c Product) UpdateProduct(ctx *fiber.Ctx) error

UpdateCategories godoc

@Summary		Update  Product
@Description	Update  Product
@Tags			products
@Accept			mpfd
@Produce		mpfd
@param			name		formData	string	true	"enter product name"
@param			code		formData	string	true	"enter product code"
@param			cost_price	formData	number	true	"enter product cost price"
@param			sell_price	formData	number	true	"enter product sell price"
@param			category_id	formData	int		true	"category ID"
@param			image		formData	file	true	"image"
@param			product_id	path		int		true	"Product ID"

@Success		200			{object}	model.Product

@Failure		400			{object}	output.HTTPError
@Router			/products/{product_id} [Patch]

type Swagger

type Swagger struct {
	fx.In
	Route fiber.Router `name:"internal"`
}

type User

type User struct {
	fx.In
	Encryptor *helper.Encryptor
	Validator *helper.Validator
	Service   *service.User
	Route     fiber.Router `name:"api-v1"`
}

func (User) AddUser

func (c User) AddUser(ctx *fiber.Ctx) error

AddCategories godoc

@Summary		Add New User
@Description	Add New User
@Tags			users
@Accept			json
@Produce		json
@param			request	body		dto.CreateUserDTO	true	"user data"
@Success		200		{object}	output.User

@Failure		400		{object}	output.HTTPError
@Router			/users [Post]

func (User) DeleteUser

func (c User) DeleteUser(ctx *fiber.Ctx) error

DeleteUser godoc

@Summary		delete  User
@Description	delete  User
@Tags			users
@Accept			json
@Produce		json

@Param			id	path		int		true	"User ID"
@Success		200	{string}	string	"deleted successfully"

@Router			/users/{id} [Delete]

func (*User) GetUsers

func (c *User) GetUsers(ctx *fiber.Ctx) error

GetUsers godoc

@Summary		get All Users
@Description	get All Users
@Tags			users
@Accept			json
@Produce		json
@Success		200	{array}	output.User
@Router			/users [get]

func (User) UpdateUser

func (c User) UpdateUser(ctx *fiber.Ctx) error

UpdateCategories godoc

@Summary		Update  User
@Description	Update  User
@Tags			users
@Accept			json
@Produce		json
@param			request	body		dto.UpdateUserDTO	true	"user data"
@param			user_id	path		int					true	"user id"

@Success		200		{object}	model.User

@Failure		400		{object}	output.HTTPError
@Router			/users/{user_id} [Patch]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL