Documentation ¶
Index ¶
- Constants
- type Customer
- type CustomerRepository
- type CustomerUsecase
- type Discount
- type DiscountRepository
- type DiscountUsecase
- type ErrorResponse
- type JwtCustomClaims
- type JwtCustomRefreshClaims
- type LoginRequest
- type LoginResponse
- type LoginUsecase
- type Logistics
- type LogisticsRepository
- type LogisticsType
- type LogisticsUsecase
- type Pagination
- type Product
- type ProductRepository
- type ProductUsecase
- type RefreshTokenRequest
- type RefreshTokenResponse
- type RefreshTokenUsecase
- type SignupRequest
- type SignupResponse
- type SignupUsecase
- type SuccessResponse
- type User
- type UserRepository
- type UserUseCase
- type WarehousePortRepository
- type WarehousePortUsecase
- type WarehousesAndPorts
Constants ¶
View Source
const CustomerTable = "customers"
View Source
const DiscountTable = "discounts"
View Source
const LogisticsTable = "logistics"
View Source
const ProductTable = "products"
View Source
const (
UserTable = "users"
)
View Source
const WarehousePortTable = "warehouses_and_ports"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Customer ¶
type Customer struct { ID uuid.UUID `json:"id,omitempty" jsonschema:"description=ID,title=ID"` Name string `json:"name" jsonschema:"required,description=Name of the customer,title=Name"` Email string `json:"email" jsonschema:"required,description=Email of the customer,title=Email"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type CustomerRepository ¶
type CustomerRepository interface { FindMany(ctx context.Context, pagination *Pagination, filters map[string]interface{}) ([]*Customer, error) FindByID(ctx context.Context, id uuid.UUID) (*Customer, error) Store(ctx context.Context, c *Customer) (*Customer, error) Update(ctx context.Context, c *Customer, id uuid.UUID) (*Customer, error) Delete(ctx context.Context, id uuid.UUID) error }
type CustomerUsecase ¶
type Discount ¶
type Discount struct { ID uuid.UUID `json:"id,omitempty"` Type LogisticsType `json:"type" jsonschema:"required,description=Type of logistics,title=Type"` QuantityFrom int `json:"quantity_from" jsonschema:"required,description=Starting quantity for discount,title=Quantity From"` QuantityTo int `json:"quantity_to" jsonschema:"required,description=Ending quantity for discount,title=Quantity To"` Percentage float64 `json:"percentage" jsonschema:"required,description=Discount percentage,title=Percentage"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type DiscountRepository ¶
type DiscountRepository interface { FindMany(ctx context.Context, pagination *Pagination, filters map[string]interface{}) ([]*Discount, error) FindByID(ctx context.Context, id uuid.UUID) (*Discount, error) FindByTypeAndQuantity(ctx context.Context, dtype LogisticsType, quantity int) (*Discount, error) Store(ctx context.Context, d *Discount) (*Discount, error) Update(ctx context.Context, d *Discount, id uuid.UUID) (*Discount, error) Delete(ctx context.Context, id uuid.UUID) error }
type DiscountUsecase ¶
type DiscountUsecase interface { GetMany(pagination *Pagination, filters map[string]interface{}) ([]*Discount, error) GetByTypeAndQuantity(dtype LogisticsType, quantity int) (*Discount, error) Create(d *Discount) (*Discount, error) Modify(d *Discount, id uuid.UUID) (*Discount, error) Remove(id uuid.UUID) error }
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
type JwtCustomClaims ¶
type JwtCustomClaims struct { Email string `json:"email"` ID uuid.UUID `json:"id"` jwt.StandardClaims }
JwtCustomClaims representa los claims personalizados que se incluyen en el JWT de la plataforma .
type JwtCustomRefreshClaims ¶
JwtCustomRefreshClaims representa los claims personalizados que se incluyen en el JWT de actualización en la plataforma .
type LoginRequest ¶
type LoginResponse ¶
type LoginUsecase ¶
type Logistics ¶
type Logistics struct { ID uuid.UUID `json:"id,omitempty"` CustomerID string `json:"customer_id" jsonschema:"required,description=ID of the customer,title=Customer ID,type=string"` ProductID string `json:"product_id" jsonschema:"required,description=ID of the product,title=Product ID,type=string"` WarehousePortID string `json:"warehouse_port_id" jsonschema:"required,description=ID of the warehouse port,title=Warehouse Port ID,type=string"` Type LogisticsType `json:"type" jsonschema:"required,description=Type of logistics,title=Type"` Quantity int `json:"quantity" jsonschema:"required,description=Quantity of items,title=Quantity"` RegistrationDate time.Time `json:"registration_date" jsonschema:"required,description=Date of registration,title=Registration Date"` DeliveryDate time.Time `json:"delivery_date" jsonschema:"required,description=Date of delivery,title=Delivery Date"` ShippingPrice float64 `json:"shipping_price" jsonschema:"required,description=Price of shipping,title=Shipping Price"` DiscountShippingPrice float64 `json:"discount_shipping_price,omitempty"` VehiclePlate string `json:"vehicle_plate,omitempty"` FleetNumber string `json:"fleet_number,omitempty"` GuideNumber string `json:"guide_number" jsonschema:"required,description=Guide number,title=Guide Number"` DiscountPercent float64 `json:"discount_percent,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type LogisticsRepository ¶
type LogisticsRepository interface { FindMany(ctx context.Context, pagination *Pagination, filters map[string]interface{}) ([]*Logistics, error) FindByID(ctx context.Context, id uuid.UUID) (*Logistics, error) Store(ctx context.Context, ll *Logistics) (*Logistics, error) Update(ctx context.Context, ll *Logistics, id uuid.UUID) (*Logistics, error) Delete(ctx context.Context, id uuid.UUID) error }
type LogisticsType ¶
type LogisticsType string
const ( Land LogisticsType = "land" Maritime LogisticsType = "maritime" )
type LogisticsUsecase ¶
type Pagination ¶
type Product ¶
type Product struct { ID uuid.UUID `json:"id,omitempty"` Name string `json:"name" jsonschema:"required,description=Name of the product,title=Name"` Type string `json:"type" jsonschema:"required,description=Type of product (land or maritime),title=Type"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type ProductRepository ¶
type ProductRepository interface { FindMany(ctx context.Context, pagination *Pagination, filters map[string]interface{}) ([]*Product, error) FindByID(ctx context.Context, id uuid.UUID) (*Product, error) Store(ctx context.Context, p *Product) (*Product, error) Update(ctx context.Context, p *Product, id uuid.UUID) (*Product, error) Delete(ctx context.Context, id uuid.UUID) error }
type ProductUsecase ¶
type RefreshTokenRequest ¶
type RefreshTokenRequest struct {
RefreshToken string `form:"refreshToken" binding:"required"`
}
type RefreshTokenResponse ¶
type RefreshTokenUsecase ¶
type RefreshTokenUsecase interface { GetUserByEmail(c context.Context, id string) (*User, error) CreateAccessToken(user *User, secret string, expiry int) (accessToken string, err error) CreateRefreshToken(user *User, secret string, expiry int) (refreshToken string, err error) ExtractIDFromToken(requestToken string, secret string) (string, error) }
type SignupRequest ¶
type SignupResponse ¶
type SignupUsecase ¶
type SignupUsecase interface { Create(c context.Context, user *User) (*User, error) GetUserByEmail(c context.Context, email string) (*User, error) CreateAccessToken(user *User, secret string, expiry int) (accessToken string, err error) CreateRefreshToken(user *User, secret string, expiry int) (refreshToken string, err error) }
type SuccessResponse ¶
type SuccessResponse struct {
Message string `json:"message"`
}
type User ¶
type User struct { ID uuid.UUID `json:"id,omitempty"` Email string `json:"email" jsonschema:"required,description=Email of the user,title=Email"` Password string `json:"password" jsonschema:"required,description=Password of the user,title=Password"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
func (*User) ComparePassword ¶
ComparePassword compara la contraseña proporcionada con la contraseña almacenada del usuario.
func (*User) SetPassword ¶
SetPassword encripta la contraseña y la asigna al usuario.
type UserRepository ¶
type UserRepository interface { Create(ctx context.Context, user *User) (*User, error) FindByID(ctx context.Context, id uuid.UUID) (*User, error) FindByEmail(ctx context.Context, email string) (*User, error) Update(ctx context.Context, user *User) (*User, error) Delete(ctx context.Context, id uuid.UUID) error }
UserRepository define los métodos necesarios para interactuar con la base de datos de registros de usuarios.
type UserUseCase ¶
type UserUseCase interface { GetByID(ctx context.Context, id uuid.UUID) (*User, error) GetByEmail(ctx context.Context, email string) (*User, error) Create(ctx context.Context, user *User) error Update(ctx context.Context, user *User) error Delete(ctx context.Context, id uuid.UUID) error }
UserUseCase define los métodos necesarios para interactuar con la lógica de negocio de registros de usuarios.
type WarehousePortRepository ¶
type WarehousePortRepository interface { FindMany(ctx context.Context, pagination *Pagination, filters map[string]interface{}) ([]*WarehousesAndPorts, error) FindByID(ctx context.Context, id uuid.UUID) (*WarehousesAndPorts, error) Store(ctx context.Context, wp *WarehousesAndPorts) (*WarehousesAndPorts, error) Update(ctx context.Context, wp *WarehousesAndPorts, id uuid.UUID) (*WarehousesAndPorts, error) Delete(ctx context.Context, id uuid.UUID) error }
type WarehousePortUsecase ¶
type WarehousePortUsecase interface { GetMany(pagination *Pagination, filters map[string]interface{}) ([]*WarehousesAndPorts, error) GetByID(id uuid.UUID) (*WarehousesAndPorts, error) Create(wp *WarehousesAndPorts) (*WarehousesAndPorts, error) Modify(wp *WarehousesAndPorts, id uuid.UUID) (*WarehousesAndPorts, error) Remove(id uuid.UUID) error }
type WarehousesAndPorts ¶
type WarehousesAndPorts struct { ID uuid.UUID `json:"id,omitempty"` Name string `json:"name" jsonschema:"required,description=Name of the warehouse or port,title=Name"` Type string `json:"type" jsonschema:"required,description=Type of the location (land or maritime),title=Type"` Location string `json:"location" jsonschema:"required,description=Location of the warehouse or port,title=Location"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.