Documentation ¶
Index ¶
- func AdminValidateLogin(ctx context.Context, h *Handler, username string, password string) (*models.Admin, error)
- func CheckAdminEmailExist(ctx context.Context, h *Handler, admin models.Admin) (bool, error)
- func CheckAdminExist(ctx context.Context, h *Handler, admin models.Admin) (bool, error)
- func CheckEmailExist(ctx context.Context, h *Handler, user models.User) (bool, error)
- func CheckUserExist(ctx context.Context, h *Handler, user models.User) (bool, error)
- func CloseMongo(db *mongo.Database, cancel context.CancelFunc) error
- func ConnectMongo(uri, dbName string, timeout time.Duration) (*mongo.Database, context.CancelFunc, error)
- func CreateAdmin(ctx context.Context, h *Handler, admin models.Admin) error
- func CreateUser(ctx context.Context, h *Handler, user models.User) error
- func GetAdminByEmail(ctx context.Context, h *Handler, email string) (*models.Admin, error)
- func GetAdminByUserID(ctx context.Context, h *Handler, userID primitive.ObjectID) (*models.Admin, error)
- func GetAdminByUsername(ctx context.Context, h *Handler, username string) (*models.Admin, error)
- func ValidateLogin(ctx context.Context, h *Handler, username string, password string) (*models.User, error)
- type Handler
- func (h *Handler) AddBankAccount(ctx context.Context, sellerID string, bankAccount models.BankAccount) (*mongo.UpdateResult, error)
- func (h *Handler) ChangeStatus(ctx context.Context, sellerID string, status string) (*mongo.UpdateResult, error)
- func (h *Handler) CheckPetStatus(ctx context.Context, petID primitive.ObjectID) (bool, error)
- func (h *Handler) CreateComment(ctx context.Context, reviewID string, comment models.Comments) (*models.Review, error)
- func (h *Handler) CreateOTP(ctx context.Context, otp, email string) error
- func (h *Handler) CreateOnePet(ctx context.Context, userID primitive.ObjectID, pet *models.Pet) error
- func (h *Handler) CreatePartyReport(ctx context.Context, report *models.PartyReport) (*mongo.InsertOneResult, error)
- func (h *Handler) CreateReview(ctx context.Context, review *models.Review) (*mongo.InsertOneResult, error)
- func (h *Handler) CreateSystemReport(ctx context.Context, report *models.SystemReport) (*mongo.InsertOneResult, error)
- func (h *Handler) CreateTransaction(ctx context.Context, transaction *models.Transaction) (*mongo.InsertOneResult, error)
- func (h *Handler) DeleteBankAccount(sellerID string) (*mongo.UpdateResult, error)
- func (h *Handler) DeleteOTP(ctx context.Context, email string) error
- func (h *Handler) DeleteOnePet(ctx context.Context, petID string) (*mongo.DeleteResult, error)
- func (h *Handler) DeleteOneUser(ctx context.Context, userID string, storage *storage.Handler) (*mongo.DeleteResult, error)
- func (h *Handler) DeleteReview(ctx context.Context, reviewID, role string, userID primitive.ObjectID) (*bson.M, error)
- func (h *Handler) GetAllMasterData(ctx context.Context) (*[]models.MasterData, error)
- func (h *Handler) GetAllSellers(ctx context.Context, status string) (*[]models.Seller, error)
- func (h *Handler) GetBankAccount(sellerID string) (*models.BankAccount, error)
- func (h *Handler) GetCategories(ctx context.Context) (*models.MasterDataCategory, error)
- func (h *Handler) GetFilteredPetCards(ctx context.Context, categories, species, sex, behaviors []string, ...) (*[]models.PetCard, error)
- func (h *Handler) GetMasterDataByCategory(ctx context.Context, category string) (*models.MasterData, error)
- func (h *Handler) GetOTPbyEmail(ctx context.Context, email string) (*models.OTP, error)
- func (h *Handler) GetPetByPetID(ctx context.Context, petID string) (*models.Pet, error)
- func (h *Handler) GetPetBySeller(ctx context.Context, userID string) (*[]models.Pet, error)
- func (h *Handler) GetReport(ctx context.Context, category string, is_solved *bool) (*[]models.PartyReport, *[]models.SystemReport, error)
- func (h *Handler) GetReviewByReviewID(ctx context.Context, reviewID string) (*models.Review, error)
- func (h *Handler) GetReviewByUserID(ctx context.Context, UserID string) (*[]models.Review, error)
- func (h *Handler) GetSellerBySellerID(ctx context.Context, sellerID string) (*models.Seller, error)
- func (h *Handler) GetTransactionByID(ctx context.Context, userID primitive.ObjectID, role string) ([]*models.TransactionWithDetails, error)
- func (h *Handler) GetTransactionByTransactionID(ctx context.Context, transactionID string) (*models.Transaction, error)
- func (h *Handler) GetUserByMail(ctx context.Context, data bson.M) (*models.User, error)
- func (h *Handler) GetUserByUserID(ctx context.Context, userID string) (*models.User, error)
- func (h *Handler) UpdateBuyer(ctx context.Context, buyerID string, data bson.M) (*mongo.UpdateResult, error)
- func (h *Handler) UpdateOnePet(ctx context.Context, petID string, data bson.M) (*mongo.SingleResult, error)
- func (h *Handler) UpdateOneUser(ctx context.Context, userID string, data bson.M) (*mongo.SingleResult, error)
- func (h *Handler) UpdatePetStatus(ctx context.Context, petID primitive.ObjectID, status bool) (*mongo.SingleResult, error)
- func (h *Handler) UpdateSeller(ctx context.Context, sellerID string, data bson.M) (*mongo.UpdateResult, error)
- func (h *Handler) UpdateTransaction(ctx context.Context, transactionID primitive.ObjectID, update bson.D) (*mongo.SingleResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdminValidateLogin ¶
func CheckAdminEmailExist ¶
CheckEmailExist is a function to check if the email already exists
func CheckAdminExist ¶
CheckAdminExist is a function to check if the Admin already exists
func CheckEmailExist ¶
CheckEmailExist is a function to check if the email already exists
func CheckUserExist ¶
CheckUserExist is a function to check if the user already exists
func CloseMongo ¶
func CloseMongo(db *mongo.Database, cancel context.CancelFunc) error
func ConnectMongo ¶
func CreateAdmin ¶
CreateAdmin is a function to create a new Admin
func CreateUser ¶
CreateUser is a function to create a new user
func GetAdminByEmail ¶
GetAdminByEmail is a function to get an Admin by email
func GetAdminByUserID ¶
func GetAdminByUserID(ctx context.Context, h *Handler, userID primitive.ObjectID) (*models.Admin, error)
GetAdminByUserID is a function to get an Admin by userID
func GetAdminByUsername ¶
GetAdminByUsername is a function to get an Admin by username
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) AddBankAccount ¶
func (h *Handler) AddBankAccount(ctx context.Context, sellerID string, bankAccount models.BankAccount) (*mongo.UpdateResult, error)
func (*Handler) ChangeStatus ¶
func (*Handler) CheckPetStatus ¶
Check pet status
func (*Handler) CreateComment ¶
func (*Handler) CreateOnePet ¶
func (h *Handler) CreateOnePet(ctx context.Context, userID primitive.ObjectID, pet *models.Pet) error
CreateOnePet creates a new pet
func (*Handler) CreatePartyReport ¶
func (h *Handler) CreatePartyReport(ctx context.Context, report *models.PartyReport) (*mongo.InsertOneResult, error)
func (*Handler) CreateReview ¶
func (*Handler) CreateSystemReport ¶
func (h *Handler) CreateSystemReport(ctx context.Context, report *models.SystemReport) (*mongo.InsertOneResult, error)
func (*Handler) CreateTransaction ¶
func (h *Handler) CreateTransaction(ctx context.Context, transaction *models.Transaction) (*mongo.InsertOneResult, error)
func (*Handler) DeleteBankAccount ¶
func (h *Handler) DeleteBankAccount(sellerID string) (*mongo.UpdateResult, error)
func (*Handler) DeleteOnePet ¶
DeleteOnePet deletes a pet
func (*Handler) DeleteOneUser ¶
func (h *Handler) DeleteOneUser(ctx context.Context, userID string, storage *storage.Handler) (*mongo.DeleteResult, error)
DeleteOneUser deletes a user
func (*Handler) DeleteReview ¶
func (*Handler) GetAllMasterData ¶
GetAllMasterData returns all master data
func (*Handler) GetAllSellers ¶
func (*Handler) GetBankAccount ¶
func (h *Handler) GetBankAccount(sellerID string) (*models.BankAccount, error)
func (*Handler) GetCategories ¶
GetCategories returns list of categories
func (*Handler) GetFilteredPetCards ¶
func (h *Handler) GetFilteredPetCards(ctx context.Context, categories, species, sex, behaviors []string, minAge, maxAge, minWeight, maxWeight, minPrice, maxPrice int) (*[]models.PetCard, error)
Get filtered petCard
func (*Handler) GetMasterDataByCategory ¶
func (h *Handler) GetMasterDataByCategory(ctx context.Context, category string) (*models.MasterData, error)
GetMasterDataByCategory returns master data by Category
func (*Handler) GetOTPbyEmail ¶
func (*Handler) GetPetByPetID ¶
GetPetByPetID returns a pet by petID
func (*Handler) GetPetBySeller ¶
GetPetBySeller returns pets that belong to a seller
func (*Handler) GetReport ¶
func (h *Handler) GetReport(ctx context.Context, category string, is_solved *bool) (*[]models.PartyReport, *[]models.SystemReport, error)
func (*Handler) GetReviewByReviewID ¶
func (*Handler) GetReviewByUserID ¶
func (*Handler) GetSellerBySellerID ¶
func (*Handler) GetTransactionByID ¶
func (*Handler) GetTransactionByTransactionID ¶
func (*Handler) GetUserByMail ¶
func (*Handler) GetUserByUserID ¶
GetUserByUserID returns a user by userID
func (*Handler) UpdateBuyer ¶
func (*Handler) UpdateOnePet ¶
func (h *Handler) UpdateOnePet(ctx context.Context, petID string, data bson.M) (*mongo.SingleResult, error)
UpdateOnePet updates a pet
func (*Handler) UpdateOneUser ¶
func (h *Handler) UpdateOneUser(ctx context.Context, userID string, data bson.M) (*mongo.SingleResult, error)
UpdateOneUser updates a user
func (*Handler) UpdatePetStatus ¶
func (h *Handler) UpdatePetStatus(ctx context.Context, petID primitive.ObjectID, status bool) (*mongo.SingleResult, error)
Update pet status