Documentation ¶
Index ¶
- type AuthRepository
- type ChatMessageQuery
- type ChatRepository
- func (r *ChatRepository) CreateChat(initiatorID int64, subscriberID int64) (models.Chat, error)
- func (r *ChatRepository) CreateChatMessage(senderID int64, query ChatMessageQuery) (models.Message, error)
- func (r *ChatRepository) GetChatMessages(chatID int64, userID int64, offset int, limit int) ([]models.Message, int, error)
- func (r *ChatRepository) GetUserChatRooms(userID int64, offset int, limit int) ([]models.Chat, int, error)
- type LabelQuery
- type NewProductQuery
- type NotifRepository
- func (n *NotifRepository) CreateNotif(targetUser int64, title string, content string, notifType core.NotifType, ...) (models.UserNotif, error)
- func (n *NotifRepository) GetUserNotif(userID int64, offset int, limit int) ([]models.UserNotif, int, error)
- func (n *NotifRepository) MarkAsRead(ids []int64, userID int64) error
- type ProductFilter
- type ProductRepository
- func (s *ProductRepository) AddProductBidder(userID int64, productID int64, bidPrice float64) (interface{}, error)
- func (s *ProductRepository) CleanUpProduct()
- func (s *ProductRepository) CloseProduct(productID int64) error
- func (s *ProductRepository) CreateProduct(query NewProductQuery) (models.Product, error)
- func (s *ProductRepository) DeleteProduct(productID int64, storeID int64) error
- func (s *ProductRepository) GetBidProductList(userID int64, offset int, limit int) ([]models.Product, int, error)
- func (s *ProductRepository) GetBidderProduct(productID int64, offset int, limit int) (*[]models.ProductBidder, int, error)
- func (s *ProductRepository) GetByID(productID int64) (models.Product, error)
- func (s *ProductRepository) GetMyProductList(args ProductFilter) ([]models.Product, int, error)
- func (s *ProductRepository) GetProductList(args ProductFilter) ([]models.Product, int, error)
- func (s *ProductRepository) ReOpenBid(productID int64, closedAt string) (models.Product, error)
- func (s *ProductRepository) SetProductSold(productID int64) (models.Product, error)
- func (s *ProductRepository) UpdateProduct(productID int64, query UpdateProductQuery) (models.Product, error)
- type StoreRepository
- type UpdateProductQuery
- type UpdateUserQuery
- type UserRepository
- func (s *UserRepository) ActivateUser(token string, passhash string) (*models.User, error)
- func (s *UserRepository) CreateUserConnect(userID int64, appID string, providerName string) error
- func (s *UserRepository) GetAppID(userID int64) (models.UserConnect, error)
- func (s *UserRepository) GetByID(userID int64) (models.User, error)
- func (s *UserRepository) RegisterUser(f string, e string, p string, t string) (models.RegisterUser, error)
- func (s *UserRepository) RemoveUserConnect(userID int64) error
- func (s *UserRepository) UpdateUser(userID int64, query UpdateUserQuery) (*models.User, error)
- func (s *UserRepository) UserSimple(userID int64) *models.UserSimple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthRepository ¶
AuthRepository init repo
func (*AuthRepository) AuthorizeUser ¶
func (s *AuthRepository) AuthorizeUser(email string, passhash string) (interface{}, error)
AuthorizeUser method untuk mengotorisasi user
func (*AuthRepository) GetAccessToken ¶
func (s *AuthRepository) GetAccessToken(token string) (*models.AccessToken, error)
GetAccessToken dao
func (*AuthRepository) UnauthorizeUser ¶
func (s *AuthRepository) UnauthorizeUser(userID int64) error
UnauthorizeUser method untuk menghapus otorisasi user
type ChatMessageQuery ¶
type ChatMessageQuery struct { ChatID int64 `json:"chat_id" binding:"required"` ReceiverID int64 `json:"receiver_id" binding:"required"` Text string `json:"text" binding:"required"` AttachmentKind int `json:"attachment_kind"` AttachmentData string `json:"attachment_data"` }
ChatMessageQuery --
type ChatRepository ¶
type ChatRepository struct {
// contains filtered or unexported fields
}
ChatRepository init
func (*ChatRepository) CreateChat ¶
CreateChat create new chat room
func (*ChatRepository) CreateChatMessage ¶
func (r *ChatRepository) CreateChatMessage(senderID int64, query ChatMessageQuery) (models.Message, error)
CreateChatMessage create new chat message
func (*ChatRepository) GetChatMessages ¶
func (r *ChatRepository) GetChatMessages(chatID int64, userID int64, offset int, limit int) ([]models.Message, int, error)
GetChatMessages list chat message
func (*ChatRepository) GetUserChatRooms ¶
func (r *ChatRepository) GetUserChatRooms(userID int64, offset int, limit int) ([]models.Chat, int, error)
GetUserChatRooms listing user chats
type LabelQuery ¶
type LabelQuery struct { Name string `json:"name" binding:"required"` Value string `json:"value" binding:"required"` }
LabelQuery definisi query untuk product label
type NewProductQuery ¶
type NewProductQuery struct { StoreID int64 `json:"store_id" binding:"required"` ProductName string `json:"product_name" binding:"required"` ProductImages []string `json:"product_images" binding:"required"` Desc string `json:"desc" binding:"required"` Condition int32 `json:"condition" binding:"required"` ConditionAvg float64 `json:"condition_avg" binding:"required"` StartPrice float64 `json:"start_price" binding:"required"` BidMultpl float64 `json:"bid_multpl" binding:"required"` ClosedAT string `json:"closed_at" binding:"required"` Labels []LabelQuery `json:"labels" binding:"required"` }
NewProductQuery definisi query untuk menambahkan product
type NotifRepository ¶
type NotifRepository struct {
NotifQs models.UserNotifQuerySet
}
NotifRepository init repo
func NewNotifRepository ¶
func NewNotifRepository() *NotifRepository
NewNotifRepository create instance
func (*NotifRepository) CreateNotif ¶
func (n *NotifRepository) CreateNotif(targetUser int64, title string, content string, notifType core.NotifType, targetID int64) (models.UserNotif, error)
CreateNotif create user notification
func (*NotifRepository) GetUserNotif ¶
func (n *NotifRepository) GetUserNotif(userID int64, offset int, limit int) ([]models.UserNotif, int, error)
GetUserNotif list user notification
func (*NotifRepository) MarkAsRead ¶
func (n *NotifRepository) MarkAsRead(ids []int64, userID int64) error
MarkAsRead mark as read notif
type ProductFilter ¶
type ProductFilter struct { UserID int64 Sold bool Closed bool Query interface{} Offset int Limit int }
ProductFilter definisi type untuk filter product
type ProductRepository ¶
type ProductRepository struct {
// contains filtered or unexported fields
}
ProductRepository init repo
func NewProductRepository ¶
func NewProductRepository() *ProductRepository
NewProductRepository create instance for product repository
func (*ProductRepository) AddProductBidder ¶
func (s *ProductRepository) AddProductBidder(userID int64, productID int64, bidPrice float64) (interface{}, error)
AddProductBidder digunakan untuk menyimpan user bid product
func (*ProductRepository) CleanUpProduct ¶
func (s *ProductRepository) CleanUpProduct()
CleanUpProduct dao clean all products after testing NOTE: using this for testing only
func (*ProductRepository) CloseProduct ¶
func (s *ProductRepository) CloseProduct(productID int64) error
CloseProduct digunakan untuk menutup lelang produk
func (*ProductRepository) CreateProduct ¶
func (s *ProductRepository) CreateProduct(query NewProductQuery) (models.Product, error)
CreateProduct method untuk menambahkan product
func (*ProductRepository) DeleteProduct ¶
func (s *ProductRepository) DeleteProduct(productID int64, storeID int64) error
DeleteProduct digunakan untuk menghapus product
func (*ProductRepository) GetBidProductList ¶
func (s *ProductRepository) GetBidProductList(userID int64, offset int, limit int) ([]models.Product, int, error)
GetBidProductList method untuk mendapatkan history bid dari user
func (*ProductRepository) GetBidderProduct ¶
func (s *ProductRepository) GetBidderProduct(productID int64, offset int, limit int) (*[]models.ProductBidder, int, error)
GetBidderProduct method untuk mendapatkan bidder berdasarkan product id-nya
func (*ProductRepository) GetByID ¶
func (s *ProductRepository) GetByID(productID int64) (models.Product, error)
GetByID method untuk mendapatkan product berdasarkan id-nya
func (*ProductRepository) GetMyProductList ¶
func (s *ProductRepository) GetMyProductList(args ProductFilter) ([]models.Product, int, error)
GetMyProductList method untuk mendapatkan semua product
func (*ProductRepository) GetProductList ¶
func (s *ProductRepository) GetProductList(args ProductFilter) ([]models.Product, int, error)
GetProductList method untuk mendapatkan semua product
func (*ProductRepository) SetProductSold ¶
func (s *ProductRepository) SetProductSold(productID int64) (models.Product, error)
SetProductSold digunakan untuk menandai produk sudah terjual
func (*ProductRepository) UpdateProduct ¶
func (s *ProductRepository) UpdateProduct(productID int64, query UpdateProductQuery) (models.Product, error)
UpdateProduct method untuk mengupdate product
type StoreRepository ¶
type StoreRepository struct {
// contains filtered or unexported fields
}
StoreRepository init implementation
func (*StoreRepository) CreateStore ¶
func (s *StoreRepository) CreateStore(ownerID int64, name string, info string, province string, regency string, subDistrict string, village string, address string) (models.Store, error)
CreateStore dao for creating store after user upgraded
func (*StoreRepository) GetByID ¶
func (s *StoreRepository) GetByID(storeID int64) (models.Store, error)
GetByID get store by id
func (*StoreRepository) GetStoreByOwnerID ¶
func (s *StoreRepository) GetStoreByOwnerID(ownerID int64) (models.Store, error)
GetStoreByOwnerID get store by id
type UpdateProductQuery ¶
type UpdateProductQuery struct { ID int64 `json:"id" binding:"required"` ProductName string `json:"product_name" binding:"required"` ProductImages []string `json:"product_images" binding:"required"` Desc string `json:"desc" binding:"required"` Condition int32 `json:"condition" binding:"required"` ConditionAvg float64 `json:"condition_avg" binding:"required"` StartPrice float64 `json:"start_price" binding:"required"` BidMultpl float64 `json:"bid_multpl" binding:"required"` ClosedAT string `json:"closed_at" binding:"required"` Labels []LabelQuery `json:"labels" binding:"required"` }
UpdateProductQuery definisi query untuk menambahkan product
type UpdateUserQuery ¶
type UpdateUserQuery struct { FullName string `json:"full_name" binding:"required"` Email string `json:"email" binding:"required"` PhoneNum string `json:"phone_num" binding:"required"` Address string `json:"address"` Avatar string `json:"avatar"` }
UpdateUserQuery definisi query untuk update user
type UserRepository ¶
UserRepository init implementation
func (*UserRepository) ActivateUser ¶
ActivateUser dao
func (*UserRepository) CreateUserConnect ¶
func (s *UserRepository) CreateUserConnect(userID int64, appID string, providerName string) error
CreateUserConnect app id untuk spesifik user, digunakan untuk event push notif.
func (*UserRepository) GetAppID ¶
func (s *UserRepository) GetAppID(userID int64) (models.UserConnect, error)
GetAppID berdasarkan user id
func (*UserRepository) GetByID ¶
func (s *UserRepository) GetByID(userID int64) (models.User, error)
GetByID get user by id
func (*UserRepository) RegisterUser ¶
func (s *UserRepository) RegisterUser(f string, e string, p string, t string) (models.RegisterUser, error)
RegisterUser dao
func (*UserRepository) RemoveUserConnect ¶
func (s *UserRepository) RemoveUserConnect(userID int64) error
RemoveUserConnect app id berdasarkan user id
func (*UserRepository) UpdateUser ¶
func (s *UserRepository) UpdateUser(userID int64, query UpdateUserQuery) (*models.User, error)
UpdateUser dao
func (*UserRepository) UserSimple ¶
func (s *UserRepository) UserSimple(userID int64) *models.UserSimple
UserSimple digunakan untuk medapatkan simple user