mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-03 15:56:22 +00:00
⚡️ feat: Refactor API client to support server-side and client-side configurations
fix: Update post fetching logic to use dynamic ID instead of hardcoded value feat: Enhance layout with animated transitions using framer-motion refactor: Remove old post and user page implementations, introduce new structure feat: Implement sidebar components for blog home with dynamic content feat: Create blog post component with wave header and metadata display feat: Add responsive sidebar menu for navigation on mobile devices chore: Introduce reusable sheet component for modal-like functionality
This commit is contained in:
@ -65,10 +65,6 @@ func (p *PostService) DeletePost(ctx context.Context, id string) error {
|
||||
}
|
||||
|
||||
func (p *PostService) GetPost(ctx context.Context, id string) (*dto.PostDto, error) {
|
||||
currentUser, ok := ctxutils.GetCurrentUser(ctx)
|
||||
if !ok {
|
||||
return nil, errs.ErrUnauthorized
|
||||
}
|
||||
if id == "" {
|
||||
return nil, errs.ErrBadRequest
|
||||
}
|
||||
@ -76,7 +72,8 @@ func (p *PostService) GetPost(ctx context.Context, id string) (*dto.PostDto, err
|
||||
if err != nil {
|
||||
return nil, errs.New(errs.ErrNotFound.Code, "post not found", err)
|
||||
}
|
||||
if post.IsPrivate && post.UserID != currentUser.ID {
|
||||
currentUser, ok := ctxutils.GetCurrentUser(ctx)
|
||||
if post.IsPrivate && (!ok || post.UserID != currentUser.ID) {
|
||||
return nil, errs.ErrForbidden
|
||||
}
|
||||
return &dto.PostDto{
|
||||
|
Reference in New Issue
Block a user