<commit_before>package service

import (
	"context"
	"errors"
	"fmt"
	"log"
	"strings"
	"time"
)

var (
	// ErrInvalidContent denotes empty or too long content.
	ErrInvalidContent = errors.New("invalid content")
	// ErrInvalidSpoiler denotes empty or too long spoiler title.
	ErrInvalidSpoiler = errors.New("invalid spoiler")
	// ErrPostNotFound denotes a post that was not found.
	ErrPostNotFound = errors.New("post not found")
)

// Post model.
type Post struct {
	ID        int64     `json:"id"`
	UserID    int64     `json:"-"`
	Content   string    `json:"content"`
	SpoilerOf *string   `json:"spoilerOf"`
	NSFW      bool      `json:"nsfw"`
	CreatedAt time.Time `json:"createdAt"`
	User      *User     `json:"user,omitempty"`
	Mine      bool      `json:"mine"`
}

// ToggleLikeOutput response.
type ToggleLikeOutput struct {
	Liked      bool `json:"liked"`
	LikesCount int  `json:"likesCount"`
}

// CreatePost publishes a post the the user timeline and fan-outs it to his followers.
func (s *Service) CreatePost(
	ctx context.Context,
	content string,<commit_msg>fix: better post not found comment<commit_after>package service

import (
	"context"
	"errors"
	"fmt"
	"log"
	"strings"
	"time"
)

var (
	// ErrInvalidContent denotes empty or too long content.
	ErrInvalidContent = errors.New("invalid content")
	// ErrInvalidSpoiler denotes empty or too long spoiler title.
	ErrInvalidSpoiler = errors.New("invalid spoiler")
	// ErrPostNotFound denotes that the post was not found.
	ErrPostNotFound = errors.New("post not found")
)

// Post model.
type Post struct {
	ID        int64     `json:"id"`
	UserID    int64     `json:"-"`
	Content   string    `json:"content"`
	SpoilerOf *string   `json:"spoilerOf"`
	NSFW      bool      `json:"nsfw"`
	CreatedAt time.Time `json:"createdAt"`
	User      *User     `json:"user,omitempty"`
	Mine      bool      `json:"mine"`
}

// ToggleLikeOutput response.
type ToggleLikeOutput struct {
	Liked      bool `json:"liked"`
	LikesCount int  `json:"likesCount"`
}

// CreatePost publishes a post the the user timeline and fan-outs it to his followers.
func (s *Service) CreatePost(
	ctx context.Context,
	content string,
{'fraction_non_alphanumeric': 0.11358368103847936, 'fraction_numerical': 0.0037088548910523874, 'mean_word_length': 3.533613445378151, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2325742', 'n_tokens_mistral': 709, 'n_tokens_neox': 696, 'n_words': 214}