Documentation ¶
Index ¶
- Constants
- func GetHash(salt, password string) string
- func GetSalt() string
- type AuctionRepository
- type AuthRepository
- type Chat
- type ChatRepository
- type FeedRepository
- type Message
- type OrderRepository
- type Password
- type Payment
- type PostRepository
- type TagSchema
- type TagsRepository
- type UserRepository
- type UserSchema
Constants ¶
View Source
const ( Database = "cancanvas" CollectionUsers = "users" CollectionChats = "chats" CollectionPosts = "posts" CollectionAuctions = "auctions" CollectionTags = "tags" CollectionPayments = "payments" )
Database and Collection names
View Source
const PageSize = 10
PageSize constant
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuctionRepository ¶
type AuctionRepository interface { GetAuctions(page *int) ([]*model.FeedAuction, error) CreateAuction(sender, description string, offer float64) (*model.Auction, error) DeleteAuction(sender, auctionID string) (bool, error) CreateBid(sender, auctionID, deadline string, price float64) (*model.Bid, error) DeleteBid(sender, auctionID, bidID string) (bool, error) AcceptBid(sender, auctionID, bidID string) (bool, error) AcceptedBids(sender string) ([]*model.FeedAuction, error) BidPaymentLink(sender, auctionID, bidID string) (string, error) }
AuctionRepository interface
func NewAuctionRepository ¶
func NewAuctionRepository() AuctionRepository
NewAuctionRepository function
type AuthRepository ¶
type AuthRepository interface { Login(username, password string) (*model.Login, error) ResetPassword(sender, hash, newPassword string) (bool, error) SendForgotPasswordEmail(user string) (bool, error) }
AuthRepository interface
type Chat ¶
type Chat struct { ID string `json:"_id,omitempty" bson:"_id,omitempty"` Users []string `json:"users"` Messages []Message `json:"messages"` }
Chat struct
type ChatRepository ¶
type ChatRepository interface { SendMessage(sender, msg, receiver string) (bool, error) SendMessageToDialogflow(sender, msg string) (string, error) NewChatMessage(sender string) (<-chan *model.Message, error) // contains filtered or unexported methods }
ChatRepository interface
type FeedRepository ¶
type FeedRepository interface { GetFeed(nickname string, page *int) ([]*model.FeedPost, error) GetTrending(nickname string, page *int) ([]*model.FeedPost, error) }
FeedRepository interface
type Message ¶
type Message struct { Message string `json:"message"` Timestamp string `json:"timestamp"` Sender string `json:"sender"` }
Message struct
type OrderRepository ¶
type OrderRepository interface { CreateOrder(auctionID, bidID, description string, price float64) (string, error) GetOrder(sender, orderID string) (*model.Order, error) GetOrders(sender string) ([]*model.Order, error) UpdateOrder(orderID, status string, payerID *string) (bool, error) DeleteOrder(orderID string) (bool, error) }
OrderRepository interface
type Payment ¶
type Payment struct { ID string `bson:"_id,omitempty"` PaymentID string `bson:"paymentID"` PaymentURL string `bson:"paymentURL"` PayerID *string `bson:"payerID"` AuctionID string `bson:"auctionID"` BidID string `bson:"bidID"` Status string `bson:"status"` }
Payment struct
type PostRepository ¶
type PostRepository interface { GetPosts(sender, author string, page *int) ([]*model.Post, error) GetComments(sender, postID string, page *int) ([]*model.PostComment, error) CreatePost(author string, content graphql.Upload, description, bidID *string) (string, error) EditPost(author, postID, description string) (bool, error) DeletePost(author, postID string) (bool, error) LikePost(sender, postID string) (bool, error) CommentOnPost(sender, postID, message string) (string, error) EditComment(sender, postID, commentID, message string) (bool, error) DeleteComment(sender, postID, commentID string) (bool, error) LikeComment(sender, postID, commentID string) (bool, error) }
PostRepository interface
type TagsRepository ¶
type TagsRepository interface { GetTags() ([]string, error) GetUserTags(nickname string) ([]string, error) GetUsersPerTags(tags []string, page *int) ([]*model.User, error) UpdateUserTags(user string, tags []string) (bool, error) AddTagToUser(user, tag string) (bool, error) RemoveTagFromUser(user, tag string) (bool, error) }
TagsRepository interface
type UserRepository ¶
type UserRepository interface { CreateUser(user *model.NewUser) (*model.User, error) FindOne(nickname string) (*model.User, error) FindAll(nickname *string, page *int) ([]*model.User, error) Follow(sender, target string) (bool, error) Unfollow(sender, target string) (bool, error) IsFollowing(sender, target string) bool UpdateProfilePicture(sender string, picture graphql.Upload) (string, error) UpdateCover(sender string, cover graphql.Upload) (string, error) UpdateLocation(sender string, lat, lng float64) (bool, error) UpdateBio(sender, bio string) (bool, error) }
UserRepository Interface
type UserSchema ¶
type UserSchema struct { Nickname string `json:"nickname" bson:"_id"` Name string `json:"name"` Email string `json:"email"` Picture string `json:"picture"` Cover string `json:"cover"` Bio string `json:"bio"` Followers []string `json:"followers"` FollowersCount int `json:"followerscount"` Following []string `json:"following"` Password Password `json:"password"` Chats []userChat `json:"chats"` First bool `json:"first"` Lat float64 `json:"lat"` Lng float64 `json:"lng"` }
UserSchema struct
Click to show internal directories.
Click to hide internal directories.