Documentation
¶
Index ¶
- func CreateNotification(notification Notification) error
- func CreateUser(user User) error
- func DeleteComment(commentID primitive.ObjectID) error
- func DeletePost(postID primitive.ObjectID) error
- func GetUnreadNotifications(userID primitive.ObjectID) (int64, error)
- func UpdateNotification(notificationID primitive.ObjectID, read bool) error
- type Comment
- type CommentResponse
- type CommentResponseAuthor
- type CommentResponseContent
- type Notification
- type Post
- type PostResponse
- type PostResponseAuthor
- type PostResponseContent
- type User
- func GetUserByEmail(email string) (user User, err error)
- func GetUserByID(id primitive.ObjectID) (user User, err error)
- func GetUserByUsername(username string) (user User, err error)
- func GetUsers(limit, offset int64, filter bson.M, sort bson.M) ([]User, error)
- func UpdateUser(userID primitive.ObjectID, update bson.M) (User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNotification ¶
func CreateNotification(notification Notification) error
func CreateUser ¶
func DeleteComment ¶
func DeletePost ¶
Types ¶
type Comment ¶
type Comment struct {
ID primitive.ObjectID `bson:"_id" json:"id"`
CreatedAt primitive.Timestamp `bson:"created_at" json:"created_at"`
UpdatedAt primitive.Timestamp `bson:"updated_at" json:"updated_at"`
Post primitive.ObjectID `bson:"post" json:"post"`
Author primitive.ObjectID `bson:"author" json:"author"`
Content string `bson:"content" json:"content"`
Likes []primitive.ObjectID `bson:"likes" json:"likes"`
}
func CreateComment ¶
func GetCommentsByPostID ¶
type CommentResponse ¶
type CommentResponse struct {
Message string `json:"message"`
Comment CommentResponseContent `json:"comment"`
}
type CommentResponseAuthor ¶
type CommentResponseContent ¶
type CommentResponseContent struct {
ID primitive.ObjectID `json:"id"`
CreatedAt primitive.Timestamp `json:"created_at"`
UpdatedAt primitive.Timestamp `json:"updated_at"`
Post primitive.ObjectID `json:"post"`
Author CommentResponseAuthor `json:"author"`
Content string `json:"content"`
Likes []primitive.ObjectID `json:"likes"`
}
type Notification ¶
type Notification struct {
ID primitive.ObjectID `bson:"_id" json:"id"`
CreatedAt primitive.Timestamp `bson:"created_at" json:"created_at"`
TargetUserID primitive.ObjectID `bson:"target_user_id" json:"target_user_id"`
SourceUserID primitive.ObjectID `bson:"source_user_id" json:"source_user_id"`
Type string `bson:"type" json:"type"`
TypeContent string `bson:"type_content" json:"type_content"`
Read bool `bson:"read" json:"read"`
}
func GetNotificationByID ¶
func GetNotificationByID(notificationID primitive.ObjectID) (notification Notification, err error)
func GetNotifications ¶
func GetNotifications(limit, offset int64, userID primitive.ObjectID) ([]Notification, error)
type Post ¶
type Post struct {
ID primitive.ObjectID `bson:"_id" json:"id"`
CreatedAt primitive.Timestamp `bson:"created_at" json:"created_at"`
UpdatedAt primitive.Timestamp `bson:"updated_at" json:"updated_at"`
Author primitive.ObjectID `bson:"author" json:"author"`
Content string `bson:"content" json:"content"`
Likes []primitive.ObjectID `bson:"likes" json:"likes"`
Comments uint `bson:"comments" json:"comments"`
}
func CreatePost ¶
type PostResponse ¶
type PostResponse struct {
Message string `json:"message"`
Post PostResponseContent `json:"post"`
}
type PostResponseAuthor ¶
type PostResponseContent ¶
type PostResponseContent struct {
ID primitive.ObjectID `json:"id"`
CreatedAt primitive.Timestamp `json:"created_at"`
UpdatedAt primitive.Timestamp `json:"updated_at"`
Author PostResponseAuthor `json:"author"`
Content string `json:"content"`
Likes []primitive.ObjectID `json:"likes"`
Comments uint `json:"comments"`
}
type User ¶
type User struct {
ID primitive.ObjectID `bson:"_id" json:"id"`
CreatedAt primitive.Timestamp `bson:"created_at" json:"created_at"`
IsBanned bool `bson:"is_banned" json:"is_banned,omitempty"`
Role string `bson:"role" json:"role,omitempty"`
Email string `bson:"email" json:"email,omitempty"`
DisplayName string `bson:"display_name" json:"display_name"`
Username string `bson:"username" json:"username"`
Password string `bson:"password" json:"password,omitempty"`
About string `bson:"about" json:"about"`
Points uint `bson:"points" json:"points"`
Followers []primitive.ObjectID `bson:"followers" json:"followers"`
Following []primitive.ObjectID `bson:"following" json:"following"`
}
func GetUserByEmail ¶
func GetUserByUsername ¶
Click to show internal directories.
Click to hide internal directories.