Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Post ¶
type Post struct {
ID primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
UserID primitive.ObjectID `json:"user_id,omitempty" bson:"user_id,omitempty"`
User *user.User `json:"user,omitempty" bson:"user,omitempty"`
Description string `json:"description,omitempty" bson:"description,omitempty"`
Badge string `json:"badge,omitempty" bson:"badge,omitempty"`
Pictures []string `json:"pictures,omitempty" bson:"pictures,omitempty"`
Likes []string `json:"likes,omitempty" bson:"likes,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty" bson:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}
Post is the post model
type Repository ¶
type Repository interface {
GetAll(ctx context.Context) ([]Post, error)
GetAllForUser(ctx context.Context, userID primitive.ObjectID) ([]Post, error)
Create(ctx context.Context, p *Post) error
GetByID(ctx context.Context, id primitive.ObjectID) (Post, error)
Update(ctx context.Context, id primitive.ObjectID, p *Post) error
Delete(ctx context.Context, id primitive.ObjectID) error
AddLike(ctx context.Context, fanID, postID primitive.ObjectID) error
DeleteLike(ctx context.Context, fanID, postID primitive.ObjectID) error
}
Repository the post repository
type Service ¶
type Service interface {
Create(ctx context.Context, p *Post) error
GetByID(ctx context.Context, id string) (Post, error)
GetAll(ctx context.Context) ([]Post, error)
GetAllForUser(ctx context.Context, userID string) ([]Post, error)
Update(ctx context.Context, toUpdateid string, currendUserID string, role user.Role, p *Post) (Post, error)
Delete(ctx context.Context, toDeleteID string, currendUserID string, role user.Role) error
AddLike(ctx context.Context, fanID, postID string) (Post, error)
DeleteLike(ctx context.Context, fanID, postID string) (Post, error)
WithPagination(p []Post, page int, limit int) ([]Post, int)
}
Service the post service
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mock_post is a generated GoMock package.
|
Package mock_post is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.