storiesstore

package
v0.0.0-...-dcf5b65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	StoryID         string            `bson:"story_id"`
	AbstractContent string            `bson:"abstract_content,omitempty"`
	ContentJson     string            `bson:"content_json,omitempty"`
	CreatedBy       string            `bson:"created_by,omitempty"`
	Id              string            `bson:"_id"`
	TimeCreated     time.Time         `bson:"time_created,omitempty"`
	TimeUpdated     time.Time         `bson:"time_updated,omitempty"`
	Ownership       *authorizer.Scope `bson:"ownership,omitempty"`
}

func NewComment

func NewComment() *Comment

func (*Comment) Get

func (comment *Comment) Get(field string) interface{}

type CommentFilters

type CommentFilters struct {
	Ids       []string
	CreatedBy *string
	Story     *Story
}

type CommentSortBy

type CommentSortBy uint8
const (
	CommentSortByDefault CommentSortBy = iota
	CommentSortByTimeCreated
)

func GetCommentSortByFromString

func GetCommentSortByFromString(s string) CommentSortBy

func (CommentSortBy) CursorType

func (s CommentSortBy) CursorType() cursor.ValueType

func (CommentSortBy) String

func (s CommentSortBy) String() string

type CommentUpdate

type CommentUpdate struct {
	TimeUpdated *time.Time `bson:"time_updated,omitempty"`
}

type Reaction

type Reaction struct {
	StoryID     string            `bson:"story_id"`
	CreatedBy   string            `bson:"created_by,omitempty"`
	Id          string            `bson:"_id"`
	TimeCreated time.Time         `bson:"time_created,omitempty"`
	TimeUpdated time.Time         `bson:"time_updated,omitempty"`
	Ownership   *authorizer.Scope `bson:"ownership,omitempty"`
}

func NewReaction

func NewReaction() *Reaction

func (*Reaction) Get

func (reaction *Reaction) Get(field string) interface{}

type ReactionFilters

type ReactionFilters struct {
	Ids       []string
	CreatedBy *string
	Story     *Story
}

type ReactionSortBy

type ReactionSortBy uint8
const (
	ReactionSortByDefault ReactionSortBy = iota
	ReactionSortByTimeCreated
)

func GetReactionSortByFromString

func GetReactionSortByFromString(s string) ReactionSortBy

func (ReactionSortBy) CursorType

func (s ReactionSortBy) CursorType() cursor.ValueType

func (ReactionSortBy) String

func (s ReactionSortBy) String() string

type ReactionUpdate

type ReactionUpdate struct {
	TimeUpdated *time.Time `bson:"time_updated,omitempty"`
}

type Store

type Store interface {
	// story methods
	GetStoryByID(ctx context.Context, id string) (*Story, error)
	GetOneStory(ctx context.Context, filters *StoryFilters) (*Story, error)
	GetStories(ctx context.Context, filters *StoryFilters, after *string, before *string, first *int64, last *int64, sortBy StorySortBy, sortOrder *string) ([]*Story, bool, bool, []string, error)
	CountStories(ctx context.Context, filters *StoryFilters) (int64, error)
	CreateStory(ctx context.Context, story *Story, ownership *authorizer.Scope) (*Story, error)
	UpdateStory(ctx context.Context, id string, update *StoryUpdate) error
	DeleteStoryByID(ctx context.Context, id string) error
	// comment methods
	GetCommentByID(ctx context.Context, id string) (*Comment, error)
	GetOneComment(ctx context.Context, filters *CommentFilters) (*Comment, error)
	GetComments(ctx context.Context, filters *CommentFilters, after *string, before *string, first *int64, last *int64, sortBy CommentSortBy, sortOrder *string) ([]*Comment, bool, bool, []string, error)
	CountComments(ctx context.Context, filters *CommentFilters) (int64, error)
	CreateComment(ctx context.Context, comment *Comment, ownership *authorizer.Scope) (*Comment, error)
	UpdateComment(ctx context.Context, id string, update *CommentUpdate) error
	DeleteCommentByID(ctx context.Context, id string) error
	// reaction methods
	GetReactionByID(ctx context.Context, id string) (*Reaction, error)
	GetOneReaction(ctx context.Context, filters *ReactionFilters) (*Reaction, error)
	GetReactions(ctx context.Context, filters *ReactionFilters, after *string, before *string, first *int64, last *int64, sortBy ReactionSortBy, sortOrder *string) ([]*Reaction, bool, bool, []string, error)
	CountReactions(ctx context.Context, filters *ReactionFilters) (int64, error)
	CreateReaction(ctx context.Context, reaction *Reaction, ownership *authorizer.Scope) (*Reaction, error)
	UpdateReaction(ctx context.Context, id string, update *ReactionUpdate) error
	DeleteReactionByID(ctx context.Context, id string) error
}

type Story

type Story struct {
	UserID          string            `bson:"user_id"`
	AbstractContent string            `bson:"abstract_content,omitempty"`
	ContentJson     string            `bson:"content_json,omitempty"`
	CreatedBy       string            `bson:"created_by,omitempty"`
	Id              string            `bson:"_id"`
	Languages       []*string         `bson:"languages,omitempty"`
	Repos           []*string         `bson:"repos,omitempty"`
	Thumbnail       string            `bson:"thumbnail,omitempty"`
	TimeCreated     time.Time         `bson:"time_created,omitempty"`
	TimeUpdated     time.Time         `bson:"time_updated,omitempty"`
	Title           string            `bson:"title,omitempty"`
	Topics          []*string         `bson:"topics,omitempty"`
	UrlSuffix       string            `bson:"url_suffix,omitempty"`
	Ownership       *authorizer.Scope `bson:"ownership,omitempty"`
}

func NewStory

func NewStory() *Story

func (*Story) Get

func (story *Story) Get(field string) interface{}

type StoryFilters

type StoryFilters struct {
	Ids       []string
	CreatedBy *string
	User      *usersstore.User
}

type StorySortBy

type StorySortBy uint8
const (
	StorySortByDefault StorySortBy = iota
	StorySortByTimeCreated
)

func GetStorySortByFromString

func GetStorySortByFromString(s string) StorySortBy

func (StorySortBy) CursorType

func (s StorySortBy) CursorType() cursor.ValueType

func (StorySortBy) String

func (s StorySortBy) String() string

type StoryUpdate

type StoryUpdate struct {
	AbstractContent *string    `bson:"abstract_content,omitempty"`
	ContentJson     *string    `bson:"content_json,omitempty"`
	Languages       *[]*string `bson:"languages,omitempty"`
	Repos           *[]*string `bson:"repos,omitempty"`
	Thumbnail       *string    `bson:"thumbnail,omitempty"`
	TimeUpdated     *time.Time `bson:"time_updated,omitempty"`
	Title           *string    `bson:"title,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL