models

package
v0.34.11 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// Unique identification of the app on the current device.
	// https://go-app.dev/reference#Context
	UUID string `json:"uuid"`

	// Timestamp of the subscription creation.
	TimeCreated time.Time `json:"time_created"`

	// Timestamp of the last notification sent through this device.
	TimeLastUsed time.Time `json:"time_last_used"`

	// List of labels for such device.
	Tags []string `json:"tags,omitempty"`

	// The very subscription struct/details.
	//Subscription app.NotificationSubscription `json:"subscription"`
	Subscription webpush.Subscription `json:"subscription"`
}

SubscriptionDevice

type Devices

type Devices struct {
	//Devices map[string]Device `json:"items"`
	Devices []Device `json:"items"`
}

Helper struct to see how the data is stored in the database.

type Poll

type Poll struct {
	// ID is an unique poll's identifier.
	ID string `json:"id"`

	// Question is to describe the main purpose of such poll.
	Question string `json:"question"`

	// OptionOne is the answer numero uno.
	OptionOne PollOption `json:"option_one"`

	// OptionTwo is the answer numero dos.
	OptionTwo PollOption `json:"option_two"`

	// OptionThree is the answer numero tres.
	OptionThree PollOption `json:"option_three"`

	// VodeList is the list of user nicknames voted on such poll already.
	Voted []string `json:"voted_list"`

	// Timestamp is an UNIX timestamp indication the poll's creation time; should be identical to the upstream post's Timestamp.
	Timestamp time.Time `json:"timestamp"`

	// Author is the back key to the user originally posting that poll.
	Author string `json:"author"`

	// ReactionCount counts the number of item's reactions.
	ReactionCount int `json:"reaction_count"`
}

type PollOption

type PollOption struct {
	// Content describes the very content of such poll's option/answer.
	Content string `json:"content"`

	// Counter hold a number of votes being committed to such option.
	Counter int `json:"counter"`
}

type Post

type Post struct {
	// ID is an unique post's identificator.
	ID string `json:"id"`

	// Type describes the post's type --- post, poll, reply, img.
	Type string `json:"type"`

	// Nickname is a name of the post's author's name.
	Nickname string `json:"nickname"`

	// Content contains the very post's data to be shown as a text typed in by the author when created.
	Content string `json:"content"`

	// Figure hold the filename of the uploaded figure to post with some provided text.
	Figure string `json:"figure"`

	// Timestamp is an UNIX timestamp, indicates the creation time.
	Timestamp time.Time `json:"timestamp"`

	// PollID is an identification of the Poll structure/object.
	PollID string `json:"poll_id"`

	// ReplyTo is a reference key to another post, that is being replied to.
	ReplyTo   int    `json:"reply_to"`
	ReplyToID string `json:"reply_to_id"`

	// ReactionCount counts the number of item's reactions.
	ReactionCount int `json:"reaction_count"`

	// ReplyCount hold the count of replies for such post.
	ReplyCount int `json:"reply_count"`

	// Data is a helper field for the actual figure upload.
	Data []byte `json:"data"`
}

type User

type User struct {
	// ID is an unique identifier.
	ID string `json:"id" binding:"required" validation:"required"`

	// Nickname is a login name of such user.
	Nickname string `json:"nickname" binding:"required"`

	// FullName is the "genuine" name of such user.
	FullName string `json:"full_name"`

	// Passphrase is a hashed pass phrase string (binary form).
	Passphrase string `json:"passphrase"`

	// PassphraseHex is a hashed pass phrase string (hexadecimal alphanumberic form).
	PassphraseHex string `json:"passphrase_hex"`

	// Email is a primary user's e-mail address.
	Email string `json:"email"`

	// Web is user's personal homepage.
	Web string `json:"web"`

	// AvatarURL is an URL to the user's custom profile picture.
	AvatarURL string `json:"avatar_url"`

	// About is a description string of such user.
	About string `json:"about"`

	// Active boolean indicates an activated user's account.
	Active bool `json:"active"`

	// Private boolean indicates a private user's account.
	Private bool `json:"private"`

	// FlowList is a string map of users, which posts should be added to one's flow page.
	FlowList map[string]bool `json:"flow_list"`

	// ShadeList is a map of account/users to be shaded (soft-blocked) from following.
	ShadeList map[string]bool `json:"shade_list"`

	// RequestList is a map of account requested to add this user to their flow --- used with the Private property.
	RequestList map[string]bool `json:"request_list"`

	// FlowToggle is a single implementation of FlowList.
	FlowToggle string `json:"flow_toggle"`

	// Color is the user's UI color scheme.
	Color string `json:"color" default:"#000000"`

	// RegisteredTime is an UNIX timestamp of the user's registeration.
	RegisteredTime time.Time `json:"registered_time"`

	// LastLoginTime is an UNIX timestamp of the last user's successful log-in.
	LastLoginTime time.Time `json:"last_login_time"`

	// LastLoginTime is an UNIX timestamp of the last action performed by such user.
	LastActiveTime time.Time `json:"last_active_time"`

	// searched is a bool indicating a status for the search engine.
	Searched bool `json:"-" default:true`

	// GDPR consent, set to true because it is noted on the registration page so. No user data should
	// be saved if the boolean is false.
	GDPR bool `json:"gdpr" default:true`

	// AppBgMode string defines the colour mode of the app's background (light vs dark).
	AppBgMode string `json:"app_bg_mode" default:"dark"`

	// Tags is an array of possible roles and other various attributes assigned to such user.
	Tags []string `json:"tags"`
}

type UserStat

type UserStat struct {
	// PostCount is a number of posts of such user.
	PostCount int `default:0`

	// ReactionCount tells the number of interactions (stars given).
	ReactionCount int `default:0`

	// FlowerCount is basically a number of followers.
	FlowerCount int `default:0`

	// ShadeCount is basically a number of blockers.
	ShadeCount int `default:0`

	// Searched is a special boolean used by the search engine to mark who is to be shown in search results.
	Searched bool `default:true`
}

UserStat is a helper struct to hold statistics about the whole app.

Jump to

Keyboard shortcuts

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