flags

package
v0.0.0-...-50d0064 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 10 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 DepsInterface, q bson.M) int

func TodaysCountByUser

func TodaysCountByUser(d DepsInterface, id primitive.ObjectID) int

TodaysCountByUser flags.

Types

type DepsInterface

type DepsInterface interface {
	Mgo() *mongo.Database
	S3() *deps.S3Service
	LedisDB() *ledis.DB
}

type Flag

type Flag struct {
	ID        primitive.ObjectID  `bson:"_id,omitempty" json:"id,omitempty"`
	UserID    primitive.ObjectID  `bson:"user_id" json:"user_id"`
	RelatedTo string              `bson:"related_to" json:"related_to"`
	RelatedID *primitive.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 DepsInterface, id primitive.ObjectID) (f Flag, err error)

func FindOne

func FindOne(d DepsInterface, related string, relatedID, userID primitive.ObjectID) (f Flag, err error)

func UpsertFlag

func UpsertFlag(d DepsInterface, 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