models

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeInvalidRequest    = "INVALID_REQUEST"
	ErrCodeNotFound          = "NOT_FOUND"
	ErrCodeInternalError     = "INTERNAL_ERROR"
	ErrCodeValidationFailed  = "VALIDATION_FAILED"
	ErrCodeDatabaseError     = "DATABASE_ERROR"
	ErrCodeInvalidDateFormat = "INVALID_DATE_FORMAT"
	ErrCodeInvalidData       = "INVALID_DATA"
)

Common error codes

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Status  string      `json:"status"`
	Code    string      `json:"code"`
	Message string      `json:"message"`
	Details interface{} `json:"details,omitempty"`
}

type PurificationRequest

type PurificationRequest struct {
	StartDate      string `json:"start_date" validate:"required,datetime=2006-01-02"`
	EndDate        string `json:"end_date" validate:"required,datetime=2006-01-02"`
	NumberOfStocks int    `json:"number_of_stocks" validate:"required,gt=0"`
	StockCode      string `json:"stock_code" validate:"required"`
}

PurificationRequest represents a request to calculate purification amount

type PurificationResponse

type PurificationResponse struct {
	ID                 primitive.ObjectID `json:"_id" bson:"_id,omitempty"`
	PurificationAmount float64            `json:"purification_amount"`
	DaysHeld           int                `json:"days_held"`
	PurificationRate   float64            `json:"purification_rate"`
}

PurificationResponse represents a response containing the purification amount

type Stock

type Stock struct {
	ID            primitive.ObjectID `json:"_id" bson:"_id,omitempty"`
	Name          string             `json:"name" bson:"name"`
	Code          string             `json:"code" bson:"code"`
	Sector        string             `json:"sector" bson:"sector"`
	ShariaOpinion string             `json:"sharia_opinion" bson:"sharia_opinion"`
	Purification  string             `json:"purification" bson:"purification"`
}

Stock represents a stock entity

type StockResponse

type StockResponse struct {
	Stocks []Stock `json:"stocks"`
}

StockResponse represents a response containing a list of stocks

Jump to

Keyboard shortcuts

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