flags

package
v0.0.0-...-8ef0ebb Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PENDING  status = "pending"
	REJECTED status = "rejected"
)

Variables

View Source
var FlagNotFound = errors.New("Flag has not been found by given criteria.")

Functions

func Count

func Count(d deps, q bson.M) int

func TodaysCountByUser

func TodaysCountByUser(d deps, id bson.ObjectId) int

TodaysCountByUser flags.

Types

type Flag

type Flag struct {
	ID        bson.ObjectId  `bson:"_id,omitempty" json:"id,omitempty"`
	UserID    bson.ObjectId  `bson:"user_id" json:"user_id"`
	RelatedTo string         `bson:"related_to" json:"related_to"`
	RelatedID *bson.ObjectId `bson:"related_id" json:"related_id,omitempty"`
	Content   string         `bson:"content" json:"content"`
	Status    status         `bson:"status" json:"status"`
	Reason    string         `bson:"reason" json:"reason"`
	Created   time.Time      `bson:"created_at" json:"created_at"`
	Updated   time.Time      `bson:"updated_at" json:"updated_at"`
	Deleted   *time.Time     `bson:"deleted_at,omitempty" json:"-"`
}

Flag represents a report sent by a user flagging a post/comment.

func FindId

func FindId(d deps, id bson.ObjectId) (f Flag, err error)

func FindOne

func FindOne(d deps, related string, relatedID, userID bson.ObjectId) (f Flag, err error)

func UpsertFlag

func UpsertFlag(d deps, f Flag) (flag Flag, err error)

UpsertComment performs validations before upserting data struct

Jump to

Keyboard shortcuts

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