model

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBComment

type DBComment struct {
	Timestamp   time.Time           `bson:"timestamp" json:"timestamp"`
	CommentedBy *primitive.ObjectID `bson:"commented_by" json:"commented_by"` // CommentedBy contains a reference to the user who commented
	Content     string              `bson:"content" json:"content"`           // Content is the body of the comment
}

type DBEntry

type DBEntry struct {
	ID        primitive.ObjectID    `bson:"_id" json:"id"`
	Tags      []string              `bson:"tags" json:"tags"`       // Tags used for searching entries and ordering
	PartOf    []*primitive.ObjectID `bson:"part_of" json:"part_of"` // PartOf specifies the lists this entry is part of
	HashValue string                `bson:"hash_value" json:"hash"` // HashValue is the SHA512-hash of the file
	//FileURL   string                `bson:"file_url" json:"file_url"`   // FileURL may be set to a file link
	Timestamp time.Time           `bson:"timestamp" json:"timestamp"` // Timestamp of when this entry was added
	AddedBy   *primitive.ObjectID `bson:"added_by" json:"added_by"`   // AddedBy is a reference to the user who added this
	Comments  []*DBComment        `bson:"comments" json:"comments"`   // Comments regarding this entry
}

func (*DBEntry) AddTo

func (entry *DBEntry) AddTo(id *primitive.ObjectID)

func (*DBEntry) RemoveFrom

func (entry *DBEntry) RemoveFrom(id *primitive.ObjectID)

type DBHashList

type DBHashList struct {
	ID          primitive.ObjectID    `bson:"_id" json:"id"`
	Name        string                `bson:"name" json:"name"`
	Tags        []string              `bson:"tags" json:"tags"`               // Tags of this list for discovery, and sorting
	Comments    []*DBComment          `bson:"comments" json:"comments"`       // Comments regarding this list
	Creator     primitive.ObjectID    `bson:"creator" json:"creator"`         // Creator of the list
	Maintainers []*primitive.ObjectID `bson:"maintainers" json:"maintainers"` // Maintainers contains references to the users who may edit this list
}

type DBUser

type DBUser struct {
	ID primitive.ObjectID `bson:"_id" json:"id"`

	Username       string `bson:"username" json:"username"` // Username is the username the user has
	HashedPassword string `bson:"password" json:"-"`        // HashedPassword contains the bcrypt-ed password

	Admin *bool `bson:"admin,omitempty" json:"admin,omitempty"` // If set to true this user will have all privileges

	MatrixLinks        []*string `bson:"matrix_links" json:"matrix_links"`                 // MatrixLinks is the matrix-users this user has verified ownership over
	PendingMatrixLinks []*string `bson:"pending_matrix_links" json:"pending_matrix_links"` // PendingMatrixLinks is the matrix-users pending verification

	Password *string `bson:"-" json:"-"` // Password may never be sent out!
}

func (*DBUser) CheckPassword

func (usr *DBUser) CheckPassword(password string) error

func (*DBUser) HashPassword

func (usr *DBUser) HashPassword() error

func (*DBUser) ValidateMXID

func (usr *DBUser) ValidateMXID(mxid string) error

type JwtClaims

type JwtClaims struct {
	Username string `json:"username"`
	jwt.RegisteredClaims
}

Jump to

Keyboard shortcuts

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